projects
/
php-utility-classes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
if eval returns nothing, leave array empty; in that case, don't update
[php-utility-classes.git]
/
include
/
classes
/
rrdstat.php-class
diff --git
a/include/classes/rrdstat.php-class
b/include/classes/rrdstat.php-class
index 74b5b5c4116153fcd34f12813fced0f689ae235e..15cca53b77b2b86af2e9668862e19b6a9eaef7a9 100644
(file)
--- a/
include/classes/rrdstat.php-class
+++ b/
include/classes/rrdstat.php-class
@@
-154,10
+154,11
@@
class rrdstat {
if (!is_null($evalcode)) {
ob_start();
eval($evalcode);
if (!is_null($evalcode)) {
ob_start();
eval($evalcode);
- $upvals = explode("\n", ob_get_contents());
+ $ret = ob_get_contents();
+ if (strlen($ret)) { $upvals = explode("\n", $ret); }
ob_end_clean();
}
ob_end_clean();
}
- $walkfunc = create_function('&$val', '$val = is_numeric($val)?$val:"U";');
+ $walkfunc = create_function('&$val
,$key
', '$val = is_numeric($val)?$val:"U";');
array_walk($upvals, $walkfunc);
}
else {
array_walk($upvals, $walkfunc);
}
else {
@@
-195,8
+196,11
@@
class rrdstat {
$upvals[] = is_null($val)?'U':$val;
}
}
$upvals[] = is_null($val)?'U':$val;
}
}
- $update_cmd = 'rrdtool update '.$this->rrd_file.' N:'.implode(':', $upvals);
- $return = `$update_cmd 2>&1`;
+ $return = null;
+ if (count($upvals)) {
+ $update_cmd = 'rrdtool update '.$this->rrd_file.' N:'.implode(':', $upvals);
+ $return = `$update_cmd 2>&1`;
+ }
if (strpos($return, 'ERROR') !== false) {
trigger_error($this->rrd_file.' - rrd update error: '.$return, E_USER_WARNING);
if (strpos($return, 'ERROR') !== false) {
trigger_error($this->rrd_file.' - rrd update error: '.$return, E_USER_WARNING);