Subversion Repositories ALCASAR

Rev

Rev 2976 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
1
<?php
1
<?php
2
/**
2
/**
3
 * Basic OS Class
3
 * Basic OS Class
4
 *
4
 *
5
 * PHP version 5
5
 * PHP version 5
6
 *
6
 *
7
 * @category  PHP
7
 * @category  PHP
8
 * @package   PSI OS class
8
 * @package   PSI OS class
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.OS.inc.php 699 2012-09-15 11:57:13Z namiltd $
12
 * @version   SVN: $Id: class.OS.inc.php 699 2012-09-15 11:57:13Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
14
 */
15
 /**
15
 /**
16
 * Basic OS functions for all OS classes
16
 * Basic OS functions for all OS classes
17
 *
17
 *
18
 * @category  PHP
18
 * @category  PHP
19
 * @package   PSI OS class
19
 * @package   PSI OS class
20
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
20
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
21
 * @copyright 2009 phpSysInfo
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
23
 * @version   Release: 3.0
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
25
 */
26
abstract class OS implements PSI_Interface_OS
26
abstract class OS implements PSI_Interface_OS
27
{
27
{
28
    /**
28
    /**
29
     * object for error handling
29
     * object for error handling
30
     *
30
     *
31
     * @var PSI_Error
31
     * @var PSI_Error
32
     */
32
     */
33
    protected $error;
33
    protected $error;
34
 
34
 
35
    /**
35
    /**
36
     * block name
36
     * block name
37
     *
37
     *
38
     * @var string
38
     * @var string
39
     */
39
     */
40
    protected $blockname = false;
40
    protected $blockname = false;
41
 
41
 
42
    /**
42
    /**
43
     * @var System
43
     * @var System
44
     */
44
     */
45
    protected $sys;
45
    protected $sys;
46
 
46
 
47
    /**
47
    /**
48
     * build the global Error object
48
     * build the global Error object
49
     */
49
     */
50
    public function __construct($blockname = false)
50
    public function __construct($blockname = false)
51
    {
51
    {
52
        $this->error = PSI_Error::singleton();
52
        $this->error = PSI_Error::singleton();
53
        $this->sys = new System();
53
        $this->sys = new System();
54
        $this->blockname = $blockname;
54
        $this->blockname = $blockname;
55
    }
55
    }
56
 
56
 
57
    /**
57
    /**
58
     * get os specific encoding
58
     * get os specific encoding
59
     *
59
     *
60
     * @see PSI_Interface_OS::getEncoding()
60
     * @see PSI_Interface_OS::getEncoding()
61
     *
61
     *
62
     * @return string
62
     * @return string
63
     */
63
     */
64
    public function getEncoding()
64
    public function getEncoding()
65
    {
65
    {
66
        return PSI_SYSTEM_CODEPAGE;
66
        return PSI_SYSTEM_CODEPAGE;
67
    }
67
    }
68
 
68
 
69
    /**
69
    /**
70
     * get os specific language
70
     * get os specific language
71
     *
71
     *
72
     * @see PSI_Interface_OS::getLanguage()
72
     * @see PSI_Interface_OS::getLanguage()
73
     *
73
     *
74
     * @return string
74
     * @return string
75
     */
75
     */
76
    public function getLanguage()
76
    public function getLanguage()
77
    {
77
    {
78
        return PSI_SYSTEM_LANG;
78
        return PSI_SYSTEM_LANG;
79
    }
79
    }
80
 
80
 
81
    /**
81
    /**
82
     * get block name
82
     * get block name
83
     *
83
     *
84
     * @see PSI_Interface_OS::getBlockName()
84
     * @see PSI_Interface_OS::getBlockName()
85
     *
85
     *
86
     * @return string
86
     * @return string
87
     */
87
     */
88
    public function getBlockName()
88
    public function getBlockName()
89
    {
89
    {
90
        return $this->blockname;
90
        return $this->blockname;
91
    }
91
    }
92
 
92
 
93
    /**
93
    /**
94
     * Number of Users
94
     * Number of Users
95
     *
95
     *
96
     * @return void
96
     * @return void
97
     */
97
     */
98
    protected function _users()
98
    protected function _users()
99
    {
99
    {
100
        if (CommonFunctions::executeProgram('who', '', $strBuf, PSI_DEBUG)) {
100
        if (CommonFunctions::executeProgram('who', '', $strBuf, PSI_DEBUG)) {
101
            if (strlen($strBuf) > 0) {
101
            if (strlen($strBuf) > 0) {
102
                $lines = preg_split('/\n/', $strBuf);
102
                $lines = preg_split('/\n/', $strBuf);
103
                $this->sys->setUsers(count($lines));
103
                $this->sys->setUsers(count($lines));
104
            }
104
            }
105
        } elseif (CommonFunctions::executeProgram('uptime', '', $buf, PSI_DEBUG) && preg_match("/,\s+(\d+)\s+user[s]?,/", $buf, $ar_buf)) {
105
        } elseif (CommonFunctions::executeProgram('uptime', '', $buf, PSI_DEBUG) && preg_match("/,\s+(\d+)\s+user[s]?,/", $buf, $ar_buf)) {
106
        //} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/,\s+(\d+)\s+user[s]?,\s+load average[s]?:\s+(.*),\s+(.*),\s+(.*)$/", $buf, $ar_buf)) {
106
        //} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/,\s+(\d+)\s+user[s]?,\s+load average[s]?:\s+(.*),\s+(.*),\s+(.*)$/", $buf, $ar_buf)) {
107
            $this->sys->setUsers($ar_buf[1]);
107
            $this->sys->setUsers($ar_buf[1]);
108
        } else {
108
        } else {
109
            $processlist = glob('/proc/*/cmdline', GLOB_NOSORT);
109
            $processlist = CommonFunctions::findglob('/proc/*/cmdline', GLOB_NOSORT);
110
            if (is_array($processlist) && (($total = count($processlist)) > 0)) {
110
            if (is_array($processlist) && (($total = count($processlist)) > 0)) {
111
                $count = 0;
111
                $count = 0;
112
                $buf = "";
112
                $buf = "";
113
                for ($i = 0; $i < $total; $i++) {
113
                for ($i = 0; $i < $total; $i++) {
114
                    if (CommonFunctions::rfts($processlist[$i], $buf, 0, 4096, false)) {
114
                    if (CommonFunctions::rfts($processlist[$i], $buf, 0, 4096, false)) {
115
                        $name = str_replace(chr(0), ' ', trim($buf));
115
                        $name = str_replace(chr(0), ' ', trim($buf));
116
                        if (preg_match("/^-/", $name)) {
116
                        if (preg_match("/^-/", $name)) {
117
                            $count++;
117
                            $count++;
118
                        }
118
                        }
119
                    }
119
                    }
120
                }
120
                }
121
                if ($count > 0) {
121
                if ($count > 0) {
122
                    $this->sys->setUsers($count);
122
                    $this->sys->setUsers($count);
123
                }
123
                }
124
            }
124
            }
125
        }
125
        }
126
    }
126
    }
127
 
127
 
128
    /**
128
    /**
129
     * IP of the Host
129
     * IP of the Host
130
     *
130
     *
131
     * @return void
131
     * @return void
132
     */
132
     */
133
    protected function _ip()
133
    protected function _ip()
134
    {
134
    {
135
        if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) {
135
        if (PSI_USE_VHOST && !defined('PSI_EMU_HOSTNAME')) {
136
           if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined
136
           if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined
137
              && !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
137
              && !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
138
                $dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
138
                $dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
139
                if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record
139
                if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record
140
                    $this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation)
140
                    $this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation)
141
                } else {
141
                } else {
142
                    $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result)); //from SERVER_ADDR or LOCAL_ADDR
142
                    $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result)); //from SERVER_ADDR or LOCAL_ADDR
