From d60658736e32f112d9965b20b322cb35e713b2f0 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 23 Dec 2011 13:07:52 +1100 Subject: option to graph post rates by 'minute', 'day', 'year', etc. --- templates/themes/rrdtool/info.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'templates/themes/rrdtool/info.php') diff --git a/templates/themes/rrdtool/info.php b/templates/themes/rrdtool/info.php index 921d75b4..73658a22 100644 --- a/templates/themes/rrdtool/info.php +++ b/templates/themes/rrdtool/info.php @@ -58,23 +58,30 @@ ); $theme['config'][] = Array( - 'title' => 'Width', + 'title' => 'Graph Width', 'name' => 'width', 'type' => 'text', - 'comment' => '(graph width)', 'size' => 3, 'default' => '700' ); $theme['config'][] = Array( - 'title' => 'Height', + 'title' => 'Graph Height', 'name' => 'height', 'type' => 'text', - 'comment' => '(graph height)', 'size' => 3, 'default' => '150' ); + $theme['config'][] = Array( + 'title' => 'Graph Rate', + 'name' => 'rate', + 'type' => 'text', + 'comment' => 'Graph posts per X? ("minute", "day", "year", etc.)', + 'size' => 3, + 'default' => 'hour' + ); + $theme['install_callback'] = 'rrdtool_install'; if(!function_exists('rrdtool_install')) { function rrdtool_install($settings) { @@ -89,6 +96,9 @@ if(!is_numeric($settings['height']) || $settings['height'] < 1) return Array(false, 'Invalid height: ' . $settings['height'] . '!'); + if(!in_array($settings['rate'], Array('second', 'minute', 'day', 'hour', 'week', 'month', 'year'))) + return Array(false, 'Invalid rate: ' . $settings['rate'] . '!'); + $job = '*/' . $settings['interval'] . ' * * * * php -q ' . str_replace('\\', '/', dirname(__FILE__)) . '/cron.php' . PHP_EOL; if(function_exists('system')) { -- cgit v1.3