diff options
Diffstat (limited to 'lib/private/app/appmanager.php')
-rw-r--r-- | lib/private/app/appmanager.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 1cfa0bce25c..2a147d4de6f 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -24,6 +24,7 @@ namespace OC\App; use OCP\App\IAppManager; use OCP\IAppConfig; +use OCP\ICacheFactory; use OCP\IGroupManager; use OCP\IUser; use OCP\IUserSession; @@ -44,6 +45,9 @@ class AppManager implements IAppManager { */ private $groupManager; + /** @var \OCP\ICacheFactory */ + private $memCacheFactory; + /** * @var string[] $appId => $enabled */ @@ -53,11 +57,16 @@ class AppManager implements IAppManager { * @param \OCP\IUserSession $userSession * @param \OCP\IAppConfig $appConfig * @param \OCP\IGroupManager $groupManager + * @param \OCP\ICacheFactory $memCacheFactory */ - public function __construct(IUserSession $userSession, IAppConfig $appConfig, IGroupManager $groupManager) { + public function __construct(IUserSession $userSession, + IAppConfig $appConfig, + IGroupManager $groupManager, + ICacheFactory $memCacheFactory) { $this->userSession = $userSession; $this->appConfig = $appConfig; $this->groupManager = $groupManager; + $this->memCacheFactory = $memCacheFactory; } /** @@ -157,6 +166,7 @@ class AppManager implements IAppManager { public function enableApp($appId) { $this->installedAppsCache[$appId] = 'yes'; $this->appConfig->setValue($appId, 'enabled', 'yes'); + $this->clearAppsCache(); } /** @@ -172,6 +182,7 @@ class AppManager implements IAppManager { }, $groups); $this->installedAppsCache[$appId] = json_encode($groupIds); $this->appConfig->setValue($appId, 'enabled', json_encode($groupIds)); + $this->clearAppsCache(); } /** @@ -186,5 +197,14 @@ class AppManager implements IAppManager { } unset($this->installedAppsCache[$appId]); $this->appConfig->setValue($appId, 'enabled', 'no'); + $this->clearAppsCache(); + } + + /** + * Clear the cached list of apps when enabling/disabling an app + */ + protected function clearAppsCache() { + $settingsMemCache = $this->memCacheFactory->create('settings'); + $settingsMemCache->clear('listApps'); } } |