Skip to content

Commit

Permalink
Fix app upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Oct 18, 2021
1 parent 8f041ca commit a3c657b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/private/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ private function doUpgrade($currentVersion, $installedVersion) {
// upgrade appstore apps
$this->upgradeAppStoreApps($appManager->getInstalledApps());
$autoDisabledApps = $appManager->getAutoDisabledApps();
$this->upgradeAppStoreApps($autoDisabledApps, true);
if (!empty($autoDisabledApps)) {
$this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps);
}

// install new shipped apps on upgrade
$errors = Installer::installShippedApps(true);
Expand Down Expand Up @@ -448,8 +450,8 @@ private function isCodeUpgrade() {
}

/**
* @param array $disabledApps
* @param bool $reenable
* @param array $apps
* @param array $previousEnableStates
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
Expand All @@ -462,10 +464,10 @@ private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
}
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);

if ($reenable) {
if (!empty($previousEnableStates)) {
$ocApp = new \OC_App();
if (!empty($previousEnableSetting)) {
$ocApp->enable($app, $previousEnableSetting);
if (!empty($previousEnableStates[$app])) {
$ocApp->enable($app, $previousEnableStates[$app]);
} else {
$ocApp->enable($app);
}
Expand Down

0 comments on commit a3c657b

Please sign in to comment.