/** * This makes unit-testing a heck of a lot easier */ function getsysname() { return $this->_os->getSysname(); }
/** * Resolve the system name * * @access private */ function _setSystemName() { $OS_Guess = new OS_Guess(); $sysname = $OS_Guess->getSysname(); /* Nasty hack for Debian, as it uses a custom ping version */ if ('linux' == $sysname) { if (file_exists('/etc/debian_version')) { $sysname = 'debian'; } } return $sysname; }
/** * Factory for Net_Traceroute * * Call this method to create a new instance of Net_Traceroute * * @return object Net_Traceroute * @access public */ function factory() { $OS_Guess = new OS_Guess(); $sysname = $OS_Guess->getSysname(); $traceroute_path = ''; if (($traceroute_path = Net_Traceroute::_setTraceroutePath($sysname)) == NET_TRACEROUTE_CANT_LOCATE_TRACEROUTE_BINARY) { return PEAR::throwError(NET_TRACEROUTE_CANT_LOCATE_TRACEROUTE_BINARY_MSG, NET_TRACEROUTE_CANT_LOCATE_TRACEROUTE_BINARY); } else { return new Net_Traceroute($traceroute_path, $sysname); } }
/** * Resolve the system name * * @access private */ function _setSystemName() { $OS_Guess = new OS_Guess(); $sysname = $OS_Guess->getSysname(); // Refine the sysname for different Linux bundles/vendors. (This // should go away if OS_Guess was ever extended to give vendor // and vendor-version guesses.) // // Bear in mind that $sysname is eventually used to craft a // method name to figure out which backend gets used to parse // the ping output. Elsewhere, we'll set $sysname back before // that. if ('linux' == $sysname) { if (file_exists('/etc/lsb-release') && false !== ($release = @file_get_contents('/etc/lsb-release')) && preg_match('/gutsy/i', $release)) { $sysname = 'linuxredhat9'; } else { if (file_exists('/etc/debian_version')) { $sysname = 'linuxdebian'; } else { if (file_exists('/etc/redhat-release') && false !== ($release = @file_get_contents('/etc/redhat-release'))) { if (preg_match('/release 8/i', $release)) { $sysname = 'linuxredhat8'; } elseif (preg_match('/release 9/i', $release)) { $sysname = 'linuxredhat9'; } } } } } return $sysname; }
/** * Constructor; initializes the system variable. */ function System_Folders() { $og = new OS_Guess(); $this->sys = $og->getSysname(); }
* building document type declaration */ print 'building DocType declaration:<br>'; print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0')); print "\n<br><br>\n"; $modes = mcrypt_list_modes(); echo "mcrypt_list_modes <br>\n"; echo print_r_xml($modes); //F:\bit5411\php\PEAR\OS\Guess.php class OS_Guess require_once 'OS/Guess.php'; $phpwhat = new OS_Guess(); //$phpwhat = OS_Guess::getSignature(); //fatal this $tmp = $phpwhat->getSignature(); echo $tmp; echo PHP_EOL; $tmp = $phpwhat->getSysname(); echo $tmp; echo PHP_EOL; $tmp = $phpwhat->getNodename(); echo $tmp; echo PHP_EOL; $tmp = $phpwhat->getCpu(); echo $tmp; echo PHP_EOL; $tmp = $phpwhat->getRelease(); echo $tmp; echo PHP_EOL; $tmp = $phpwhat->getExtra(); echo $tmp; echo PHP_EOL; echo php_uname();