Skip to content

Commit

Permalink
introduce occ upgrade execution
Browse files Browse the repository at this point in the history
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
  • Loading branch information
MorrisJobke committed Nov 25, 2016
1 parent 95385c5 commit 5d0c930
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion lib/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,60 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$output->writeln('');
if ($i === 11) {
$output->writeln('Update successful.');
$this->updater->log('[info] update of code successful.');
$output->writeln('Update of code successful.');

if ($input->isInteractive()) {

$output->writeln('');

$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Should the "occ upgrade" command be executed? [Y/n] ', true);

if (!$helper->ask($input, $output, $question)) {
$output->writeln('Please now execute "./occ upgrade" to finish the upgrade.');
$this->updater->log('[info] updater finished');
return 0;
}
} else {
$this->updater->log('[info] updater run in non-interactive mode - occ upgrade is started');
$output->writeln('Updater run in non-interactive mode - will start "occ upgrade" now.');
$output->writeln('');
}

chdir($path . '/..');
chmod('occ', 0755); # TODO do this in the updater
system('./occ upgrade', $returnValue);

$output->writeln('');
if ($input->isInteractive()) {

$helper = $this->getHelper('question');
$question = new ConfirmationQuestion($this->checkTexts[10] . ' [y/N] ', false);

if ($helper->ask($input, $output, $question)) {
$output->writeln('Maintenance mode kept active');
$this->updater->log('[info] updater finished - maintenance mode kept active');
return $returnValue;
}
} else {
$this->updater->log('[info] updater run in non-interactive mode - disabling maintenance mode');
$output->writeln('Updater run in non-interactive mode - will disable maintenance mode now.');
}

try {
$this->updater->setMaintenanceMode(false);
$this->updater->log('[info] maintenance mode is disabled');
$output->writeln('');
$output->writeln('Maintenance mode is disabled');
} catch (\Exception $e) {
$this->updater->log('[info] maintenance mode can not be disabled');
$this->updater->logException($e);
$output->writeln('');
$output->writeln('Maintenance mode can not be disabled');
}

return $returnValue;
} else {
if ($this->shouldStop) {
$output->writeln('<error>Update stopped. To resume or retry just execute the updater again.</error>');
Expand Down Expand Up @@ -338,6 +391,7 @@ protected function executeStep($step) {
* @param integer $stepNumber
*/
protected function showCurrentStatus(OutputInterface $output, $stepNumber) {
$output->writeln('Steps that will be executed:');
for ($i = 1; $i < sizeof($this->checkTexts); $i++) {
if ($i === 10) {
// no need to ask for maintenance mode on CLI - skip it
Expand Down

0 comments on commit 5d0c930

Please sign in to comment.