Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-01 17:40:25 +0300
committerJoas Schilling <coding@schilljs.com>2021-10-13 15:15:42 +0300
commite642653a3362cf48086a6eaa9cded6ba8d76d5b2 (patch)
tree7e6231b3f1aa9aab882ccce7ecb9a8e6539ddc16 /lib
parent13fc105138e952fabe94ae53d717c8b2154ce6f8 (diff)
Keep group restrictions when reenabling apps after an update
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/App/AppManager.php6
-rw-r--r--lib/private/Updater.php17
-rw-r--r--lib/public/App/IAppManager.php6
3 files changed, 18 insertions, 11 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index f756664e457..2721725bf94 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -400,7 +400,11 @@ class AppManager implements IAppManager {
}
if ($automaticDisabled) {
- $this->autoDisabledApps[] = $appId;
+ $previousSetting = $this->appConfig->getValue($appId, 'enabled', 'yes');
+ if ($previousSetting !== 'yes' && $previousSetting !== 'no') {
+ $previousSetting = json_decode($previousSetting, true);
+ }
+ $this->autoDisabledApps[$appId] = $previousSetting;
}
unset($this->installedAppsCache[$appId]);
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index c1ecd3e7c0d..acd62dedde0 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -36,10 +36,12 @@
namespace OC;
+use OC\App\AppManager;
use OC\DB\MigrationService;
use OC\Hooks\BasicEmitter;
use OC\IntegrityCheck\Checker;
use OC_App;
+use OCP\App\IAppManager;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Util;
@@ -260,9 +262,12 @@ class Updater extends BasicEmitter {
// Update the appfetchers version so it downloads the correct list from the appstore
\OC::$server->getAppFetcher()->setVersion($currentVersion);
+ /** @var IAppManager|AppManager $appManager */
+ $appManager = \OC::$server->getAppManager();
+
// upgrade appstore apps
- $this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps());
- $autoDisabledApps = \OC::$server->getAppManager()->getAutoDisabledApps();
+ $this->upgradeAppStoreApps($appManager->getInstalledApps());
+ $autoDisabledApps = $appManager->getAutoDisabledApps();
$this->upgradeAppStoreApps($autoDisabledApps, true);
// install new shipped apps on upgrade
@@ -448,7 +453,7 @@ class Updater extends BasicEmitter {
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
- foreach ($disabledApps as $app) {
+ foreach ($disabledApps as $app => $previousEnableSetting) {
try {
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
if ($this->installer->isUpdateAvailable($app)) {
@@ -459,7 +464,11 @@ class Updater extends BasicEmitter {
if ($reenable) {
$ocApp = new \OC_App();
- $ocApp->enable($app);
+ if (!empty($previousEnableSetting)) {
+ $ocApp->enable($app, $previousEnableSetting);
+ } else {
+ $ocApp->enable($app);
+ }
}
} catch (\Exception $ex) {
$this->log->logException($ex, ['app' => 'core']);
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index 9ead8089c7d..78c60e2d6ab 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -184,12 +184,6 @@ interface IAppManager {
public function getEnabledAppsForGroup(IGroup $group): array;
/**
- * @return array
- * @since 17.0.0
- */
- public function getAutoDisabledApps(): array;
-
- /**
* @param String $appId
* @return string[]
* @since 17.0.0