don't error out if the graph doesn't exist but can be created
authorRobert Kaiser <kairo@kairo.at>
Sun, 19 Jul 2020 15:09:06 +0000 (17:09 +0200)
committerRobert Kaiser <kairo@kairo.at>
Sun, 19 Jul 2020 15:09:06 +0000 (17:09 +0200)
classes/rrdstat.php-class

index 9226d564f5f70c2059b340bfdeca81ea39b0e509..0a71f13da11858fc9456fc7e44ed759fd891d90e 100644 (file)
@@ -760,7 +760,8 @@ class rrdstat {
     }
 
     $graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
-    if (!is_writable($fname)) {
+    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;
     }