diff --git a/lib/private/Updater.php b/lib/private/Updater.php index acd62dedde014..c8f78c4a93737 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -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); @@ -448,12 +450,12 @@ private function isCodeUpgrade() { } /** - * @param array $disabledApps - * @param bool $reenable + * @param array $apps + * @param array $previousEnableStates * @throws \Exception */ - private function upgradeAppStoreApps(array $disabledApps, $reenable = false) { - foreach ($disabledApps as $app => $previousEnableSetting) { + private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []) { + foreach ($apps as $app) { try { $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); if ($this->installer->isUpdateAvailable($app)) { @@ -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); }