Esempio n. 1
0
File: Cron.php Progetto: kingsj/core
 /**
  * Run runner 
  * 
  * @param \XLite\Core\Task\ATask $runner Runner
  *  
  * @return void
  */
 protected function runRunner(\XLite\Core\Task\ATask $runner)
 {
     $silence = !$runner->getTitle();
     if ($runner && $runner->isReady()) {
         if (!$silence) {
             $this->printContent($runner->getTitle() . ' ... ');
         }
         $runner->run();
         if (!$silence) {
             $this->printContent($runner->getMessage() ?: 'done');
         }
     }
     if (!$silence) {
         $this->printContent(PHP_EOL);
     }
     \XLite\Core\Database::getEM()->flush();
 }
Esempio n. 2
0
 /**
  * Run runner 
  * 
  * @param \XLite\Core\Task\ATask $runner Runner
  *  
  * @return void
  */
 protected function runRunner(\XLite\Core\Task\ATask $runner)
 {
     $silence = !$runner->getTitle();
     if ($runner && $runner->isReady() && !$runner->isRunning()) {
         if (!$silence) {
             $this->printContent($runner->getTitle() . ' ... ');
         }
         $runner->run();
         if (!$silence) {
             $this->printContent($runner->getMessage() ?: 'done');
         }
     } elseif ($runner->isRunning()) {
         $msg = !$runner->shouldRunIfCrashed() ? '| Task will not be restarted because previous attempt has failed. Remove lock files manually to start the task' : '';
         $this->printContent($runner->getTitle() . ' ... Already running ' . $msg);
     }
     if (!$silence) {
         $this->printContent(PHP_EOL);
     }
     \XLite\Core\Database::getEM()->flush();
 }