You are here

public function AcsfExtraCommands::postOnline in Acquia Cloud Site Factory Connector 8.2

Runs after a go-online command executes. Verifies maintenance mode.

@hook post-command go-online

File

src/Commands/AcsfExtraCommands.php, line 135

Class

AcsfExtraCommands
Provides drush commands for site related operations.

Namespace

Drush\Commands

Code

public function postOnline() {
  $content = \Drupal::state()
    ->get('system.maintenance_mode');
  if (empty($content)) {
    $this
      ->logger()
      ->success(dt('Site has been placed online.'));
  }
  else {
    $content = \Drupal::config('acsf.settings')
      ->get('site_owner_maintenance_mode');
    if (empty($content)) {
      $this
        ->logger()
        ->error(dt('Site has not been placed online.'));
    }
    else {
      $this
        ->logger()
        ->success(dt('Site has been left offline as set by the site owner.'));

      // Unset our maintenance mode setting.
      \Drupal::configFactory()
        ->getEditable('acsf.settings')
        ->set('site_owner_maintenance_mode', FALSE)
        ->save();
    }
  }
}