Subversion Repositories ALCASAR

Rev

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

Rev 2770 Rev 3037
Line 86... Line 86...
86
    {
86
    {
87
 
87
 
88
        if (CommonFunctions::executeProgram('pidin', 'info', $buf)
88
        if (CommonFunctions::executeProgram('pidin', 'info', $buf)
89
           && preg_match('/^.* BootTime:(.*)/', $buf, $bstart)
89
           && preg_match('/^.* BootTime:(.*)/', $buf, $bstart)
90
           && CommonFunctions::executeProgram('date', '', $bstop)) {
90
           && CommonFunctions::executeProgram('date', '', $bstop)) {
91
            /* default error handler */
91
            date_default_timezone_set('UTC');
92
            if (function_exists('errorHandlerPsi')) {
-
 
93
                restore_error_handler();
-
 
94
            }
-
 
95
            /* fatal errors only */
-
 
96
            $old_err_rep = error_reporting();
-
 
97
            error_reporting(E_ERROR);
-
 
98
 
-
 
99
            $uptime = strtotime($bstop)-strtotime($bstart[1]);
92
            $uptime = strtotime($bstop)-strtotime($bstart[1]);
100
            if ($uptime > 0) $this->sys->setUptime($uptime);
93
            if ($uptime > 0) $this->sys->setUptime($uptime);
101
 
-
 
102
            /* restore error level */
-
 
103
            error_reporting($old_err_rep);
-
 
104
            /* restore error handler */
-
 
105
            if (function_exists('errorHandlerPsi')) {
-
 
106
                set_error_handler('errorHandlerPsi');
-
 
107
            }
-
 
108
        }
94
        }
109
    }
95
    }
110
 
96
 
111
    /**
97
    /**
112
     * Number of Users
98
     * Number of Users
Line 123... Line 109...
123
     *
109
     *
124
     * @return void
110
     * @return void
125
     */
111
     */
126
    private function _hostname()
112
    private function _hostname()
127
    {
113
    {
128
        if (PSI_USE_VHOST === true) {
114
        if (PSI_USE_VHOST) {
129
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
115
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
130
        } else {
116
        } else {
131
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
117
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
132
                $ip = gethostbyname($result);
118
                $ip = gethostbyname($result);
133
                if ($ip != $result) {
119
                if ($ip != $result) {
Line 203... Line 189...
203
    }
189
    }
204
 
190
 
205
    /**
191
    /**
206
     * get the information
192
     * get the information
207
     *
193
     *
208
     * @return Void
194
     * @return void
209
     */
195
     */
210
    public function build()
196
    public function build()
211
    {
197
    {
212
        $this->error->addError("WARN", "The QNX version of phpSysInfo is a work in progress, some things currently don't work");
198
        $this->error->addWarning("The QNX version of phpSysInfo is a work in progress, some things currently don't work");
213
        if (!$this->blockname || $this->blockname==='vitals') {
199
        if (!$this->blockname || $this->blockname==='vitals') {
214
            $this->_distro();
200
            $this->_distro();
215
            $this->_hostname();
201
            $this->_hostname();
216
            $this->_kernel();
202
            $this->_kernel();
217
            $this->_uptime();
203
            $this->_uptime();
218
            $this->_users();
204
            $this->_users();
219
        }
205
        }
220
        if (!$this->blockname || $this->blockname==='hardware') {
206
        if (!$this->blockname || $this->blockname==='hardware') {
221
            $this->_cpuinfo();
207
            $this->_cpuinfo();
222
        }
208
        }
223
        if (!$this->blockname || $this->blockname==='network') {
-
 
224
            $this->_network();
-
 
225
        }
-
 
226
        if (!$this->blockname || $this->blockname==='memory') {
209
        if (!$this->blockname || $this->blockname==='memory') {
227
            $this->_memory();
210
            $this->_memory();
228
        }
211
        }
229
        if (!$this->blockname || $this->blockname==='filesystem') {
212
        if (!$this->blockname || $this->blockname==='filesystem') {
230
            $this->_filesystems();
213
            $this->_filesystems();
231
        }
214
        }
-
 
215
        if (!$this->blockname || $this->blockname==='network') {
-
 
216
            $this->_network();
-
 
217
        }
232
    }
218
    }
233
}
219
}