Subversion Repositories ALCASAR

Rev

Rev 2770 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 3037
Line 25... Line 25...
25
 * @link      http://phpsysinfo.sourceforge.net
25
 * @link      http://phpsysinfo.sourceforge.net
26
 */
26
 */
27
class Minix extends OS
27
class Minix extends OS
28
{
28
{
29
    /**
29
    /**
-
 
30
     * uptime command result.
-
 
31
     */
-
 
32
    private $_uptime = null;
-
 
33
 
-
 
34
    /**
30
     * content of the syslog
35
     * content of the syslog
31
     *
36
     *
32
     * @var array
37
     * @var array
33
     */
38
     */
34
    private $_dmesg = null;
39
    private $_dmesg = null;
Line 92... Line 97...
92
                                $dev->setVirt("svm");
97
                                $dev->setVirt("svm");
93
                            }
98
                            }
94
                            break;
99
                            break;
95
                        case 'vendor_id':
100
                        case 'vendor_id':
96
                            $dev->setVendorId($arrBuff[1]);
101
                            $dev->setVendorId($arrBuff[1]);
97
                            break;
-
 
98
                        }
102
                        }
99
                    }
103
                    }
100
                }
104
                }
101
                if ($_n == "") $_n="CPU";
105
                if ($_n == "") $_n="CPU";
102
                if ($_f != "") $_n.=" Family ".$_f;
106
                if ($_f != "") $_n.=" Family ".$_f;
Line 192... Line 196...
192
     *
196
     *
193
     * @return void
197
     * @return void
194
     */
198
     */
195
    private function _uptime()
199
    private function _uptime()
196
    {
200
    {
197
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
201
        if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
198
            if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
202
            if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $this->_uptime, $ar_buf)) {
199
                $min = $ar_buf[3];
203
                $min = $ar_buf[3];
200
                $hours = $ar_buf[2];
204
                $hours = $ar_buf[2];
201
                $days = $ar_buf[1];
205
                $days = $ar_buf[1];
202
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
206
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
203
            } elseif (preg_match("/up (\d+):(\d+),/", $buf, $ar_buf)) {
207
            } elseif (preg_match("/up (\d+):(\d+),/", $this->_uptime, $ar_buf)) {
204
                $min = $ar_buf[2];
208
                $min = $ar_buf[2];
205
                $hours = $ar_buf[1];
209
                $hours = $ar_buf[1];
206
                $this->sys->setUptime($hours * 3600 + $min * 60);
210
                $this->sys->setUptime($hours * 3600 + $min * 60);
207
            }
211
            }
208
        }
212
        }
Line 214... Line 218...
214
     *
218
     *
215
     * @return void
219
     * @return void
216
     */
220
     */
217
    private function _loadavg()
221
    private function _loadavg()
218
    {
222
    {
219
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
223
        if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
220
            if (preg_match("/load averages: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
224
            if (preg_match("/load averages: (.*), (.*), (.*)$/", $this->_uptime, $ar_buf)) {
221
                $this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
225
                $this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
222
            }
226
            }
223
        }
227
        }
224
    }
228
    }
225
 
229
 
Line 228... Line 232...
228
     *
232
     *
229
     * @return void
233
     * @return void
230
     */
234
     */
231
    private function _hostname()
235
    private function _hostname()
232
    {
236
    {
233
        if (PSI_USE_VHOST === true) {
237
        if (PSI_USE_VHOST) {
234
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
238
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
235
        } else {
239
        } else {
236
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
240
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
237
                $ip = gethostbyname($result);
241
                $ip = gethostbyname($result);
238
                if ($ip != $result) {
242
                if ($ip != $result) {
Line 326... Line 330...
326
    }
330
    }
327
 
331
 
328
    /**
332
    /**
329
     * get the information
333
     * get the information
330
     *
334
     *
331
     * @return Void
335
     * @return void
332
     */
336
     */
333
    public function build()
337
    public function build()
334
    {
338
    {
335
        $this->error->addError("WARN", "The Minix version of phpSysInfo is a work in progress, some things currently don't work");
339
        $this->error->addWarning("The Minix version of phpSysInfo is a work in progress, some things currently don't work");
336
        if (!$this->blockname || $this->blockname==='vitals') {
340
        if (!$this->blockname || $this->blockname==='vitals') {
337
            $this->_distro();
341
            $this->_distro();
338
            $this->_hostname();
342
            $this->_hostname();
339
            $this->_kernel();
343
            $this->_kernel();
340
            $this->_uptime();
344
            $this->_uptime();
Line 344... Line 348...
344
        }
348
        }
345
        if (!$this->blockname || $this->blockname==='hardware') {
349
        if (!$this->blockname || $this->blockname==='hardware') {
346
            $this->_pci();
350
            $this->_pci();
347
            $this->_cpuinfo();
351
            $this->_cpuinfo();
348
        }
352
        }
349
        if (!$this->blockname || $this->blockname==='network') {
-
 
350
            $this->_network();
-
 
351
        }
-
 
352
        if (!$this->blockname || $this->blockname==='memory') {
353
        if (!$this->blockname || $this->blockname==='memory') {
353
            $this->_memory();
354
            $this->_memory();
354
        }
355
        }
355
        if (!$this->blockname || $this->blockname==='filesystem') {
356
        if (!$this->blockname || $this->blockname==='filesystem') {
356
            $this->_filesystems();
357
            $this->_filesystems();
357
        }
358
        }
-
 
359
        if (!$this->blockname || $this->blockname==='network') {
-
 
360
            $this->_network();
-
 
361
        }
358
    }
362
    }
359
}
363
}