Path

ez components / documentation / api reference / trunk / systeminformation


eZ Components trunk

SystemInformation: ezcSystemInfo

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcSystemInfo

Provides access to common system variables. [source]
Variables not available from PHP directly are fetched using readers specific for each supported system. Corresponding reader is automatically detected, attached and forced to scan system info during initialization. An exception is thrown if the reader can't scan the system info.
Available readers are: Readers for other systems can be added by implementing the ezcSystemInfoReader interface.
The ezcSystemInfo class has the following properties:
Reader independent, these properties are available even if system reader was not initialized.

Properties

string read/write  $backupFileName
Backup filename for this platform, '.bak' for win32 and '~' for unix and mac.
integer read/write  $cpuCount
Number of CPUs in system or null.
float read/write  $cpuSpeed
CPU speed as float (e.g 1808.743) in Mhz or null.
string read/write  $cpuType
CPU type string (e.g 'AMD Sempron(tm) Processor 3000+') or null.
string read/write  $fileSystemType
Filesystem type (e.g 'linux') or null.
bool read/write  $isShellExecution
The flag which indicates if the script was executed over the web or the shell/command line.
Reader dependent, these properties are not available if reader was not initialized and didn't scan OS:
string read/write  $lineSeparator
Symbols which is used for line separators on the current OS.
integer read/write  $memorySize
Memory Size in bytes int (e.g. 528424960) or null.
Example:
 1.   $info ezcSystemInfo::getInstance();
 2.   echo 'Processors: '$info->cpuCount"\n";
 3.   echo 'CPU Type: '$info->cpuType"\n";
 4.   echo 'CPU Speed: '$info->cpuSpeed"\n";
string read/write  $osName
OS name (e.g 'Linux') or null.
string read/write  $osType
OS type (e.g 'unix') or null.
ezcSystemInfoAccelerator read/write  $phpAccelerator
Structure with PHP accelerator info or null. ezcSystemInfoAccelerator.
array read/write  $phpVersion
Array with PHP version (e.g. array(5,1,1) ).

Method Summary

public static ezcSystemInfo getInstance( )
Returns the single instance of the ezcSystemInfo class.
public static bool isShellExecution( )
Determines if the script was executed over the web or the shell/command line.
public static ezcSystemInfoAccelerator phpAccelerator( )
Detects if a PHP accelerator is running and what type it is.
public static array(string) phpVersion( )
Returns the PHP version as an array with the version elements.

Methods

getInstance

ezcSystemInfo getInstance( )
Returns the single instance of the ezcSystemInfo class.

Throws

ClassDescription
ezcSystemInfoReaderCantScanOSException If system variables can't be received from OS.

isShellExecution

bool isShellExecution( )
Determines if the script was executed over the web or the shell/command line.

phpAccelerator

ezcSystemInfoAccelerator phpAccelerator( )
Detects if a PHP accelerator is running and what type it is.

phpVersion

array(string) phpVersion( )
Returns the PHP version as an array with the version elements.

Last updated: Mon, 21 Dec 2009