143
                }
143
                }
144
            } else {
144
            } else {
145
                $this->sys->setIp(gethostbyname($this->sys->getHostname())); //IPv4 only
145
                $this->sys->setIp(gethostbyname($this->sys->getHostname())); //IPv4 only
146
            }
146
            }
147
        } elseif (((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) && (CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result))) {
147
        } elseif (((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) && (CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result))) {
148
            $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result));
148
            $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result));
149
        } else {
149
        } else {
150
            //$this->sys->setIp(gethostbyname($this->sys->getHostname()));
150
            //$this->sys->setIp(gethostbyname($this->sys->getHostname()));
151
            $hn = $this->sys->getHostname();
151
            $hn = $this->sys->getHostname();
152
            $ghbn = gethostbyname($hn);
152
            $ghbn = gethostbyname($hn);
153
            if (defined('PSI_EMU_HOSTNAME') && ($hn === $ghbn)) {
153
            if (defined('PSI_EMU_HOSTNAME') && ($hn === $ghbn)) {
154
                $this->sys->setIp(PSI_EMU_HOSTNAME);
154
                $this->sys->setIp(PSI_EMU_HOSTNAME);
155
            } else {
155
            } else {
156
                $this->sys->setIp($ghbn);
156
                $this->sys->setIp($ghbn);
157
            }
157
            }
158
        }
