Пример #1
0
 /**
  * Returns Version.
  *
  * @return string Version
  */
 public function getVersion()
 {
     if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('Traitor - you are using Apache!');
     }
     if (strpos($_SERVER['SERVER_SOFTWARE'], 'Development Server') !== false) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('The webinterface is served via the embedded PHP Development Server!');
     }
     return substr($_SERVER['SERVER_SOFTWARE'], 6);
 }
Пример #2
0
 /**
  * Returns MariaDB Version.
  *
  * @return string MariaDB Version
  */
 public function getVersion()
 {
     # fail safe, for unconfigured php.ini files
     if (!function_exists('mysqli_connect')) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "mysqli" is required.');
     }
     $connection = @mysqli_connect('localhost', 'root', $this->getPassword());
     if (false === $connection) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark(sprintf('MariaDB Connection not possible. Access denied. Check credentials. Error: "%s"', mysqli_connect_error()));
     }
     // fetch server_info, e.g. "5.5.5-10.1.0-MariaDB" and drop the last part
     $version = str_replace('-MariaDB', '', $connection->server_info);
     $connection->close();
     return $version;
 }
Пример #3
0
 /**
  * Returns PHP Version.
  *
  * @return string PHP Version
  */
 public function getVersion()
 {
     // load and parse a PEAR file to get the version, alternative to "pear.bat -V"
     $file = WPNXM_BIN . 'php\\PEAR\\pear\\PEAR\\Autoloader.php';
     # fail safe, if PEAR not installed
     if (is_file($file) === false) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "mysqli" is required.');
     }
     $maxLines = 60;
     // read only the first few lines of the file
     $file_handle = fopen($file, 'r');
     for ($i = 1; $i < $maxLines && !feof($file_handle); $i++) {
         $line_of_text = fgetcsv($file_handle, 1024);
         if (strpos($line_of_text[0], '@version')) {
             // lets grab the version from the phpdoc tag
             preg_match('/\\/* @version[\\s]+Release: (\\d+.\\d+.\\d+)/', $line_of_text[0], $matches);
         }
     }
     fclose($file_handle);
     return $versions = $matches[1];
 }
Пример #4
0
 public function getVersion()
 {
     if ($this->isInstalled() === false) {
         return 'not installed';
     }
     if (!extension_loaded('mongo')) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "Mongo" is required.');
     }
     try {
         $m = new \MongoClient();
         //require admin privilege
         $db = $m->admin;
         //$mongodb_info = $db->command(['buildinfo' => true]);
         //$mongodb_version = $mongodb_info['version'];
         // this returns an array with the keys "retval","ok"
         $mongodb_version = $db->execute('return db.version()');
     } catch (\MongoConnectionException $e) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark($e->getMessage() . '. Please wake the daemon.');
     }
     return $mongodb_version['retval'];
 }
Пример #5
0
 /**
  * Returns memcached Version.
  *
  * @return string memcached Version
  */
 public function getVersion()
 {
     if ($this->isInstalled() === false) {
         return 'not installed';
     }
     if (extension_loaded('memcache') === false) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "memcache" is required.');
     }
     // hardcoded for now
     $server = 'localhost';
     $port = 11211;
     $memcache = new \Memcache();
     $memcache->addServer($server, $port);
     $version = @$memcache->getVersion();
     $available = (bool) $version;
     if ($available && @$memcache->connect($server, $port)) {
         return $version;
     } else {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('Please wake the Memcache daemon.');
     }
 }
Пример #6
0
 public function getVersion()
 {
     if (extension_loaded('zmq') === false) {
         return \WPNXM\Webinterface\Helper\Serverstack::printExclamationMark('Not implemented yet!');
     }
 }