public static function getLinuxDistro()
    {

        // declare Linux distros (extensible list).
        $distros = array(
            SetupKeys::OS_ARCH   => 'arch-release',
            SetupKeys::OS_DEBIAN => 'debian_version',
            SetupKeys::OS_FEDORA => 'fedora-release',
            SetupKeys::OS_UBUNTU => 'lsb-release',
            SetupKeys::OS_REDHAT => 'redhat-release',
            SetupKeys::OS_CENTOS => 'centos-release'
        );

        // get everything from /etc directory.
        $etcList = scandir('/etc');

        // loop through /etc results...
        $distro = '';

        // iterate over all found files
        foreach ($etcList as $entry) {
            // loop through list of distros..
            foreach ($distros as $distroReleaseFile) {
                // match was found.
                if ($distroReleaseFile === $entry) {
                    // find distros array key (i.e. distro name) by value (i.e. distro release file)
                    $distro = array_search($distroReleaseFile, $distros);
                    break 2; // break inner and outer loop.
                }
            }
        }

        // return the found distro string
        return $distro;
    }
public static function getLinuxDistro()
    {

        // declare Linux distros (extensible list).
        $distros = array(
            SetupKeys::OS_ARCH   => 'arch-release',
            SetupKeys::OS_DEBIAN => 'debian_version',
            SetupKeys::OS_FEDORA => 'fedora-release',
            SetupKeys::OS_UBUNTU => 'lsb-release',
            SetupKeys::OS_REDHAT => 'redhat-release',
            SetupKeys::OS_CENTOS => 'centos-release'
        );

        // get everything from /etc directory.
        $etcList = scandir('/etc');

        // loop through /etc results...
        $distro = '';

        // iterate over all found files
        foreach ($etcList as $entry) {
            // loop through list of distros..
            foreach ($distros as $distroReleaseFile) {
                // match was found.
                if ($distroReleaseFile === $entry) {
                    // find distros array key (i.e. distro name) by value (i.e. distro release file)
                    $distro = array_search($distroReleaseFile, $distros);
                    break 2; // break inner and outer loop.
                }
            }
        }

        // return the found distro string
        return $distro;
    }
public static function getLinuxDistro ( ) { // declare Linux distros (extensible list). $ distros = array ( SetupKeys :: OS_ARCH => 'arch-release' , SetupKeys :: OS_DEBIAN => 'debian_version' , SetupKeys :: OS_FEDORA => 'fedora-release' , SetupKeys :: OS_UBUNTU => 'lsb-release' , SetupKeys :: OS_REDHAT => 'redhat-release' , SetupKeys :: OS_CENTOS => 'centos-release' ) ; // get everything from /etc directory. $ etcList = scandir ( '/etc' ) ; // loop through /etc results... $ distro = '' ; // iterate over all found files foreach ( $ etcList as $ entry ) { // loop through list of distros.. foreach ( $ distros as $ distroReleaseFile ) { // match was found. if ( $ distroReleaseFile === $ entry ) { // find distros array key (i.e. distro name) by value (i.e. distro release file) $ distro = array_search ( $ distroReleaseFile , $ distros ) ; break 2 ; // break inner and outer loop. } } } // return the found distro string return $ distro ; }
Returns the Linux distribution we're running on.

@return string The Linux distribution we're running on
Returns the Linux distribution we re running on .