projects
/
php-utility-classes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oops, still add value to our array
[php-utility-classes.git]
/
include
/
classes
/
rrdstat.php-class
diff --git
a/include/classes/rrdstat.php-class
b/include/classes/rrdstat.php-class
index c0d752019505048f97c0ebe4e80e3118cac1bd18..9ba8bde8383e5852f95437551bdadb531c540e0b 100644
(file)
--- a/
include/classes/rrdstat.php-class
+++ b/
include/classes/rrdstat.php-class
@@
-297,8
+297,6
@@
class rrdstat {
if (strlen($ret)) { $upvals = explode("\n", $ret); }
ob_end_clean();
}
if (strlen($ret)) { $upvals = explode("\n", $ret); }
ob_end_clean();
}
- $walkfunc = create_function('&$val,$key', '$val = is_numeric(trim($val))?trim($val):"U";');
- array_walk($upvals, $walkfunc);
}
else {
foreach ($this->rrd_fields as $ds) {
}
else {
foreach ($this->rrd_fields as $ds) {
@@
-332,16
+330,20
@@
class rrdstat {
}
}
else { $val = null; }
}
}
else { $val = null; }
- $upvals[] =
is_null($val)?'U':
$val;
+ $upvals[] = $val;
}
}
if (in_array('L', $upvals)) {
// for at least one value, we need to set the same as the last recorded value
}
}
if (in_array('L', $upvals)) {
// for at least one value, we need to set the same as the last recorded value
- $lastvals = $this->fetch();
+ $fvals = $this->fetch();
+ $rowids = array_shift($fvals);
+ $lastvals = array_shift($fvals);
foreach (array_keys($upvals, 'L') as $akey) {
foreach (array_keys($upvals, 'L') as $akey) {
- $upvals[$akey] = $lastvals[$
akey
];
+ $upvals[$akey] = $lastvals[$
rowids[$akey]
];
}
}
}
}
+ $walkfunc = create_function('&$val,$key', '$val = is_numeric(trim($val))?trim($val):"U";');
+ array_walk($upvals, $walkfunc);
$return = null;
if (count($upvals)) {
$update_cmd = 'rrdtool update '.$this->rrd_file.' N:'.implode(':', $upvals);
$return = null;
if (count($upvals)) {
$update_cmd = 'rrdtool update '.$this->rrd_file.' N:'.implode(':', $upvals);
@@
-385,7
+387,7
@@
class rrdstat {
foreach ($rows as $row) {
if (strlen(trim($row))) {
$rvals = preg_split('/\s+/', $row);
foreach ($rows as $row) {
if (strlen(trim($row))) {
$rvals = preg_split('/\s+/', $row);
- $rtime =
array_shift($rvals
);
+ $rtime =
str_replace(':', '', array_shift($rvals)
);
$rv_array = array();
foreach ($rvals as $key=>$rval) {
$rv_array[$fields[$key]] = ($rval=='nan')?null:floatval($rval);
$rv_array = array();
foreach ($rvals as $key=>$rval) {
$rv_array[$fields[$key]] = ($rval=='nan')?null:floatval($rval);