Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | Private Member Functions | List of all members
eZSysInfo Class Reference

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

## Public Member Functions
| attributes ()
| hasAttribute ( $name)
| attribute ( $name)
| isValid ()
| cpuType ()
| cpuSpeed ()
| memorySize ()
| scan ()

## Public Attributes
| $IsValid = false
| $CPUSpeed = false
| $CPUType = false
| $CPUUnit = false
| $MemorySize = false

## Private Member Functions
| scanProc ( $cpuinfoPath=false, $meminfoPath=false)
| scanDMesg ( $dmesgPath=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" );
eZSysInfo
Provides common information on the running system.
Definition: ezsysinfo.php:32

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

## ◆ attribute()

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

References $CPUSpeed, $CPUType, $CPUUnit, $IsValid, $MemorySize, and eZDebug\writeError().

## ◆ attributes()

eZSysInfo::attributes | ( |  | ) |

Returns
  An array with available attributes. The available attributes:
  - cpu_type - cpuType()
  - cpu_unit - cpuUnit()
  - cpu_speed - cpuSpeed()
  - memory_size - memorySize()

Definition at line 41 of file ezsysinfo.php.

Referenced by hasAttribute().

## ◆ cpuSpeed()

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

References $CPUSpeed.

## ◆ cpuType()

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

References $CPUType.

## ◆ hasAttribute()

eZSysInfo::hasAttribute | ( |  | $name | ) |

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

Definition at line 54 of file ezsysinfo.php.

References attributes().

## ◆ isValid()

eZSysInfo::isValid | ( |  | ) |

Returns
  `true` if the system has been scanned correctly.

Definition at line 85 of file ezsysinfo.php.

References $IsValid.

## ◆ memorySize()

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

References $MemorySize.

## ◆ scan()

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

References $IsValid, eZSys\instance(), scanDMesg(), and scanProc().

## ◆ scanDMesg()

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

  $dmesgPath | The path to the dmesg file, if `false` it uses '/var/run/dmesg.boot' which should be sufficient.

Definition at line 265 of file ezsysinfo.php.

Referenced by scan().

## ◆ scanProc()

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

  $cpuinfoPath | The path to the cpuinfo file, if `false` it uses '/proc/cpuinfo' which should be sufficient.
  $meminfoPath | The path to the meminfo file, if `false` it uses '/proc/meminfo' which should be sufficient.

Definition at line 190 of file ezsysinfo.php.

Referenced by scan().

## Member Data Documentation

## ◆ $CPUSpeed

eZSysInfo::$CPUSpeed = false

Definition at line 312 of file ezsysinfo.php.

Referenced by attribute(), and cpuSpeed().

## ◆ $CPUType

eZSysInfo::$CPUType = false

Definition at line 313 of file ezsysinfo.php.

Referenced by attribute(), and cpuType().

## ◆ $CPUUnit

eZSysInfo::$CPUUnit = false

Definition at line 314 of file ezsysinfo.php.

Referenced by attribute().

## ◆ $IsValid

eZSysInfo::$IsValid = false

Definition at line 311 of file ezsysinfo.php.

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

## ◆ $MemorySize

eZSysInfo::$MemorySize = false

Definition at line 315 of file ezsysinfo.php.

Referenced by attribute(), and memorySize().

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

- ezsysinfo.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.