From: Robert Kaiser Date: Sun, 19 Jul 2020 15:09:06 +0000 (+0200) Subject: don't error out if the graph doesn't exist but can be created X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=commitdiff_plain;h=5dd242eff6de2d320c75ec83e5f988cd7c769cea don't error out if the graph doesn't exist but can be created --- diff --git a/classes/rrdstat.php-class b/classes/rrdstat.php-class index 9226d56..0a71f13 100644 --- a/classes/rrdstat.php-class +++ b/classes/rrdstat.php-class @@ -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; }