Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 9f82a6b

Browse files
author
Charles Ma
committed
ENH: fixed bug #158 Added run_only_once support
1 parent 1cfcd98 commit 9f82a6b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

modules/scheduler/controllers/RunController.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ function indexAction()
3838
foreach($jobs as $job)
3939
{
4040
$job->setStatus(SCHEDULER_JOB_STATUS_STARTED);
41+
if($job->getRunOnlyOnce() == 0)
42+
{
43+
$firetime = strtotime($job->getFireTime()) + $job->getTimeInterval();
44+
$job->setFireTime(date('c', $firetime));
45+
}
4146
$job->setTimeLastFired(date('c'));
4247
$this->Scheduler_Job->save($job);
4348
try
@@ -54,7 +59,14 @@ function indexAction()
5459
$this->Scheduler_Job->save($job);
5560
continue;
5661
}
57-
$job->setStatus(SCHEDULER_JOB_STATUS_DONE);
62+
if($job->getRunOnlyOnce() == 0)
63+
{
64+
$job->setStatus(SCHEDULER_JOB_STATUS_TORUN);
65+
}
66+
else
67+
{
68+
$job->setStatus(SCHEDULER_JOB_STATUS_DONE);
69+
}
5870
$this->Scheduler_Job->save($job);
5971
}
6072
}

0 commit comments

Comments
 (0)