Skip to content

Commit

Permalink
MAGETWO-80115: Do not disable maintenance mode after running a backup.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrann authored Sep 27, 2017
2 parents f7b0fe3 + a7060f2 commit e8cbcca
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions setup/src/Magento/Setup/Console/Command/BackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class BackupCommand extends AbstractSetupCommand
*/
private $deploymentConfig;

/**
* The initial maintenance mode state
* @var bool
*/
private $maintenanceModeInitialState;

/**
* Constructor
*
Expand All @@ -73,6 +79,7 @@ public function __construct(
$this->maintenanceMode = $maintenanceMode;
$this->backupRollbackFactory = $this->objectManager->get(\Magento\Framework\Setup\BackupRollbackFactory::class);
$this->deploymentConfig = $deploymentConfig;
$this->maintenanceModeInitialState = $this->maintenanceMode->isOn();
parent::__construct();
}

Expand Down Expand Up @@ -147,8 +154,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('<error>' . $e->getMessage() . '</error>');
$returnValue = \Magento\Framework\Console\Cli::RETURN_FAILURE;
} finally {
$output->writeln('<info>Disabling maintenance mode</info>');
$this->maintenanceMode->set(false);
// Only disable maintenace mode if it wasn't turned on before
if (!$this->maintenanceModeInitialState) {
$output->writeln('<info>Disabling maintenance mode</info>');
$this->maintenanceMode->set(false);
}
}
return $returnValue;
}
Expand Down

0 comments on commit e8cbcca

Please sign in to comment.