From 5c090c0f64b290960c99b18ce28f3d2fda0e3391 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Wed, 16 Jul 2014 23:35:23 +0200 Subject: graph: don't overwrite config rrdtool_opts by rrdtool_opts from json plugin Closes #86 --- graph.php | 2 +- type/Base.class.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/graph.php b/graph.php index dadb2c5..0b7cee5 100644 --- a/graph.php +++ b/graph.php @@ -86,7 +86,7 @@ if (isset($plugin_json[$type]['vertical'])) { } if (isset($plugin_json[$type]['rrdtool_opts'])) { - $obj->rrdtool_opts = $plugin_json[$type]['rrdtool_opts']; + $obj->rrdtool_opts[] = $plugin_json[$type]['rrdtool_opts']; } if (isset($plugin_json[$type]['datasize']) and $plugin_json[$type]['datasize']) diff --git a/type/Base.class.php b/type/Base.class.php index 5af4c29..b74c1b1 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -5,7 +5,7 @@ class Type_Base { var $datadir; var $rrdtool; - var $rrdtool_opts; + var $rrdtool_opts = array(); var $cache; var $args; var $seconds; @@ -36,7 +36,8 @@ class Type_Base { function __construct($config, $_get) { $this->datadir = $config['datadir']; $this->rrdtool = $config['rrdtool']; - $this->rrdtool_opts = $config['rrdtool_opts']; + if (!empty($config['rrdtool_opts'])) + $this->rrdtool_opts[] = $config['rrdtool_opts']; $this->cache = $config['cache']; $this->parse_get($_get); $this->rrd_title = sprintf( @@ -253,8 +254,9 @@ class Type_Base { default: break; } - if ($this->rrdtool_opts != '') - $rrdgraph[] = $this->rrdtool_opts; + if (!empty($this->rrdtool_opts)) + foreach($this->rrdtool_opts as $opt) + $rrdgraph[] = $opt; if ($this->graph_smooth) $rrdgraph[] = '-E'; if ($this->base) -- cgit v1.1