Subversion Repositories ALCASAR

Rev

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

Rev 2976 Rev 3037
Line 42... Line 42...
42
    protected function prtconf()
42
    protected function prtconf()
43
    {
43
    {
44
        if ($this->_prtconf === null) {
44
        if ($this->_prtconf === null) {
45
            $this->_prtconf = array();
45
            $this->_prtconf = array();
46
            if (CommonFunctions::executeProgram('prtconf', '-v', $buf, PSI_DEBUG) && ($buf!="")) {
46
            if (CommonFunctions::executeProgram('prtconf', '-v', $buf, PSI_DEBUG) && ($buf!="")) {
47
                $blocks = preg_split( '/\n(?=    \S)/', $buf, -1, PREG_SPLIT_NO_EMPTY);
47
                $blocks = preg_split('/\n(?=    \S)/', $buf, -1, PREG_SPLIT_NO_EMPTY);
48
                if (!empty($blocks) && (count($blocks)>2)) {
48
                if (!empty($blocks) && (count($blocks)>2)) {
49
                    array_shift($blocks);
49
                    array_shift($blocks);
50
                    foreach ($blocks as $block) {
50
                    foreach ($blocks as $block) {
51
                        if (preg_match('/^    (\S+) /',$block, $ar_buf)) {
51
                        if (preg_match('/^    (\S+) /', $block, $ar_buf)) {
52
                            $group = trim($ar_buf[1], ',');
52
                            $group = trim($ar_buf[1], ',');
53
                            $grouparr = array();
53
                            $grouparr = array();
54
                            $blocks1 = preg_split( '/\n(?=        \S)/', $block, -1, PREG_SPLIT_NO_EMPTY);
54
                            $blocks1 = preg_split('/\n(?=        \S)/', $block, -1, PREG_SPLIT_NO_EMPTY);
55
                            if (!empty($blocks1) && count($blocks1)) {
55
                            if (!empty($blocks1) && count($blocks1)) {
56
                                array_shift($blocks1);
56
                                array_shift($blocks1);
57
                                foreach ($blocks1 as $block1) {
57
                                foreach ($blocks1 as $block1) {
58
                                    if (!preg_match('/^        name=\'([^\']+)\'/',$block1)
58
                                    if (!preg_match('/^        name=\'([^\']+)\'/', $block1)
59
                                       && preg_match('/^        (\S+) /',$block1, $ar_buf)) {
59
                                       && preg_match('/^        (\S+) /', $block1, $ar_buf)) {
60
                                        $device = trim($ar_buf[1], ',');
60
                                        $device = trim($ar_buf[1], ',');
61
                                        $devicearr = array();
61
                                        $devicearr = array();
62
                                        $blocks2 = preg_split( '/\n(?=            \S)/', $block1, -1, PREG_SPLIT_NO_EMPTY);
62
                                        $blocks2 = preg_split('/\n(?=            \S)/', $block1, -1, PREG_SPLIT_NO_EMPTY);
63
                                        if (!empty($blocks2) && count($blocks2)) {
63
                                        if (!empty($blocks2) && count($blocks2)) {
64
                                            array_shift($blocks2);
64
                                            array_shift($blocks2);
65
                                            foreach ($blocks2 as $block2) {
65
                                            foreach ($blocks2 as $block2) {
66
                                                if (!preg_match('/^            name=\'([^\']+)\'/',$block2)
66
                                                if (!preg_match('/^            name=\'([^\']+)\'/', $block2)
67
                                                   && preg_match('/^            (\S+) /',$block2, $ar_buf)) {
67
                                                   && preg_match('/^            (\S+) /', $block2, $ar_buf)) {
68
                                                    $subdev = trim($ar_buf[1], ',');
68
                                                    $subdev = trim($ar_buf[1], ',');
69
                                                    $subdevarr = array();
69
                                                    $subdevarr = array();
70
                                                    $blocks3 = preg_split( '/\n(?=                \S)/', $block2, -1, PREG_SPLIT_NO_EMPTY);
70
                                                    $blocks3 = preg_split('/\n(?=                \S)/', $block2, -1, PREG_SPLIT_NO_EMPTY);
71
                                                    if (!empty($blocks3) && count($blocks3)) {
71
                                                    if (!empty($blocks3) && count($blocks3)) {
72
                                                        array_shift($blocks3);
72
                                                        array_shift($blocks3);
73
                                                        foreach ($blocks3 as $block3) {
73
                                                        foreach ($blocks3 as $block3) {
74
                                                            if (preg_match('/^                name=\'([^\']+)\' [\s\S]+ value=\'?([^\']+)\'?/m',$block3, $ar_buf)) {
74
                                                            if (preg_match('/^                name=\'([^\']+)\' [\s\S]+ value=\'?([^\']+)\'?/m', $block3, $ar_buf)) {
75
                                                                if ($subdev==='Hardware') {
75
                                                                if ($subdev==='Hardware') {
76
                                                                    $subdevarr[$ar_buf[1]] = $ar_buf[2];
76
                                                                    $subdevarr[$ar_buf[1]] = $ar_buf[2];
77
                                                                    $subdevarr['device'] = $device;
77
                                                                    $subdevarr['device'] = $device;
78
                                                                }
78
                                                                }
79
                                                            }
79
                                                            }
Line 126... Line 126...
126
     *
126
     *
127
     * @return void
127
     * @return void
128
     */
128
     */
129
    private function _hostname()
129
    private function _hostname()
130
    {
130
    {
131
        if (PSI_USE_VHOST === true) {
131
        if (PSI_USE_VHOST) {
132
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
132
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
133
        } else {
133
        } else {
134
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
134
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
135
                $ip = gethostbyname($result);
135
                $ip = gethostbyname($result);
136
                if ($ip != $result) {
136
                if ($ip != $result) {
Line 452... Line 452...
452
    /**
452
    /**
453
     * get the information
453
     * get the information
454
     *
454
     *
455
     * @see PSI_Interface_OS::build()
455
     * @see PSI_Interface_OS::build()
456
     *
456
     *
457
     * @return Void
457
     * @return void
458
     */
458
     */
459
    public function build()
459
    public function build()
460
    {
460
    {
461
        $this->error->addError("WARN", "The SunOS version of phpSysInfo is a work in progress, some things currently don't work");
461
        $this->error->addWarning("The SunOS version of phpSysInfo is a work in progress, some things currently don't work");
462
        if (!$this->blockname || $this->blockname==='vitals') {
462
        if (!$this->blockname || $this->blockname==='vitals') {
463
            $this->_distro();
463
            $this->_distro();
464
            $this->_hostname();
464
            $this->_hostname();
465
            $this->_kernel();
465
            $this->_kernel();
466
            $this->_uptime();
466
            $this->_uptime();
Line 470... Line 470...
470
        }
470
        }
471
        if (!$this->blockname || $this->blockname==='hardware') {
471
        if (!$this->blockname || $this->blockname==='hardware') {
472
            $this->_cpuinfo();
472
            $this->_cpuinfo();
473
            $this->_pci();
473
            $this->_pci();
474
        }
474
        }
475
        if (!$this->blockname || $this->blockname==='network') {
-
 
476
            $this->_network();
-
 
477
        }
-
 
478
        if (!$this->blockname || $this->blockname==='memory') {
475
        if (!$this->blockname || $this->blockname==='memory') {
479
            $this->_memory();
476
            $this->_memory();
480
        }
477
        }
481
        if (!$this->blockname || $this->blockname==='filesystem') {
478
        if (!$this->blockname || $this->blockname==='filesystem') {
482
            $this->_filesystems();
479
            $this->_filesystems();
483
        }
480
        }
-
 
481
        if (!$this->blockname || $this->blockname==='network') {
-
 
482
            $this->_network();
-
 
483
        }
484
    }
484
    }
485
}
485
}