diff options
author | Joas Schilling <coding@schilljs.com> | 2021-10-15 15:16:08 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-19 09:47:52 +0300 |
commit | 2f6bd56c934a19f464eafeb19ead3746743fb716 (patch) | |
tree | 41d4ec01759926a42d7fc9b4cb0d7f1c3094853e /lib | |
parent | efaf112d67672278ae4f9f6b0f69943a27b389d7 (diff) |
Fix app upgrade
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-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 705ee435d57..9c9da1f50c0 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -270,7 +270,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); @@ -409,12 +411,12 @@ class Updater extends BasicEmitter { } /** - * @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)) { @@ -423,10 +425,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); } |