projects
/
php-utility-classes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't error out if the graph doesn't exist but can be created
[php-utility-classes.git]
/
classes
/
rrdstat.php-class
diff --git
a/classes/rrdstat.php-class
b/classes/rrdstat.php-class
index 74e2012e6eb2370e9063d54b00300c0cfef0b7ac..0a71f13da11858fc9456fc7e44ed759fd891d90e 100644
(file)
--- a/
classes/rrdstat.php-class
+++ b/
classes/rrdstat.php-class
@@
-760,15
+760,16
@@
class rrdstat {
}
$graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
}
$graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
- $return = `$graph_cmd 2>&1`;
-
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd graph error: '.$return, E_USER_WARNING);
- $return = 'command:'.$graph_cmd."\n\n".$return;
+ if ((file_exists($fname) && !is_writable($fname)) ||
+ (!file_exists($fname) && !is_writable(dirname($fname)))) {
+ trigger_error($this->rrd_file.' - graph file not writable: '.$fname, E_USER_WARNING);
+ return 'command:'.$graph_cmd."\n\n".'unwritable file: '.$fname;
}
}
- if (0) {
- // debug output
- $return = 'command:'.$graph_cmd."\n\n".$return;
+ $graph_out = `$graph_cmd 2>&1`;
+
+ if (strpos($graph_out, 'ERROR') !== false) {
+ trigger_error($this->rrd_file.' - rrd graph error: '.$graph_out, E_USER_WARNING);
+ return 'command:'.$graph_cmd."\n\n".$graph_out;
}
$legendlines = '';
foreach ($graphrows as $grow) {
}
$legendlines = '';
foreach ($graphrows as $grow) {
@@
-778,7
+779,7
@@
class rrdstat {
$legendline .= '|'.(isset($grow['legend_long'])?$grow['legend_long']:'');
$legendlines .= 'legend:'.$legendline."\n";
}
$legendline .= '|'.(isset($grow['legend_long'])?$grow['legend_long']:'');
$legendlines .= 'legend:'.$legendline."\n";
}
- $return = 'file:'.$fname."\n".$legendlines.$
return
;
+ $return = 'file:'.$fname."\n".$legendlines.$
graph_out
;
return $return;
}
return $return;
}