ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/latest/latest.php
(Generate patch)

Comparing projects/cms/source/reports/php/latest/latest.php (file contents):
Revision 1.47 by tdb, Fri Mar 11 12:23:33 2005 UTC vs.
Revision 1.51 by tdb, Wed Jun 29 14:32:16 2005 UTC

# Line 110 | Line 110 | function b2Mb($bytes) {
110   function uptime($until) {
111      $day = date('z', $until);
112      $hour = date('G', $until);
113 <    $hour = $hour - 1; # one too many
113 >    if ($hour == 0) { # everything's an hour ahead, so roll back
114 >        $hour = 23;
115 >        $day = $day - 1;
116 >    } else {
117 >        $hour = $hour - 1;
118 >    }
119      $minute = date('i', $until);
120      $return = "";
121      if ($day) {
122 <        $return = "$return$day Days ";
122 >        $return = "$return$day";
123 >        if ($day == 1) {
124 >            $return = "$return Day ";
125 >        } else {
126 >            $return = "$return Days ";
127 >        }
128      }
129      if ($hour) {
130 <        $return = "$return$hour Hours ";
130 >        $return = "$return$hour";
131 >        if ($hour == 1) {
132 >            $return = "$return Hour ";
133 >        } else {
134 >            $return = "$return Hours ";
135 >        }
136      }
137 <    return "$return$minute Mins";
137 >    $return = "$return$minute";
138 >    if ($minute == 1) {
139 >        $return = "$return Min";
140 >    } else {
141 >        $return = "$return Mins";
142 >    }
143 >    return $return;
144   }
145  
146  
# Line 136 | Line 157 | function showDisks($diskRoot, $units, $input) {
157              $total = "$diskRoot.p$i.attributes.total";
158              $graph = preg_replace("/_/", "$hex_underscore", $mount);
159              $graph = preg_replace("/\//", "$hex_slash", $graph);
160 +            $graph = preg_replace("/\\\\/", "$hex_bslash", $graph);
161 +            $graph = preg_replace("/ /", "$hex_space", $graph);
162 +            $graph = preg_replace("/:/", "$hex_colon", $graph);
163              $totalinodes = getPregMatch("$diskRoot.p$i.attributes.totalinodes", $input);
164              $freeinodes = getPregMatch("$diskRoot.p$i.attributes.freeinodes", $input);
165              showBar("$name ($mount)<br>space used", $used, $total, $units, $input, "disk-$graph");
# Line 159 | Line 183 | function showDiskIO($diskRoot, $input) {
183      while(1) {
184          $name = getPregMatch("$diskRoot.p$i.attributes.name", $input);
185          if ($name) {
186 +            $graph = preg_replace("/_/", "$hex_underscore", $name);
187 +            $graph = preg_replace("/\//", "$hex_slash", $graph);
188 +            $graph = preg_replace("/\\\\/", "$hex_bslash", $graph);
189 +            $graph = preg_replace("/ /", "$hex_space", $graph);
190 +            $graph = preg_replace("/:/", "$hex_colon", $graph);
191              print "<br><center><b>(Disk $name)</b></center>";
192 <            showStat("Read bytes (per sec)", "$diskRoot.p$i.attributes.rbytes", $input, "diskio-$name");
193 <            showStat("Write bytes (per sec)", "$diskRoot.p$i.attributes.wbytes", $input, "diskio-$name");
192 >            showStat("Read bytes (per sec)", "$diskRoot.p$i.attributes.rbytes", $input, "diskio-$graph");
193 >            showStat("Write bytes (per sec)", "$diskRoot.p$i.attributes.wbytes", $input, "diskio-$graph");
194              print "          <br>\n";
195          }
196          else {
# Line 180 | Line 209 | function showNet($netRoot, $input) {
209      while(1) {
210          $name = getPregMatch("$netRoot.p$i.attributes.name", $input);
211          if ($name) {
212 +            $graph = preg_replace("/_/", "$hex_underscore", $name);
213 +            $graph = preg_replace("/\//", "$hex_slash", $graph);
214 +            $graph = preg_replace("/\\\\/", "$hex_bslash", $graph);
215 +            $graph = preg_replace("/ /", "$hex_space", $graph);
216 +            $graph = preg_replace("/:/", "$hex_colon", $graph);
217 +            $graph = preg_replace("/\(/", "$hex_lbracket", $graph);
218 +            $graph = preg_replace("/\)/", "$hex_rbracket", $graph);
219 +            $graph = preg_replace("/\+/", "$hex_plus", $graph);
220 +            $graph = preg_replace("/#/", "$hex_hash", $graph);
221              print "<br><center><b>(Network Interface $name)</b></center>";
222 <            showStat("Received bytes (per sec)", "$netRoot.p$i.attributes.rx", $input, "net-$name");
223 <            showStat("Transfered bytes (per sec)", "$netRoot.p$i.attributes.tx", $input, "net-$name");
222 >            showStat("Received bytes (per sec)", "$netRoot.p$i.attributes.rx", $input, "net-$graph");
223 >            showStat("Transfered bytes (per sec)", "$netRoot.p$i.attributes.tx", $input, "net-$graph");
224              print "          <br>\n";
225          }
226          else {
# Line 217 | Line 255 | function showMailQ($mailqRoot, $input) {
255   # Return a preg_match result.
256   function getPregMatch($value, $input) {
257      preg_match("/$value=([^\,\}]*)[\,\}]/", $input, $matches);
258 +    if(!isset($matches[1])) {
259 +        return;
260 +    }
261      return $matches[1];
262   }
263  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines