Ticket #4401: dashboard-phpsysinfo.patch
| File dashboard-phpsysinfo.patch, 8.5 kB (added by ianf, 2 years ago) |
|---|
-
phpsysinfo/class.Darwin.inc.php
old new 85 85 $results = array(); 86 86 $s = $this->grab_ioreg('IOPCIDevice'); 87 87 88 $lines = split("\n", $s);88 $lines = preg_split("/\n/", $s); 89 89 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 90 90 $ar_buf = preg_split("/\s+/", $lines[$i], 19); 91 91 $results[$i] = $ar_buf[0]; … … 99 99 // ioreg | grep "Media <class IOMedia>" 100 100 $s = $this->grab_ioreg('IOATABlockStorageDevice'); 101 101 102 $lines = split("\n", $s);102 $lines = preg_split("/\n/", $s); 103 103 $j = 0; 104 104 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 105 105 $ar_buf = preg_split("/\/\//", $lines[$i], 19); … … 118 118 $results['ram'] = array(); 119 119 120 120 $pstat = execute_program('vm_stat'); // use darwin's vm_stat 121 $lines = split("\n", $pstat);121 $lines = preg_split("/\n/", $pstat); 122 122 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 123 123 $ar_buf = preg_split("/\s+/", $lines[$i], 19); 124 124 … … 138 138 $results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']); 139 139 // need to fix the swap info... 140 140 $pstat = execute_program('swapinfo', '-k'); 141 $lines = split("\n", $pstat);141 $lines = preg_split("/\n/", $pstat); 142 142 143 143 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 144 144 $ar_buf = preg_split("/\s+/", $lines[$i], 6); … … 160 160 161 161 function network () { 162 162 $netstat = execute_program('netstat', '-nbdi | cut -c1-24,42- | grep Link'); 163 $lines = split("\n", $netstat);163 $lines = preg_split("/\n/", $netstat); 164 164 $results = array(); 165 165 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 166 166 $ar_buf = preg_split("/\s+/", $lines[$i]); … … 186 186 187 187 function filesystems () { 188 188 $df = execute_program('df', '-k'); 189 $mounts = split("\n", $df);189 $mounts = preg_split("/\n/", $df); 190 190 $fstype = array(); 191 191 192 192 $s = execute_program('mount'); -
phpsysinfo/class.HP-UX.inc.php
old new 61 61 } 62 62 63 63 function users () { 64 $who = split('=', execute_program('who', '-q'));64 $who = preg_split('/=/', execute_program('who', '-q')); 65 65 $result = $who[1]; 66 66 return $result; 67 67 } … … 167 167 } 168 168 169 169 if ($device) { 170 list($key, $value) = split(':', $buf, 2);170 list($key, $value) = preg_split('/: /', $buf, 2); 171 171 172 172 if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) { 173 173 $results[] = preg_replace('/\([^\)]+\)\.$/', '', trim($value)); … … 241 241 foreach( $bufe as $buf ) { 242 242 if (preg_match('/Vendor/', $buf)) { 243 243 preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev); 244 list($key, $value) = split(':', $buf, 2);244 list($key, $value) = preg_split('/: /', $buf, 2); 245 245 $dev_str = $value; 246 246 $get_type = 1; 247 247 continue; … … 277 277 } 278 278 279 279 if ($devstring) { 280 list($key, $value) = split(':', $buf, 2);281 list($key, $value2) = split('=', $value, 2);280 list($key, $value) = preg_split('/: /', $buf, 2); 281 list($key, $value2) = preg_split('/=/', $value, 2); 282 282 $results[$devnum] .= " " . trim($value2); 283 283 $devstring = 0; 284 284 } … … 297 297 298 298 function network () { 299 299 $netstat = execute_program('netstat', '-ni | tail -n +2'); 300 $lines = split("\n", $netstat);300 $lines = preg_split("/\n/", $netstat); 301 301 $results = array(); 302 302 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 303 303 $ar_buf = preg_split("/\s+/", $lines[$i]); … … 355 355 // Get info on individual swap files 356 356 $swaps = rfts( '/proc/swaps' ); 357 357 if( $swaps != "ERROR" ) { 358 $swapdevs = split("\n", $swaps);358 $swapdevs = preg_split("/\n/", $swaps); 359 359 360 360 for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) { 361 361 $ar_buf = preg_split('/\s+/', $swapdevs[$i], 6); … … 376 376 377 377 function filesystems () { 378 378 $df = execute_program('df', '-kP'); 379 $mounts = split("\n", $df);379 $mounts = preg_split("/\n/", $df); 380 380 $fstype = array(); 381 381 382 382 $s = execute_program('mount', '-v'); … … 384 384 385 385 $i = 0; 386 386 while (list(, $line) = each($lines)) { 387 $a = split('', $line);387 $a = preg_split('/ /', $line); 388 388 $fsdev[$a[0]] = $a[4]; 389 389 } 390 390 -
phpsysinfo/class.NetBSD.inc.php
old new 52 52 function network () { 53 53 $netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"'); 54 54 $netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"'); 55 $lines_b = split("\n", $netstat_b);56 $lines_n = split("\n", $netstat_n);55 $lines_b = preg_split("/\n/", $netstat_b); 56 $lines_n = preg_split("/\n/", $netstat_n); 57 57 $results = array(); 58 58 for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) { 59 59 $ar_buf_b = preg_split("/\s+/", $lines_b[$i]); -
phpsysinfo/class.OpenBSD.inc.php
old new 54 54 function network () { 55 55 $netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \''); 56 56 $netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \''); 57 $lines_b = split("\n", $netstat_b);58 $lines_n = split("\n", $netstat_n);57 $lines_b = preg_split("/\n/", $netstat_b); 58 $lines_n = preg_split("/\n/", $netstat_n); 59 59 $results = array(); 60 60 for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) { 61 61 $ar_buf_b = preg_split("/\s+/", $lines_b[$i]); -
phpsysinfo/class.SunOS.inc.php
old new 27 27 // Extract kernel values via kstat() interface 28 28 function kstat ($key) { 29 29 $m = execute_program('kstat', "-p d $key"); 30 list($key, $value) = split("\t", trim($m), 2);30 list($key, $value) = preg_split("/\t/", trim($m), 2); 31 31 return $value; 32 32 } 33 33 … … 67 67 } 68 68 69 69 function users () { 70 $who = split('=', execute_program('who', '-q'));70 $who = preg_split('/=/', execute_program('who', '-q')); 71 71 $result = $who[1]; 72 72 return $result; 73 73 } … … 128 128 $results = array(); 129 129 130 130 $netstat = execute_program('netstat', '-ni | awk \'(NF ==10){print;}\''); 131 $lines = split("\n", $netstat);131 $lines = preg_split("/\n/", $netstat); 132 132 $results = array(); 133 133 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 134 134 $ar_buf = preg_split("/\s+/", $lines[$i]); … … 199 199 200 200 function filesystems () { 201 201 $df = execute_program('df', '-k'); 202 $mounts = split("\n", $df);202 $mounts = preg_split("/\n/", $df); 203 203 204 204 $dftypes = execute_program('df', '-n'); 205 $mounttypes = split("\n", $dftypes);205 $mounttypes = preg_split("/\n/", $dftypes); 206 206 207 207 for ($i = 1, $j = 0, $max = sizeof($mounts); $i < $max; $i++) { 208 208 $ar_buf = preg_split('/\s+/', $mounts[$i], 6); 209 $ty_buf = split(':', $mounttypes[$i-1], 2);209 $ty_buf = preg_split('/:/', $mounttypes[$i-1], 2); 210 210 211 211 if (hide_mount($ar_buf[5])) { 212 212 continue; -
phpsysinfo/class.parseProgs.inc.php
old new 10 10 $results = array(); 11 11 12 12 if ($_results = execute_program('lspci', '', $this->debug)) { 13 $lines = split("\n", $_results);13 $lines = preg_split("/\n/", $_results); 14 14 for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 15 15 list($addr, $name) = explode(' ', trim($lines[$i]), 2); 16 16 //if (!preg_match('/bridge/i', $name) && !preg_match('/USB/i', $name)) {
