eZPublish(LegacyStack)  5.1
eZSysInfo Class Reference

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

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.

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.
eZSysInfo::attributes ( )
Returns
An array with available attributes. The available attributes:

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.
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.
eZSysInfo::eZSysInfo ( )

Constructor

eZSysInfo::hasAttribute (   $name)
Returns
true if the attribute named $name exists. See attributes() for a list of available attributes.
eZSysInfo::isValid ( )
Returns
true if the system has been scanned correctly.
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.
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.
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.

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.

Referenced by scan().

Member Data Documentation

eZSysInfo::$CPUSpeed = false

Referenced by attribute(), and cpuSpeed().

eZSysInfo::$CPUType = false

Referenced by attribute(), and cpuType().

eZSysInfo::$CPUUnit = false

Referenced by attribute().

eZSysInfo::$IsValid = false

Referenced by attribute(), isValid(), and scan().

eZSysInfo::$MemorySize = false

Referenced by attribute(), and memorySize().


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