Path

ez components / documentation / api reference / 2006.2 / systeminformation


eZ Components 2006.2

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.
  • String osType, OS type (e.g 'unix') or null.
  • String osName, OS name (e.g 'Linux') or null.
  • String fileSystemType, filesystem type (e.g 'linux') or null.
  • String lineSeparator, which is used for line separators on the current OS.
  • String backupFileName, backup filename for this platform, '.bak' for win32 and '~' for unix and mac.
  • Array phpVersion, with PHP version (e.g. array(5,1,1) ).
  • ezcSystemInfoAccelerator phpAccelerator, structure with PHP accelerator info or null ezcSystemInfoAccelerator.
  • Bool isShellExecution, 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:
  • Integer cpuCount number of CPUs in system or null.
  • String cpuType CPU type string (e.g 'AMD Sempron(tm) Processor 3000+') or null.
  • Float cpuSpeed CPU speed as float (e.g 1808.743) or null.
  • Integer 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";

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: Thu, 01 Nov 2007