root/modules/branches/2.3/dashboard/class.procinfo.php

Revision 4741, 0.7 kB (checked in by gregmac, 5 years ago)

Syntax error (oops)

Line 
1 <?php
2
3 class procinfo {
4   var $distro;
5  
6   function procinfo($distro = false) {
7     $this->distro = $distro;
8   }
9  
10   function check_port($port, $server = "localhost") {
11     $timeout = 5;
12     if ($sock = @fsockopen($server, $port, $errno, $errstr, $timeout)) {
13       fclose($sock);
14       return true;
15     }
16     return false;
17   }
18  
19   function check_fop_server() {
20     return $this->check_port(4445);
21   }
22  
23   function check_mysql($hoststr) {
24     $host = 'localhost';
25     $port = '3306';
26     if (preg_match('/^([^:]+)(:(\d+))?$/',$hoststr,$matches)) {
27       // matches[1] = host, [3] = port
28       $host = $matches[1];
29       if (!empty($matches[3])) {
30         $port = $matches[3];
31       }
32     }
33     return $this->check_port($port, $host);
34   }
35 }
36
37 ?>
Note: See TracBrowser for help on using the browser.