Skip to content

Commit d671ab5

Browse files
committed
fix: log and write the output of the 'occ maintenance:mode --off' command if it fails
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 84b37d1 commit d671ab5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/UpdateCommand.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
269269
//
270270
// Handle `occ upgrade` run
271271
//
272-
272+
273273
if ($this->skipUpgrade) {
274274
$this->updater->log('[info] "occ upgrade" was skipped');
275275
$this->updater->log('[info] updater finished');
@@ -324,7 +324,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
324324
//
325325
// Handle maintenance mode toggle
326326
//
327-
327+
328328
$output->writeln('');
329329
if ($input->isInteractive()) {
330330
/** @var QuestionHelper */
@@ -344,7 +344,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
344344
}
345345

346346
$this->updater->log('[info] Disabling maintenance mode');
347-
system($occRunCommand . ' maintenance:mode --off', $returnValueMaintenanceMode);
347+
$systemOutput = system($occRunCommand . ' maintenance:mode --off', $returnValueMaintenanceMode);
348348
if ($returnValueMaintenanceMode === 0) {
349349
$this->updater->log('[info] maintenance mode disabled');
350350
$output->writeln('');
@@ -354,6 +354,13 @@ protected function execute(InputInterface $input, OutputInterface $output) {
354354
$this->updater->log('[info] Disabling maintenance mode failed - return code: ' . $returnValueMaintenanceMode);
355355
$output->writeln('');
356356
$output->writeln('Disabling Maintenance mode failed - return code:' . $returnValueMaintenanceMode);
357+
if ($systemOutput === false) {
358+
$this->updater->log('[info] System call failed');
359+
$output->writeln('System call failed');
360+
} else {
361+
$this->updater->log('[info] occ output: ' . $systemOutput);
362+
$output->writeln('occ output: ' . $systemOutput);
363+
}
357364
$this->updater->log('[info] updater finished - with errors');
358365
return $returnValueMaintenanceMode;
359366
}

0 commit comments

Comments
 (0)