コード例 #1
0
ファイル: UpgradeHandler.php プロジェクト: mheydt/scalr
 /**
  * Runs upgrade process
  *
  * @return bool Returns true if all updates completed successfully, false otherwise
  */
 public function run()
 {
     if (!self::checkPid()) {
         $this->console->warning("Cannot start a new process because another one has already been started.");
         return false;
     }
     register_shutdown_function('Scalr\\Upgrade\\UpgradeHandler::removePid');
     //Loads updates
     $successful = $this->loadUpdates();
     if (isset($this->opt->cmd) && $this->opt->cmd == self::CMD_RUN_SPECIFIC) {
         $pending = [];
         if (!isset($this->updates[$this->opt->uuid])) {
             $this->console->warning("Could not find specified update %s", $this->opt->uuid);
             exit(1);
         }
         $pending[] = $this->updates[$this->opt->uuid];
     } else {
         $dt = new \DateTime($this->getLastDate(), new \DateTimeZone('UTC'));
         $pending = $this->updates->getPendingUpdates($dt->getTimestamp());
     }
     if (count($pending) == 0) {
         $this->console->out('Scalr is up-to-date');
         return $successful;
     }
     $this->console->success('Starting Scalr upgrade');
     //Applies updates
     foreach ($pending as $update) {
         $update->console->interactive = $this->console->interactive;
         $successful = $this->applyUpdate($update) && $successful;
     }
     $this->console->success('Done');
     return $successful;
 }
コード例 #2
0
ファイル: UpgradeHandler.php プロジェクト: recipe/scalr
 /**
  * Runs upgrade process
  */
 public function run()
 {
     //Loads updates
     $this->loadUpdates();
     if (isset($this->opt->cmd) && $this->opt->cmd == self::CMD_RUN_SPECIFIC) {
         $pending = array();
         if (!isset($this->updates[$this->opt->uuid])) {
             $this->console->warning("Could not find specified update %s", $this->opt->uuid);
             exit;
         }
         $pending[] = $this->updates[$this->opt->uuid];
     } else {
         $dt = new \DateTime($this->getLastDate(), new \DateTimeZone('UTC'));
         $pending = $this->updates->getPendingUpdates($dt->getTimestamp());
     }
     //Applies updates
     foreach ($pending as $update) {
         $this->applyUpdate($update);
     }
 }