Skip to content

Commit de1e2e0

Browse files
author
Fred Sung
committed
MAGETWO-38174: Create skeleton command
- Text updated from CR feedback. - Move the enable/disable maintenance logic inside try-catch block. - Keep maintenance mode enabled if any exception occurred and provide the message to remind user. - Updated the similar logic in module uninstall command.
1 parent 834412e commit de1e2e0

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

app/code/Magento/Theme/Console/Command/ThemeUninstallCommand.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected function configure()
168168
self::INPUT_KEY_THEMES,
169169
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
170170
'Path of the theme. Theme path should be specified as full path which is area/vendor/name.'
171-
. ' For example, frontend/Magento/Blank'
171+
. ' For example, frontend/Magento/blank'
172172
);
173173
$this->addOption(
174174
self::INPUT_KEY_CLEAR_STATIC_CONTENT,
@@ -208,10 +208,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
208208
return;
209209
}
210210

211-
$output->writeln('<info>Enabling maintenance mode</info>');
212-
$this->maintenanceMode->set(true);
213-
214211
try {
212+
$output->writeln('<info>Enabling maintenance mode</info>');
213+
$this->maintenanceMode->set(true);
215214
if ($input->getOption(self::INPUT_KEY_BACKUP_CODE)) {
216215
$time = time();
217216
$codeBackup = $this->backupRollbackFactory->create($output);
@@ -226,11 +225,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
226225
}
227226
$this->remove->remove($themePackages);
228227
$this->cleanup($input, $output);
229-
} catch (\Exception $e) {
230-
$output->writeln('<error>' . $e->getMessage() . '</error>');
231-
} finally {
232228
$output->writeln('<info>Disabling maintenance mode</info>');
233229
$this->maintenanceMode->set(false);
230+
} catch (\Exception $e) {
231+
$output->writeln('<error>' . $e->getMessage() . '</error>');
232+
$output->writeln('<error>Please disable maintenance mode after you resolved above issues</error>');
234233
}
235234
}
236235

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
236236
return;
237237
}
238238

239-
$output->writeln('<info>Enabling maintenance mode</info>');
240-
$this->maintenanceMode->set(true);
241239
$helper = $this->getHelper('question');
242240
$question = new ConfirmationQuestion(
243241
'You are about to remove code and database tables. Are you sure?[y/N]',
@@ -247,6 +245,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
247245
return;
248246
}
249247
try {
248+
$output->writeln('<info>Enabling maintenance mode</info>');
249+
$this->maintenanceMode->set(true);
250250
$this->takeBackup($input, $output);
251251
$dbBackupOption = $input->getOption(self::INPUT_KEY_BACKUP_DB);
252252
if ($input->getOption(self::INPUT_KEY_REMOVE_DATA)) {
@@ -277,11 +277,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
277277
$output->writeln('<info>Removing code from Magento codebase:</info>');
278278
$this->removeCode($modules);
279279
$this->cleanup($input, $output);
280-
} catch (\Exception $e) {
281-
$output->writeln('<error>' . $e->getMessage() . '</error>');
282-
} finally {
283280
$output->writeln('<info>Disabling maintenance mode</info>');
284281
$this->maintenanceMode->set(false);
282+
} catch (\Exception $e) {
283+
$output->writeln('<error>' . $e->getMessage() . '</error>');
284+
$output->writeln('<error>Please disable maintenance mode after you resolved above issues</error>');
285285
}
286286
}
287287

0 commit comments

Comments
 (0)