Skip to content

Commit

Permalink
3943 maintenance mode update entities (#3963)
Browse files Browse the repository at this point in the history
* Add new arguments key and target. Make it possible use not only default target for db connections

* Enable maintenance moude during the entities update
  • Loading branch information
LOBsTerr committed Apr 10, 2019
1 parent 51035af commit a0f3f93
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Command/Update/EntitiesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,15 @@ protected function configure()
$this
->setName('update:entities')
->setDescription($this->trans('commands.update.entities.description'))
->enableMaintenance()
->setAliases(['upe']);
;
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//$state = $this->getDrupalService('state');
$this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-on'));
$this->getIo()->info($this->trans('commands.update.entities.messages.start'));
$this->state->set('system.maintenance_mode', true);

try {
$this->entityDefinitionUpdateManager->applyUpdates();
/* @var EntityStorageException $e */
Expand All @@ -88,9 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->getIo()->error(strtr('%type: @message in %function (line %line of %file).', $variables));
}

$this->state->set('system.maintenance_mode', false);
$this->getIo()->info($this->trans('commands.update.entities.messages.end'));
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
$this->getIo()->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
}
}

0 comments on commit a0f3f93

Please sign in to comment.