public function getResult()
 {
     while (!$this->timeIsOver() && ($context = $this->getNextContext())) {
         $com = $context->get('command');
         $cmd = WPAdm_Command_Factory::getCommand($com);
         if ($cmd === null) {
             $this->result->setError(langWPADM::get('Website "%d" returned an error: Command "%com" not found. To solve this problem, we need to access the system logs of your hosting/server and/or from your backup, that you tried to create or simply send to us your FTP access data. You can send to us support request using "Help" button on plugin page.', false, array('%d', '%com'), array(SITE_HOME, $com)));
             $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
             array_unshift($this->contexts, $context);
             $this->done();
             return $this->result;
         } elseif (!$cmd->execute($context)) {
             $this->result->setError(langWPADM::get('Website "%d" returned some unknown error during command "%com" was running. To solve this problem, we need to access the system logs of your hosting/server and/or from your backup, that you tried to create or simply send to us your FTP access data. You can send to us support request using "Help" button on plugin page.', false, array('%d', '%com'), array(SITE_HOME, $com)));
             $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
             array_unshift($this->contexts, $context);
             $this->done();
             return $this->result;
         } else {
         }
     }
     if ($this->step >= self::MAX_COUNT_STEPS) {
         $this->log('max_step: ' . $this->id);
         exit;
     }
     //если еще есть невыполненые задачи - рестаратуем
     if (!empty($this->contexts)) {
         $this->restart();
     }
     // если все задачи выполнили, то пометим файл
     $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
     $this->done();
     return $this->result;
 }
 public function getResult()
 {
     // пока время не закончилось и есть задачи - выполняем
     while (!$this->timeIsOver() && ($context = $this->getNextContext())) {
         $com = $context->get('command');
         $cmd = WPAdm_Command_Factory::getCommand($com);
         if ($cmd === null) {
             $this->result->setError('Command error:' . $com . ': ' . 'Command not found: ' . $com);
             $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
             array_unshift($this->contexts, $context);
             $this->done();
             return $this->result;
         } elseif (!$cmd->execute($context)) {
             //произошла какая то ошибка
             $this->result->setError('Command error:' . $com . ': ' . $context->getError());
             $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
             array_unshift($this->contexts, $context);
             $this->done();
             return $this->result;
         } else {
             //команда выполнена успешно
             //WPAdm_Core::log("Команда выполнена: {$com}");
         }
         //продолжаем работу
     }
     if ($this->step >= self::MAX_COUNT_STEPS) {
         $this->log('max_step: ' . $this->id);
         exit;
     }
     //если еще есть невыполненые задачи - рестаратуем
     if (!empty($this->contexts)) {
         $this->restart();
     }
     // если все задачи выполнили, то пометим файл
     $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
     $this->done();
     return $this->result;
 }