allow to turn off cronjobs

This commit is contained in:
Garvin Hicking 2015-03-16 15:43:26 +01:00
parent 9ae37fbe7b
commit 7ea24b4031
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,5 @@
0.9.2: Allow to turn off specific cronjobs
0.9: Properly use the example() API method by returning, not echo'ing. Unimportant update.
0.8:
----

View file

@ -22,7 +22,7 @@ class serendipity_event_cronjob extends serendipity_event {
$propbag->add('description', PLUGIN_EVENT_CRONJOB_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '0.9.1');
$propbag->add('version', '0.9.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'php' => '4.1.0'
@ -43,6 +43,7 @@ class serendipity_event_cronjob extends serendipity_event {
static function getValues($mode = 'select') {
// Add future timespans here
static $timespan = array(
'off' => 0,
'5min' => 300,
'30min' => 1800,
'1h' => 3600,
@ -144,6 +145,7 @@ class serendipity_event_cronjob extends serendipity_event {
$now = time();
$ts = $this->getValues('fetch');
foreach($ts as $span => $time) {
if ($span == 'off') continue;
if ($this->get_config('last_' . $span) < ($now - $time)) {
$this->set_config('last_' . $span, $now);
$this->log('Executing "cronjob_' . $span . '"', 'execute');