diff options
author | Joas Schilling <coding@schilljs.com> | 2021-10-15 14:16:08 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-15 14:16:46 +0200 |
commit | 59cf2b178958c34eaf94aa686ec7024851067c28 (patch) | |
tree | c5f9947a3ba7cacf562522707bfb51a451a77211 /lib/private/Updater.php | |
parent | 4e32fe8a4e69fb14cce7cd8919c1dbb403dab51e (diff) | |
download | nextcloud-server-59cf2b178958c34eaf94aa686ec7024851067c28.tar.gz nextcloud-server-59cf2b178958c34eaf94aa686ec7024851067c28.zip |
Fix app upgrade
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Updater.php')
-rw-r--r-- | lib/private/Updater.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 6494f7efe0d..2c5820fdd8b 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -273,7 +273,9 @@ class Updater extends BasicEmitter { // 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); @@ -400,12 +402,12 @@ class Updater extends BasicEmitter { } /** - * @param array $disabledApps - * @param bool $reenable + * @param array $apps + * @param array $previousEnableStates * @throws \Exception */ - private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false): void { - foreach ($disabledApps as $app => $previousEnableSetting) { + private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []): void { + foreach ($apps as $app) { try { $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); if ($this->installer->isUpdateAvailable($app)) { @@ -414,10 +416,10 @@ class Updater extends BasicEmitter { } $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); } |