Exemple #1
0
 /**
  * @param \Client\Tasks\SyncTask $task
  * @return bool
  */
 public function processUpdateBanner($task)
 {
     $event = self::findFirst(['state = :state:', 'bind' => ['state' => self::BANNER_UPDATING]]);
     if ($event) {
         $this->getDI()->get('log')->error("Предыдущие обновление баннеров не завершено");
         return false;
     }
     $this->getDI()->get('log')->info('начали синхронизацию баннеров');
     $this->state = self::BANNER_UPDATING;
     $this->save();
     $file = $this->getFile();
     $task->updateBannerViaFileAction([3 => $file]);
     unlink($file);
     $this->getDI()->get('log')->info('закончили синхронизацию баннеров');
     $this->state = self::DONE;
     $this->save();
     return true;
 }