Beispiel #1
0
 public function testTaskRetrievesTheRightTaskWithMultiple()
 {
     CronManager::schedule('task1', '5 minutes', 'library:method');
     CronManager::schedule('task2', '6 minutes', 'library:method');
     CronManager::schedule('task3', '7 minutes', 'library:method');
     $expected = new \Myth\Cron\CronTask('6 minutes', 'library:method');
     $this->assertEquals($expected, CronManager::task('task2'));
 }
Beispiel #2
0
 /**
  * Allows the execution of a suspended task to continue again
  * during normal cron execution.
  *
  * @param $alias
  */
 public function resume($alias)
 {
     // Verify the task actually exists.
     $task = \Myth\Cron\CronManager::task($alias);
     if (is_null($task)) {
         return CLI::error("Unable to find the task: {$alias}.");
     }
     // Update the existing setting.
     $suspended = Settings::get('suspended_tasks', 'cron');
     if (!empty($suspended)) {
         unset($suspended[array_search($alias, $suspended)]);
         if (!Settings::save('suspended_tasks', $suspended, 'cron')) {
             return CLI::error('Unkown problem saving the settings.');
         }
     }
     return CLI::write('Done');
 }