Пример #1
0
 public function actionIndex()
 {
     if ($this->semaphore()) {
         $this->setLimits();
         $this->log('Cron run started');
         foreach ($this->listControllers() as $controller) {
             \Foundation\VC\Config::includeController($controller);
             $class = \Foundation\VC\Config::getControllerClassName($controller);
             if (method_exists($class, 'runCron')) {
                 if (self::VERBOSE_LOGS) {
                     $this->log("Admin controller {$controller} job started");
                 }
                 $class::runCron($this);
                 $this->_em->flush();
             }
             //reset the max execution time and memory limit after every admin script is included because some override this
             $this->setLimits();
         }
         foreach ($this->_em->getRepository('\\Jazzee\\Entity\\PageType')->findAll() as $pageType) {
             $class = $pageType->getClass();
             if (method_exists($class, 'runCron')) {
                 if (self::VERBOSE_LOGS) {
                     $this->log("Page type {$class} job started");
                 }
                 $class::runCron($this);
                 $this->_em->flush();
             }
             $this->setLimits();
         }
         foreach ($this->_em->getRepository('\\Jazzee\\Entity\\ElementType')->findAll() as $elementType) {
             $class = $elementType->getClass();
             if (method_exists($class, 'runCron')) {
                 if (self::VERBOSE_LOGS) {
                     $this->log("Element type {$class} job started");
                 }
                 $class::runCron($this);
                 $this->_em->flush();
             }
             $this->setLimits();
         }
         //Perform applicant actions
         \Foundation\VC\Config::includeController('apply_applicant');
         if (self::VERBOSE_LOGS) {
             $this->log("Controller apply_applicant job started");
         }
         ApplyApplicantController::runCron($this);
         //File store actions
         \Jazzee\FileStore::runCron($this);
         //clear the semephore
         $this->setVar('adminCronSemephore', false);
         $this->log('Cron run finished');
     }
 }