Subversion Repositories ALCASAR

Rev

Rev 2770 | Rev 3037 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 2976
Line 25... Line 25...
25
     * fill the private content var
25
     * fill the private content var
26
     */
26
     */
27
    public function __construct()
27
    public function __construct()
28
    {
28
    {
29
        parent::__construct();
29
        parent::__construct();
30
        $_wmi = null;
-
 
31
        try {
-
 
32
            // initialize the wmi object
-
 
33
            $objLocator = new COM('WbemScripting.SWbemLocator');
30
        if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) {
34
            $_wmi = $objLocator->ConnectServer('', 'root\OpenHardwareMonitor');
31
            $_wmi = CommonFunctions::initWMI('root\OpenHardwareMonitor', true);
35
        } catch (Exception $e) {
-
 
36
            $this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data.");
-
 
37
        }
-
 
38
        if ($_wmi) {
32
            if ($_wmi) {
39
            $tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
33
                $tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
40
            if ($tmpbuf) foreach ($tmpbuf as $buffer) {
34
                if ($tmpbuf) foreach ($tmpbuf as $buffer) {
41
                if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates
35
                    if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates
42
                    $this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value'];
36
                        $this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value'];
-
 
37
                    }
43
                }
38
                }
44
            }
39
            }
45
        }
40
        }
46
    }
41
    }
47
 
42