diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-06-07 18:52:54 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-06-07 18:52:54 +1000 |
| commit | 8d30c9fb4242321ccad7f4c19caaecae569bddb3 (patch) | |
| tree | acf81c9090ab5c424a52b3d96bdd1b2ca98b4cb1 /templates | |
| parent | cec63231cfbe134cd917a8c3be4b0c8f7af1d072 (diff) | |
crontab
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/themes/rrdtool/info.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/templates/themes/rrdtool/info.php b/templates/themes/rrdtool/info.php index 824609a4..68210ad6 100644 --- a/templates/themes/rrdtool/info.php +++ b/templates/themes/rrdtool/info.php @@ -40,6 +40,29 @@ 'default' => implode(' ', $__default_boards) ); + $theme['install_callback'] = 'rrdtool_install'; + if(!function_exists('rrdtool_install')) { + function rrdtool_install($settings) { + global $config; + + $job = '* * * * * php -q ' . str_replace('\\', '/', dirname(__FILE__)) . '/cron.php' . PHP_EOL; + + if(function_exists('system')) { + $crontab = tempnam($config['tmp'], 'tinyboard-rrdtool'); + file_write($crontab, $job); + @system('crontab ' . escapeshellarg($crontab) . '; echo $?', $ret); + unlink($crontab); + + if($ret === 0) + return; // it seems to install okay? + } + + return '<h2>I couldn\'t install the crontab!</h2>' . + 'In order to use this plugin, you must add the following crontab entry:' . + '<pre>' . $job . '</pre>'; + } + } + // Unique function name for building everything $theme['build_function'] = 'rrdtool_build'; ?>
\ No newline at end of file |
