public static function read_lsb_distributor_id() { $vendor = phodevi_linux_parser::read_lsb('Distributor ID'); // Quirks for derivative distributions that don't know how to handle themselves properly if ($vendor == 'MandrivaLinux' && phodevi_linux_parser::read_lsb('Description') == 'PCLinuxOS') { // PC Linux OS only stores its info in /etc/pclinuxos-release $vendor = false; } return $vendor; }
public static function sw_os_version() { // Returns OS version if (phodevi::is_macosx()) { $os = phodevi_osx_parser::read_osx_system_profiler('SPSoftwareDataType', 'SystemVersion'); $start_pos = strpos($os, '.'); $end_pos = strrpos($os, '.'); $start_pos = strrpos(substr($os, 0, $start_pos), ' '); $end_pos = strpos($os, ' ', $end_pos); $os_version = substr($os, $start_pos + 1, $end_pos - $start_pos); } else { if (phodevi::is_linux()) { $os_version = phodevi_linux_parser::read_lsb('Release'); if ($os_version == null && is_readable('/etc/os-release')) { $os_release = parse_ini_file('/etc/os-release'); if (isset($os_release['VERSION_ID']) && !empty($os_release['VERSION_ID'])) { $os_version = $os_release['VERSION_ID']; } else { if (isset($os_release['VERSION']) && !empty($os_release['VERSION'])) { $os_version = $os_release['VERSION']; } } $os_version = pts_strings::keep_in_string($os_version, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE); } } else { $os_version = php_uname('r'); } } return $os_version; }