Merge pull request #16473 from owncloud/occ_16221

occ option to update all third party apps without disable
This commit is contained in:
Joas Schilling 2015-05-21 09:47:54 +02:00
commit 896130b68d
2 changed files with 31 additions and 6 deletions

View File

@ -70,6 +70,12 @@ class Upgrade extends Command {
null, null,
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'only runs the database schema migration simulation, do not actually update' 'only runs the database schema migration simulation, do not actually update'
)
->addOption(
'--no-app-disable',
null,
InputOption::VALUE_NONE,
'skips the disable of third party apps'
); );
} }
@ -83,6 +89,7 @@ class Upgrade extends Command {
$simulateStepEnabled = true; $simulateStepEnabled = true;
$updateStepEnabled = true; $updateStepEnabled = true;
$skip3rdPartyAppsDisable = false;
if ($input->getOption('skip-migration-test')) { if ($input->getOption('skip-migration-test')) {
$simulateStepEnabled = false; $simulateStepEnabled = false;
@ -90,6 +97,9 @@ class Upgrade extends Command {
if ($input->getOption('dry-run')) { if ($input->getOption('dry-run')) {
$updateStepEnabled = false; $updateStepEnabled = false;
} }
if ($input->getOption('no-app-disable')) {
$skip3rdPartyAppsDisable = true;
}
if (!$simulateStepEnabled && !$updateStepEnabled) { if (!$simulateStepEnabled && !$updateStepEnabled) {
$output->writeln( $output->writeln(
@ -106,6 +116,7 @@ class Upgrade extends Command {
$updater->setSimulateStepEnabled($simulateStepEnabled); $updater->setSimulateStepEnabled($simulateStepEnabled);
$updater->setUpdateStepEnabled($updateStepEnabled); $updater->setUpdateStepEnabled($updateStepEnabled);
$updater->setSkip3rdPartyAppsDisable($skip3rdPartyAppsDisable);
$updater->listen('\OC\Updater', 'maintenanceStart', function () use($output) { $updater->listen('\OC\Updater', 'maintenanceStart', function () use($output) {
$output->writeln('<info>Turned on maintenance mode</info>'); $output->writeln('<info>Turned on maintenance mode</info>');
@ -145,7 +156,6 @@ class Upgrade extends Command {
$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) { $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) {
$output->writeln("<info>Updated <$app> to $version</info>"); $output->writeln("<info>Updated <$app> to $version</info>");
}); });
$updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) { $updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) {
$output->writeln("<error>$message</error>"); $output->writeln("<error>$message</error>");
$self->upgradeFailed = true; $self->upgradeFailed = true;

View File

@ -65,6 +65,9 @@ class Updater extends BasicEmitter {
/** @var bool */ /** @var bool */
private $updateStepEnabled; private $updateStepEnabled;
/** @var bool */
private $skip3rdPartyAppsDisable;
/** /**
* @param HTTPHelper $httpHelper * @param HTTPHelper $httpHelper
* @param IConfig $config * @param IConfig $config
@ -99,6 +102,16 @@ class Updater extends BasicEmitter {
$this->updateStepEnabled = $flag; $this->updateStepEnabled = $flag;
} }
/**
* Sets whether the update disables 3rd party apps.
* This can be set to true to skip the disable.
*
* @param bool $flag false to not disable, true otherwise
*/
public function setSkip3rdPartyAppsDisable($flag) {
$this->skip3rdPartyAppsDisable = $flag;
}
/** /**
* Check if a new version is available * Check if a new version is available
* *
@ -407,10 +420,12 @@ class Updater extends BasicEmitter {
continue; continue;
} }
// disable any other 3rd party apps // disable any other 3rd party apps if not overriden
if(!$this->skip3rdPartyAppsDisable) {
\OC_App::disable($app); \OC_App::disable($app);
$disabledApps[]= $app; $disabledApps[]= $app;
$this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app)); $this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app));
};
} }
return $disabledApps; return $disabledApps;
} }