예제 #1
0
 /**
  * Returns the single instance of the ezcSystemInfo class.
  *
  * @throws ezcSystemInfoReaderCantScanOSException
  *         If system variables can't be received from OS.
  * @return ezcSystemInfo
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #2
0
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version 2014.07.0
 * @package kernel
 */
$module = $Params['Module'];
$mode = $Params['Mode'];
if ($mode and $mode === 'php') {
    phpinfo();
    eZExecution::cleanExit();
}
$http = eZHTTPTool::instance();
$ini = eZINI::instance();
$tpl = eZTemplate::factory();
$db = eZDB::instance();
try {
    $info = ezcSystemInfo::getInstance();
} catch (ezcSystemInfoReaderCantScanOSException $e) {
    $info = null;
    eZDebug::writeNotice("Could not read system information, returned: '" . $e->getMessage() . "'", 'system/info');
}
if ($info instanceof ezcSystemInfo) {
    // Workaround until ezcTemplate is used, as properties can not be accessed directly in ezp templates.
    $systemInfo = array('cpu_type' => $info->cpuType, 'cpu_speed' => $info->cpuSpeed, 'cpu_count' => $info->cpuCount, 'memory_size' => $info->memorySize);
    if ($info->phpAccelerator !== null) {
        $phpAcceleratorInfo = array('name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'version_integer' => $info->phpAccelerator->versionInt, 'version_string' => $info->phpAccelerator->versionString);
    } else {
        $phpAcceleratorInfo = array();
    }
} else {
    $systemInfo = array('cpu_type' => '', 'cpu_speed' => '', 'cpu_count' => '', 'memory_size' => '');
    $phpAcceleratorInfo = array();
예제 #3
0
 public function testGetInvalidProperty()
 {
     $info = ezcSystemInfo::getInstance();
     try {
         $info->no_such_property;
         $this->fail('Expected exception was not thrown');
     } catch (ezcBasePropertyNotFoundException $e) {
         $expected = "No such property name 'no_such_property'.";
         $this->assertEquals($expected, $e->getMessage());
     }
 }