Skip to content

Commit e8cbcca

Browse files
authored
MAGETWO-80115: Do not disable maintenance mode after running a backup. magento#11056
2 parents f7b0fe3 + a7060f2 commit e8cbcca

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

setup/src/Magento/Setup/Console/Command/BackupCommand.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class BackupCommand extends AbstractSetupCommand
5757
*/
5858
private $deploymentConfig;
5959

60+
/**
61+
* The initial maintenance mode state
62+
* @var bool
63+
*/
64+
private $maintenanceModeInitialState;
65+
6066
/**
6167
* Constructor
6268
*
@@ -73,6 +79,7 @@ public function __construct(
7379
$this->maintenanceMode = $maintenanceMode;
7480
$this->backupRollbackFactory = $this->objectManager->get(\Magento\Framework\Setup\BackupRollbackFactory::class);
7581
$this->deploymentConfig = $deploymentConfig;
82+
$this->maintenanceModeInitialState = $this->maintenanceMode->isOn();
7683
parent::__construct();
7784
}
7885

@@ -147,8 +154,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
147154
$output->writeln('<error>' . $e->getMessage() . '</error>');
148155
$returnValue = \Magento\Framework\Console\Cli::RETURN_FAILURE;
149156
} finally {
150-
$output->writeln('<info>Disabling maintenance mode</info>');
151-
$this->maintenanceMode->set(false);
157+
// Only disable maintenace mode if it wasn't turned on before
158+
if (!$this->maintenanceModeInitialState) {
159+
$output->writeln('<info>Disabling maintenance mode</info>');
160+
$this->maintenanceMode->set(false);
161+
}
152162
}
153163
return $returnValue;
154164
}

0 commit comments

Comments
 (0)