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:12:32 +0300
commit7f4b3fb68d33b90f815ed26a249ecadbffbd2a48 (patch)
tree31999e331cfef0519b7a349499abbcdc267fae52 /lib
parente229cd3d53aed19c7f5036434b1fdd3967df1ddb (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 7063878429a..ae5aeab9831 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 65e2c9bd57f..705ee435d57 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -37,11 +37,13 @@
namespace OC;
+use OC\App\AppManager;
use OC\DB\Connection;
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;
@@ -262,9 +264,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
@@ -409,7 +414,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)) {
@@ -420,7 +425,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