eZ Publish  [trunk]
eZSysInfo Class Reference

Provides common information on the running system. More...

List of all members.

Public Member Functions

 attribute ($name)
 attributes ()
 cpuSpeed ()
 cpuType ()
 eZSysInfo ()
 hasAttribute ($name)
 isValid ()
 memorySize ()
 scan ()

Public Attributes

 $CPUSpeed = false
 $CPUType = false
 $CPUUnit = false
 $IsValid = false
 $MemorySize = false

Private Member Functions

 scanDMesg ($dmesgPath=false)
 scanProc ($cpuinfoPath=false, $meminfoPath=false)

Detailed Description

Provides common information on the running system.

The following information can be queried:

  • CPU Type (e.g Pentium) - cpuType()
  • CPU Speed (e.g 1000) - cpuSpeed()
  • CPU Unit (e.g. MHz) - cpuUnit()
  • Memory Size in bytes (e.g. 528424960) - memorySize()
  $info = new eZSysInfo();
  $info->scan();
  print( $info->cpuType() . "\n" );
Note:
This class supports the 'attribute' system and be used directly as a template variable.
It uses eZSys to figure out the OS type.

Definition at line 31 of file ezsysinfo.php.


Member Function Documentation

eZSysInfo::attribute ( name)
Returns:
The value of the attribute named $name, or null if it does not exist. See attributes() for a list of available attributes.

Definition at line 70 of file ezsysinfo.php.

Returns:
An array with available attributes. The available attributes:

Definition at line 48 of file ezsysinfo.php.

Referenced by hasAttribute().

Contains the speed of CPU, the type is taken directly from the OS and can vary a lot. The speed is just a number so use cpuUnit() to get the proper unit (e.g MHz).

Returns:
The speed as a string or false if no type was found.

Definition at line 113 of file ezsysinfo.php.

Contains the type of CPU, the type is taken directly from the OS and can vary a lot.

Returns:
The type as a string or false if no type was found.

Definition at line 102 of file ezsysinfo.php.

Constructor

Definition at line 36 of file ezsysinfo.php.

Returns:
true if the attribute named $name exists. See attributes() for a list of available attributes.

Definition at line 61 of file ezsysinfo.php.

Returns:
true if the system has been scanned correctly.

Definition at line 92 of file ezsysinfo.php.

Contains the amount of system memory the OS has, the value is in bytes.

Returns:
The type as a number false if no type was found.

Definition at line 123 of file ezsysinfo.php.

Scans the system depending on the OS and fills in the information internally.

Returns:
true if it was able to scan the system or false if it failed.

Definition at line 132 of file ezsysinfo.php.

eZSysInfo::scanDMesg ( dmesgPath = false) [private]

Scans the dmesg.boot file which is created by the kernel. If this files are unavailable or could not be read it will return false.

Parameters:
$dmesgPathThe path to the dmesg file, if false it uses '/var/run/dmesg.boot' which should be sufficient.

Definition at line 272 of file ezsysinfo.php.

Referenced by scan().

eZSysInfo::scanProc ( cpuinfoPath = false,
meminfoPath = false 
) [private]

Scans the /proc/cpuinfo and /proc/meminfo files for CPU and memory information. If this files are unavailable or could not be read it will return false.

Parameters:
$cpuinfoPathThe path to the cpuinfo file, if false it uses '/proc/cpuinfo' which should be sufficient.
$meminfoPathThe path to the meminfo file, if false it uses '/proc/meminfo' which should be sufficient.

Definition at line 197 of file ezsysinfo.php.

Referenced by scan().


Member Data Documentation

eZSysInfo::$CPUSpeed = false

Definition at line 319 of file ezsysinfo.php.

eZSysInfo::$CPUType = false

Definition at line 320 of file ezsysinfo.php.

eZSysInfo::$CPUUnit = false

Definition at line 321 of file ezsysinfo.php.

eZSysInfo::$IsValid = false

Definition at line 318 of file ezsysinfo.php.

eZSysInfo::$MemorySize = false

Definition at line 322 of file ezsysinfo.php.


The documentation for this class was generated from the following file: