Skip to content

Commit 2f6bd56

Browse files
committed
Fix app upgrade
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent efaf112 commit 2f6bd56

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/private/Updater.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ private function doUpgrade($currentVersion, $installedVersion) {
270270
// upgrade appstore apps
271271
$this->upgradeAppStoreApps($appManager->getInstalledApps());
272272
$autoDisabledApps = $appManager->getAutoDisabledApps();
273-
$this->upgradeAppStoreApps($autoDisabledApps, true);
273+
if (!empty($autoDisabledApps)) {
274+
$this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps);
275+
}
274276

275277
// install new shipped apps on upgrade
276278
$errors = Installer::installShippedApps(true);
@@ -409,12 +411,12 @@ private function isCodeUpgrade() {
409411
}
410412

411413
/**
412-
* @param array $disabledApps
413-
* @param bool $reenable
414+
* @param array $apps
415+
* @param array $previousEnableStates
414416
* @throws \Exception
415417
*/
416-
private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
417-
foreach ($disabledApps as $app => $previousEnableSetting) {
418+
private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []) {
419+
foreach ($apps as $app) {
418420
try {
419421
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
420422
if ($this->installer->isUpdateAvailable($app)) {
@@ -423,10 +425,10 @@ private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
423425
}
424426
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
425427

426-
if ($reenable) {
428+
if (!empty($previousEnableStates)) {
427429
$ocApp = new \OC_App();
428-
if (!empty($previousEnableSetting)) {
429-
$ocApp->enable($app, $previousEnableSetting);
430+
if (!empty($previousEnableStates[$app])) {
431+
$ocApp->enable($app, $previousEnableStates[$app]);
430432
} else {
431433
$ocApp->enable($app);
432434
}

0 commit comments

Comments
 (0)