diff options
| author | Pim van den Berg | 2010-01-12 20:08:00 +0100 |
|---|---|---|
| committer | Pim van den Berg | 2010-01-12 20:19:51 +0100 |
| commit | 3fbe5ca4a40ea38de0e91cb89dabaa732ff23b60 (patch) | |
| tree | 4bd124259524abbcfe37233dbe31a01345335b34 | |
| parent | make rrdtool executable configurable (diff) | |
| download | apt-panopticon_cgp-3fbe5ca4a40ea38de0e91cb89dabaa732ff23b60.zip apt-panopticon_cgp-3fbe5ca4a40ea38de0e91cb89dabaa732ff23b60.tar.gz apt-panopticon_cgp-3fbe5ca4a40ea38de0e91cb89dabaa732ff23b60.tar.bz2 apt-panopticon_cgp-3fbe5ca4a40ea38de0e91cb89dabaa732ff23b60.tar.xz | |
make browser cache time for images configurable
| -rw-r--r-- | conf/config.php | 3 | ||||
| -rw-r--r-- | type/Default.class.php | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/conf/config.php b/conf/config.php index d904751..b402b7f 100644 --- a/conf/config.php +++ b/conf/config.php | |||
| @@ -15,6 +15,9 @@ $CONFIG['rrdtool'] = '/usr/bin/rrdtool'; | |||
| 15 | # default plugins to show on host page | 15 | # default plugins to show on host page |
| 16 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); | 16 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); |
| 17 | 17 | ||
| 18 | # browser cache time for the graphs (in seconds) | ||
| 19 | $CONFIG['cache'] = 90; | ||
| 20 | |||
| 18 | # default width/height of the graphs | 21 | # default width/height of the graphs |
| 19 | $CONFIG['width'] = 400; | 22 | $CONFIG['width'] = 400; |
| 20 | $CONFIG['heigth'] = 175; | 23 | $CONFIG['heigth'] = 175; |
diff --git a/type/Default.class.php b/type/Default.class.php index ad880b3..ade3a16 100644 --- a/type/Default.class.php +++ b/type/Default.class.php | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | class Type_Default { | 5 | class Type_Default { |
| 6 | var $datadir; | 6 | var $datadir; |
| 7 | var $rrdtool; | 7 | var $rrdtool; |
| 8 | var $cache; | ||
| 8 | var $args; | 9 | var $args; |
| 9 | var $seconds; | 10 | var $seconds; |
| 10 | var $data_sources = array('value'); | 11 | var $data_sources = array('value'); |
| @@ -25,6 +26,7 @@ class Type_Default { | |||
| 25 | function __construct($config) { | 26 | function __construct($config) { |
| 26 | $this->datadir = $config['datadir']; | 27 | $this->datadir = $config['datadir']; |
| 27 | $this->rrdtool = $config['rrdtool']; | 28 | $this->rrdtool = $config['rrdtool']; |
| 29 | $this->cache = $config['cache']; | ||
| 28 | $this->parse_get(); | 30 | $this->parse_get(); |
| 29 | $this->rrd_files(); | 31 | $this->rrd_files(); |
| 30 | $this->identifiers = $this->file2identifier($this->files); | 32 | $this->identifiers = $this->file2identifier($this->files); |
| @@ -114,7 +116,8 @@ class Type_Default { | |||
| 114 | 116 | ||
| 115 | if(!$debug) { | 117 | if(!$debug) { |
| 116 | # caching | 118 | # caching |
| 117 | header("Expires: " . date(DATE_RFC822,strtotime("90 seconds"))); | 119 | if (is_numeric($this->cache) && $this->cache > 0) |
| 120 | header("Expires: " . date(DATE_RFC822,strtotime($this->cache." seconds"))); | ||
| 118 | header("content-type: image/png"); | 121 | header("content-type: image/png"); |
| 119 | $graphdata = implode(' ', $graphdata); | 122 | $graphdata = implode(' ', $graphdata); |
| 120 | echo `$graphdata`; | 123 | echo `$graphdata`; |
