eZ Publish  [4.2]
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 54 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 93 of file ezsysinfo.php.

eZSysInfo::attributes ( )
Returns:
An array with available attributes. The available attributes:

Definition at line 71 of file ezsysinfo.php.

Referenced by hasAttribute().

eZSysInfo::cpuSpeed ( )

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 136 of file ezsysinfo.php.

eZSysInfo::cpuType ( )

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 125 of file ezsysinfo.php.

eZSysInfo::eZSysInfo ( )

Constructor

Definition at line 59 of file ezsysinfo.php.

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

Definition at line 84 of file ezsysinfo.php.

eZSysInfo::isValid ( )
Returns:
true if the system has been scanned correctly.

Definition at line 115 of file ezsysinfo.php.

eZSysInfo::memorySize ( )

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 146 of file ezsysinfo.php.

eZSysInfo::scan ( )

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 155 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 295 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 220 of file ezsysinfo.php.

Referenced by scan().


Member Data Documentation

eZSysInfo::$CPUSpeed = false

Definition at line 342 of file ezsysinfo.php.

eZSysInfo::$CPUType = false

Definition at line 343 of file ezsysinfo.php.

eZSysInfo::$CPUUnit = false

Definition at line 344 of file ezsysinfo.php.

eZSysInfo::$IsValid = false

Definition at line 341 of file ezsysinfo.php.

eZSysInfo::$MemorySize = false

Definition at line 345 of file ezsysinfo.php.


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