Exemplo n.º 1
0
 /**
  * Returns Version.
  *
  * @return string Version
  */
 public function getVersion()
 {
     if (strpos($_SERVER["SERVER_SOFTWARE"], 'Apache') !== false) {
         return \Webinterface\Helper\Serverstack::printExclamationMark('Traitor - you are using Apache!');
     }
     if (strpos($_SERVER["SERVER_SOFTWARE"], 'Development Server') !== false) {
         return \Webinterface\Helper\Serverstack::printExclamationMark('The webinterface is served via the embedded PHP Development Server!');
     }
     return substr($_SERVER["SERVER_SOFTWARE"], 6);
 }
Exemplo n.º 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 \Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "mysqli" is required.');
     }
     $connection = @mysqli_connect('localhost', 'root', $this->getPassword());
     if (false === $connection) {
         return \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;
 }
Exemplo n.º 3
0
 /**
  * Returns memcached Version.
  *
  * @return string memcached Version
  */
 public function getVersion()
 {
     if ($this->isInstalled() === false) {
         return 'not installed';
     }
     if (extension_loaded('memcache') === false) {
         return \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 \Webinterface\Helper\Serverstack::printExclamationMark('Please wake the Memcache daemon.');
     }
 }
Exemplo n.º 4
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 \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];
 }
Exemplo n.º 5
0
 public function getVersion()
 {
     if ($this->isInstalled() === false) {
         return 'not installed';
     }
     if (!extension_loaded('mongo')) {
         return \Webinterface\Helper\Serverstack::printExclamationMark('The PHP Extension "Mongo" is required.');
     }
     try {
         $m = new \MongoClient();
         //require admin privilege
         $db = $m->admin;
         //$mongodb_info = $db->command(array('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 \Webinterface\Helper\Serverstack::printExclamationMark($e->getMessage() . '. Please wake the daemon.');
     }
     return $mongodb_version['retval'];
 }
Exemplo n.º 6
0
 public function getVersion()
 {
     if (extension_loaded('zmq') === false) {
         return \Webinterface\Helper\Serverstack::printExclamationMark('Not implemented yet!');
     }
 }
Exemplo n.º 7
0
 public function getPackagistPackageDescription($package = '')
 {
     $url = sprintf('https://packagist.org/packages/%s.json', $package);
     $context = stream_context_create(array('http' => array('ignore_errors' => true)));
     // silenced: because this throws a warning, if offline
     $json = @file_get_contents($url, false, $context);
     $array = json_decode($json, true);
     if (isset($array['status']) && $array['status'] === 'error') {
         \Webinterface\Helper\Serverstack::printExclamationMark('The request to packagist.org failed. This might be a service problem.' . ' Please ensure that HTTPS streamwrapper support is enabled in php.ini (extension=php_openssl.dll).');
     }
     return $array;
 }