Example #1
0
 /**
  * Update site.
  *
  * Runs all update tasks on the site.
  *
  * @param string $environment An environment string.
  * @param array $opts
  *
  * @option $maintenance-mode Take site offline during site update.
  *
  * @return Result|null
  *   The command result.
  */
 public function siteUpdate($environment, $opts = ['maintenance-mode' => FALSE])
 {
     $this->taskEnvironmentInitialize($environment)->run();
     // Not installed -> Abort.
     if (!Drupal::isInstalled()) {
         $this->yell('Site is not installed', 40, 'red');
         $this->say('Run <fg=yellow>site:install</fg=yellow> command instead.');
     } else {
         $collection = $this->collection();
         // Take site offline (if --maintenance-mode option is set).
         if ($opts['maintenance-mode']) {
             $collection->add(['Update.enableMaintenanceMode' => $this->taskSiteMaintenanceMode(TRUE)]);
         }
         // Perform update tasks.
         $collection->add($this->siteUpdateCollection($environment));
         // Bring site back online (if --maintenance-mode option is set).
         if ($opts['maintenance-mode']) {
             $collection->add(['Update.disableMaintenanceMode' => $this->taskSiteMaintenanceMode(FALSE)]);
         }
         return $collection->run();
     }
     return NULL;
 }
Example #2
0
 /**
  * Task should be skipped?
  *
  * @return bool
  *   Whether the task should be skipped or not?
  */
 protected function skip()
 {
     return !Drupal::isInstalled();
 }
Example #3
0
 /**
  * Return temporary files directory path.
  *
  * @return string
  *   The absolute path to the temporary files directory of Drupal.
  */
 public static function temporaryFilesDirectory()
 {
     return static::absolute(Drupal::temporaryFilesDirectory());
 }