158
        }
159
    }
159
    }
160
 
160
 
161
    /**
161
    /**
162
     * MEM information from dmidecode
162
     * MEM information from dmidecode
163
     *
163
     *
164
     * @return void
164
     * @return void
165
     */
165
     */
166
    protected function _dmimeminfo()
166
    protected function _dmimeminfo()
167
    {
167
    {
168
        $banks = array();
-
 
169
        $buffer = '';
-
 
170
        if (defined('PSI_DMIDECODE_ACCESS') && (strtolower(PSI_DMIDECODE_ACCESS)=="data")) {
-
 
171
            CommonFunctions::rfts(PSI_APP_ROOT.'/data/dmidecode.txt', $buffer);
-
 
172
        } elseif (CommonFunctions::_findProgram('dmidecode')) {
168
        $dmimd = CommonFunctions::readdmimemdata();
173
            CommonFunctions::executeProgram('dmidecode', '-t 17', $buffer, PSI_DEBUG);
-
 
174
        }
-
 
175
        if (!empty($buffer)) {
169
        if (!empty($dmimd)) {
176
            $banks = preg_split('/^(?=Handle\s)/m', $buffer, -1, PREG_SPLIT_NO_EMPTY);
-
 
177
            foreach ($banks as $bank) if (preg_match('/^Handle\s/', $bank)) {
-
 
178
                $lines = preg_split("/\n/", $bank, -1, PREG_SPLIT_NO_EMPTY);
-
 
179
                $mem = array();
170
            foreach ($dmimd as $mem) {
180
                foreach ($lines as $line) if (preg_match('/^\s+([^:]+):(.+)/' ,$line, $params)) {
-
 
181
                    if (preg_match('/^0x([A-F\d]+)/', $params2 = trim($params[2]), $buff)) {
-
 
182
                        $mem[trim($params[1])] = trim($buff[1]);
-
 
183
                    } elseif ($params2 != '') {
-
 
184
                        $mem[trim($params[1])] = $params2;
-
 
185
                    }
-
 
186
                }
-
 
187
                if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0)) {
171
                if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0)) {
188
                    $dev = new HWDevice();
172
                    $dev = new HWDevice();
189
                    $name = '';
173
                    $name = '';
190
                    if (isset($mem['Part Number']) && !preg_match("/^PartNum\d+$/", $part = $mem['Part Number']) && ($part != 'None') && ($part != 'N/A') && ($part != 'Not Specified') && ($part != 'NOT AVAILABLE')) {
174
                    if (isset($mem['Part Number']) && !preg_match("/^PartNum\d+$/", $part = $mem['Part Number']) && ($part != 'None') && ($part != 'N/A') && ($part != 'Not Specified') && ($part != 'NOT AVAILABLE')) {
191
                        $name = $part;
175
                        $name = $part;
192
                    }
176
                    }
193
                    if (isset($mem['Locator']) && (($dloc = $mem['Locator']) != 'None') && ($dloc != 'N/A') && ($dloc != 'Not Specified')) {
177
                    if (isset($mem['Locator']) && (($dloc = $mem['Locator']) != 'None') && ($dloc != 'N/A') && ($dloc != 'Not Specified')) {
194
                        if ($name != '') {
178
                        if ($name != '') {
195
                            $name .= ' - '.$dloc;
179
                            $name .= ' - '.$dloc;
196
                        } else {
180
                        } else {
197
                            $name = $dloc;
181
                            $name = $dloc;
198
                        }
182
                        }
199
                    }
183
                    }
200
                    if (isset($mem['Bank Locator']) && (($bank = $mem['Bank Locator']) != 'None') && ($bank != 'N/A') && ($bank != 'Not Specified')) {
184
                    if (isset($mem['Bank Locator']) && (($bank = $mem['Bank Locator']) != 'None') && ($bank != 'N/A') && ($bank != 'Not Specified')) {
201
                        if ($name != '') {
185
                        if ($name != '') {
202
                            $name .= ' in '.$bank;
186
                            $name .= ' in '.$bank;
203
                        } else {
187
                        } else {
204
                            $name = 'Physical Memory in '.$bank;
188
                            $name = 'Physical Memory in '.$bank;
205
                        }
189
                        }
206
                    }
190
                    }
207
                    if ($name != '') {
191
                    if ($name != '') {
208
                        $dev->setName(trim($name));
192
                        $dev->setName(trim($name));
209
                    } else {
193
                    } else {
210
                        $dev->setName('Physical Memory');
194
                        $dev->setName('Physical Memory');
211
                    }
195
                    }
212
                    if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
196
                    if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
213
                        if (isset($mem['Manufacturer']) && !preg_match("/^([A-F\d]{4}|[A-F\d]{12}|[A-F\d]{16})$/", $manufacturer = $mem['Manufacturer']) && !preg_match("/^Manufacturer\d+$/", $manufacturer) && !preg_match("/^Mfg \d+$/", $manufacturer) && !preg_match("/^JEDEC ID:/", $manufacturer) && ($manufacturer != 'None') && ($manufacturer != 'N/A') && ($manufacturer != 'Not Specified') && ($manufacturer != 'UNKNOWN')) {
197
                        if (isset($mem['Manufacturer']) && !preg_match("/^([A-F\d]{4}|[A-F\d]{12}|[A-F\d]{16})$/", $manufacturer = $mem['Manufacturer']) && !preg_match("/^Manufacturer\d+$/", $manufacturer) && !preg_match("/^Mfg \d+$/", $manufacturer) && !preg_match("/^JEDEC ID:/", $manufacturer) && ($manufacturer != 'None') && ($manufacturer != 'N/A') && ($manufacturer != 'Not Specified') && ($manufacturer != 'UNKNOWN')) {
214
                            $dev->setManufacturer($manufacturer);
198
                            $dev->setManufacturer($manufacturer);
215
                        }
199
                        }
216
                        if ($size[2] == 'G') {
200
                        if ($size[2] == 'G') {
217
                            $dev->setCapacity($size[1]*1024*1024*1024);
201
                            $dev->setCapacity($size[1]*1024*1024*1024);
218
                        } else {
202
                        } else {
219
                            $dev->setCapacity($size[1]*1024*1024);
203
                            $dev->setCapacity($size[1]*1024*1024);
220
                        }
204
                        }
221
                        $memtype = '';
205
                        $memtype = '';
222
                        if (isset($mem['Type']) && (($type = $mem['Type']) != 'None') && ($type != 'N/A') && ($type != 'Not Specified') && ($type != 'Other') && ($type != 'Unknown') && ($type != '<OUT OF SPEC>')) {
206
                        if (isset($mem['Type']) && (($type = $mem['Type']) != 'None') && ($type != 'N/A') && ($type != 'Not Specified') && ($type != 'Other') && ($type != 'Unknown') && ($type != '<OUT OF SPEC>')) {
223
                            if (isset($mem['Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)/', $mem['Speed'], $speed) && ($speed[1] > 0) && (preg_match('/^(DDR\d*)(.*)/', $type, $dr) || preg_match('/^(SDR)AM(.*)/', $type, $dr))) {
207
                            if (isset($mem['Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)/', $mem['Speed'], $speed) && ($speed[1] > 0) && (preg_match('/^(DDR\d*)(.*)/', $type, $dr) || preg_match('/^(SDR)AM(.*)/', $type, $dr))) {
224
                               if (isset($mem['Minimum Voltage']) && isset($mem['Total Width']) &&
208
                               if (isset($mem['Minimum Voltage']) && isset($mem['Maximum Voltage']) &&
225
                                  preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) &&
209
                                  preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) &&
226
                                  ($minv[1]  > 0) && ($maxv[1] >0) && ($minv[1] < $maxv[1])) {
210
                                  ($minv[1]  > 0) && ($maxv[1] >0) && ($minv[1] < $maxv[1])) {
227
                                    $lv = 'L';
211
                                    $lv = 'L';
228
                                } else {
212
                                } else {
229
                                    $lv = '';
213
                                    $lv = '';
230
                                }
214
                                }
231
                                if (isset($dr[2])) {
215
                                if (isset($dr[2])) {
232
                                    $memtype = $dr[1].$lv.'-'.$speed[1].' '.$dr[2];
216
                                    $memtype = $dr[1].$lv.'-'.$speed[1].' '.$dr[2];
233
                                } else {
217
                                } else {
234
                                    $memtype = $dr[1].$lv.'-'.$speed[1];
218
                                    $memtype = $dr[1].$lv.'-'.$speed[1];
235
                                }
219
                                }
236
                            } else {
220
                            } else {
237
                                $memtype = $type;
221
                                $memtype = $type;
238
                            }
222
                            }
239
                        }
223
                        }
240
                        if (isset($mem['Form Factor']) && (($form = $mem['Form Factor']) != 'None') && ($form != 'N/A') && ($form != 'Not Specified') && ($form != 'Other') && ($form != 'Unknown') && !preg_match('/ '.$form.'$/', $memtype)) {
224
                        if (isset($mem['Form Factor']) && (($form = $mem['Form Factor']) != 'None') && ($form != 'N/A') && ($form != 'Not Specified') && ($form != 'Other') && ($form != 'Unknown') && !preg_match('/ '.$form.'$/', $memtype)) {
241
                            $memtype .= ' '.$form;
225
                            $memtype .= ' '.$form;
242
                        }
226
                        }
243
                        if (isset($mem['Data Width']) && isset($mem['Total Width']) &&
227
                        if (isset($mem['Data Width']) && isset($mem['Total Width']) &&
244
                           preg_match('/^(\d+)\sbits$/', $mem['Data Width'], $dataw) && preg_match('/^(\d+)\sbits$/', $mem['Total Width'], $totalw) &&
228
                           preg_match('/^(\d+)\sbits$/', $mem['Data Width'], $dataw) && preg_match('/^(\d+)\sbits$/', $mem['Total Width'], $totalw) &&
245
                           ($dataw[1]  > 0) && ($totalw[1] >0) && ($dataw[1] < $totalw[1])) {
229
                           ($dataw[1]  > 0) && ($totalw[1] >0) && ($dataw[1] < $totalw[1])) {
246
                            $memtype .= ' ECC';
230
                            $memtype .= ' ECC';
247
                        }
231
                        }
248
                        if (isset($mem['Type Detail']) && preg_match('/Registered/', $mem['Type Detail'])) {
232
                        if (isset($mem['Type Detail']) && preg_match('/Registered/', $mem['Type Detail'])) {
249
                            $memtype .= ' REG';
233
                            $memtype .= ' REG';
250
                        }
234
                        }
251
                        if (($memtype = trim($memtype)) != '') {
235
                        if (($memtype = trim($memtype)) != '') {
252
                            $dev->setProduct($memtype);
236
                            $dev->setProduct($memtype);
253
                        }
237
                        }
254
                        if (isset($mem['Configured Clock Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)$/', $mem['Configured Clock Speed'], $clock) && ($clock[1] > 0)) {
238
                        if (isset($mem['Configured Clock Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)$/', $mem['Configured Clock Speed'], $clock) && ($clock[1] > 0)) {
255
                            $dev->setSpeed($clock[1]);
239
                            $dev->setSpeed($clock[1]);
256
                        }
240
                        }
257
                        if (isset($mem['Configured Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Configured Voltage'], $voltage) && ($voltage[1] > 0)) {
241
                        if (isset($mem['Configured Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Configured Voltage'], $voltage) && ($voltage[1] > 0)) {
258
                            $dev->setVoltage($voltage[1]);
242
                            $dev->setVoltage($voltage[1]);
259
                        }
243
                        }
260
                        if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL &&
244
                        if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL &&
261
                           isset($mem['Serial Number']) && !preg_match("/^SerNum\d+$/", $serial = $mem['Serial Number']) && ($serial != 'None') && ($serial != 'Not Specified')) {
245
                           isset($mem['Serial Number']) && !preg_match("/^SerNum\d+$/", $serial = $mem['Serial Number']) && ($serial != 'None') && ($serial != 'Not Specified')) {
262
                            $dev->setSerial($serial);
246
                            $dev->setSerial($serial);
263
                        }
247
                        }
264
                    }
248
                    }
265
                    $this->sys->setMemDevices($dev);
249
                    $this->sys->setMemDevices($dev);
266
                }
250
                }
267
            }
251
            }
268
        }
252
        }
269
    }
253
    }
270
 
254
 
271
    /**
255
    /**
272
     * get the filled or unfilled (with default values) System object
256
     * get the filled or unfilled (with default values) System object
273
     *
257
     *
274
     * @see PSI_Interface_OS::getSys()
258
     * @see PSI_Interface_OS::getSys()
275
     *
259
     *
276
     * @return System
260
     * @return System
277
     */
261
     */
278
    final public function getSys()
262
    final public function getSys()
279
    {
263
    {
280
        $this->build();
264
        $this->build();
281
        if (!$this->blockname || $this->blockname==='vitals') {
265
        if (!$this->blockname || $this->blockname==='vitals') {
282
            $this->_ip();
266
            $this->_ip();
283
        }
267
        }
284
        if ((!$this->blockname || $this->blockname==='hardware') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) {
268
        if ((!$this->blockname || $this->blockname==='hardware') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) {
285
            $this->_dmimeminfo();
269
            $this->_dmimeminfo();
286
        }
270
        }
287
 
271
 
288
        return $this->sys;
272
        return $this->sys;
289
    }
273
    }
290
}
274
}
291
 
275