Witam,
w zalaczniku przesylam maly patch umozliwiajacy uzywanie phpSysInfo na 
aktualnym AC. Jesli jest ok to prosze o wrzucenie do cvs.


jakby ktos niewierzyl ze dziala to niech zajrzy tam
http://info.x-tech.one.pl/

-- 
Grzegorz Åebrowski
xavier [] x-tech.one.pl
diff -u -r phpSysInfo/includes/XPath.class.php phpSysInfo_AC/includes/XPath.class.php
--- phpSysInfo/includes/XPath.class.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/XPath.class.php	2004-09-14 00:59:59.000000000 +0200
@@ -3762,7 +3762,8 @@
     $this->properties['modMatch'] = XPATH_QUERYHIT_ALL;
     if ($fileName) {
       if (!$this->importFromFile($fileName)) {
-        $this = FALSE;
+       // $this = FALSE;
+       echo "dupa\n";
       }
     }
   }
@@ -4746,4 +4747,4 @@
   echo $xPath->exportAsHtml();
 }
 
-?>
\ No newline at end of file
+?>
diff -u -r phpSysInfo/includes/class.Template.inc.php phpSysInfo_AC/includes/class.Template.inc.php
--- phpSysInfo/includes/class.Template.inc.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/class.Template.inc.php	2004-09-14 00:52:30.000000000 +0200
@@ -37,7 +37,7 @@
   var $unknowns = "remove";
   
   /* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly */
-  var $halt_on_error  = "yes";
+  var $halt_on_error  = "no";
   
   /* last error message is retained here */
   var $last_error     = "";
diff -u -r phpSysInfo/includes/common_functions.php phpSysInfo_AC/includes/common_functions.php
--- phpSysInfo/includes/common_functions.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/common_functions.php	2004-09-14 00:48:14.000000000 +0200
@@ -26,7 +26,7 @@
 }
 
 // So that stupid warnings do not appear when we stats files that do not exist.
-error_reporting(5);
+#error_reporting(5);
 
 // print out the bar graph
 function create_bargraph ($percent, $a, $b, $type = "") {
diff -u -r phpSysInfo/includes/os/class.Linux.inc.php phpSysInfo_AC/includes/os/class.Linux.inc.php
--- phpSysInfo/includes/os/class.Linux.inc.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/os/class.Linux.inc.php	2004-09-14 01:54:55.000000000 +0200
@@ -19,7 +19,22 @@
 //
 // $Id: class.Linux.inc.php,v 1.8 2002/06/05 21:12:43 precision Exp $
 //
-
+        function array_values_recursive($ary)
+	{
+		$lst = array();
+		foreach( array_keys($ary) as $k ){
+			$v = $ary[$k];
+			if (is_scalar($v)) {
+				$lst[] = $v;
+				} elseif (is_array($v)) {
+					$lst = array_merge( $lst,
+					array_values_recursive($v)
+				);
+			}
+		}
+		return $lst;
+	}
+																																														
 class sysinfo {
     // get our apache SERVER_NAME or vhost
     function vhostname () {
@@ -102,13 +117,19 @@
     }
 
     function loadavg () {
+	    $results = array();
         if ($fd = fopen('/proc/loadavg', 'r')) {
-            $results = split(' ', fgets($fd, 4096));
+            $results2 = split(' ', fgets($fd, 4096));
             fclose($fd);
+	    $results = array($results2[0]."",$results2[1]."",$results2[2]."");
         } else {
             $results = array('N.A.','N.A.','N.A.');
         }
-        return $results;
+
+//	array_splice($results, 3);
+
+	
+        return $results2;
     }
 
     function cpu_info () {
@@ -317,9 +338,9 @@
         }
         return $results;
     }
-
+		
     function memory () {
-        if ($fd = fopen('/proc/meminfo', 'r')) {
+        if ($fd = popen('/usr/bin/free -bo', 'r')) {
             while ($buf = fgets($fd, 4096)) {
                 if (preg_match('/Mem:\s+(.*)$/', $buf, $ar_buf)) {
                     $ar_buf = preg_split('/\s+/', $ar_buf[1], 6);
@@ -332,7 +353,7 @@
                     $results['ram']['shared']  = $ar_buf[3] / 1024;
                     $results['ram']['buffers'] = $ar_buf[4] / 1024;
                     $results['ram']['cached']  = $ar_buf[5] / 1024;
-
+	
                     // I don't like this since buffers and cache really aren't 
                     // 'used' per say, but I get too many emails about it.
                     $results['ram']['t_used']  = $results['ram']['used'];
@@ -373,6 +394,8 @@
             $results['swap'] = array();
             $results['devswap'] = array();
         }
+
+
         return $results;
     }
 
diff -u -r phpSysInfo/includes/xml/memory.php phpSysInfo_AC/includes/xml/memory.php
--- phpSysInfo/includes/xml/memory.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/xml/memory.php	2004-09-14 01:38:46.000000000 +0200
@@ -26,6 +26,7 @@
     global $sysinfo;
     $mem = $sysinfo->memory();
 
+    
     $_text = "  <Memory>\n"
            . "    <Free>" . $mem['ram']['t_free'] . "</Free>\n"
            . "    <Used>" . $mem['ram']['t_used'] . "</Used>\n"
diff -u -r phpSysInfo/includes/xml/vitals.php phpSysInfo_AC/includes/xml/vitals.php
--- phpSysInfo/includes/xml/vitals.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/includes/xml/vitals.php	2004-09-14 01:29:12.000000000 +0200
@@ -26,12 +26,10 @@
     global $sysinfo;
     $ar_buf = $sysinfo->loadavg(); 
 
+    $load_avg="";
     for ($i=0;$i<3;$i++) {
-        if ($ar_buf[$i] > 2) {
-            $load_avg .= ' ';
-        } else {
             $load_avg .= $ar_buf[$i] . ' ';
-        }
+        
     }
 
     $_text = "  <Vitals>\n"
diff -u -r phpSysInfo/index.php phpSysInfo_AC/index.php
--- phpSysInfo/index.php	2004-01-09 21:20:18.000000000 +0100
+++ phpSysInfo_AC/index.php	2004-09-14 01:55:23.000000000 +0200
@@ -22,6 +22,7 @@
 
 // our version number
 $VERSION="2.1";
+error_reporting(5);
 
 // reassign HTTP variables (incase register_globals is off)
 if (!empty($HTTP_GET_VARS)) while(list($name, $value) = each($HTTP_GET_VARS)) $$name = $value;
@@ -106,7 +107,9 @@
 $xml .= xml_vitals();
 $xml .= xml_network();
 $xml .= xml_hardware();
+
 $xml .= xml_memory();
+
 $xml .= xml_filesystems();
 $xml .= "</phpsysinfo>";
 
@@ -182,6 +185,7 @@
     } else {
         require('./includes/system_footer.php');
     }
+
 }
 
 ?>
_______________________________________________
pld-devel-pl mailing list
[EMAIL PROTECTED]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-pl

Odpowiedź listem elektroniczym