Skip to content

Commit 97fcc7b

Browse files
committed
Keep group restrictions when reenabling apps after an update
Signed-off-by: Joas Schilling <[email protected]>
1 parent 4737708 commit 97fcc7b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/private/App/AppManager.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,11 @@ public function disableApp($appId, $automaticDisabled = false) {
391391
}
392392

393393
if ($automaticDisabled) {
394-
$this->autoDisabledApps[] = $appId;
394+
$previousSetting = $this->appConfig->getValue($appId, 'enabled', 'yes');
395+
if ($previousSetting !== 'yes' && $previousSetting !== 'no') {
396+
$previousSetting = json_decode($previousSetting, true);
397+
}
398+
$this->autoDisabledApps[$appId] = $previousSetting;
395399
}
396400

397401
unset($this->installedAppsCache[$appId]);

lib/private/Updater.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ private function isCodeUpgrade(): bool {
400400
* @throws \Exception
401401
*/
402402
private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false): void {
403-
foreach ($disabledApps as $app) {
403+
foreach ($disabledApps as $app => $previousEnableSetting) {
404404
try {
405405
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
406406
if ($this->installer->isUpdateAvailable($app)) {
@@ -411,7 +411,11 @@ private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false
411411

412412
if ($reenable) {
413413
$ocApp = new \OC_App();
414-
$ocApp->enable($app);
414+
if (!empty($previousEnableSetting)) {
415+
$ocApp->enable($app, $previousEnableSetting);
416+
} else {
417+
$ocApp->enable($app);
418+
}
415419
}
416420
} catch (\Exception $ex) {
417421
$this->log->error($ex->getMessage(), [

lib/public/App/IAppManager.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ public function getAlwaysEnabledApps();
182182
*/
183183
public function getEnabledAppsForGroup(IGroup $group): array;
184184

185-
/**
186-
* @return array
187-
* @since 17.0.0
188-
*/
189-
public function getAutoDisabledApps(): array;
190-
191185
/**
192186
* @param String $appId
193187
* @return string[]

0 commit comments

Comments
 (0)