summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-01 15:37:22 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-01 15:43:38 +0200
commitd01cfde98229c6d1bd14feefd889205027920d14 (patch)
treeefda9051a56382a5cb2313d360e9fde2cfcbb35f /lib
parent0af2dc7d3775f5d40cdfd3fe0cd4325abd6ce40d (diff)
downloadnextcloud-server-d01cfde98229c6d1bd14feefd889205027920d14.tar.gz
nextcloud-server-d01cfde98229c6d1bd14feefd889205027920d14.zip
Correctly purge the cache when an app is disabled via cli
Diffstat (limited to 'lib')
-rw-r--r--lib/private/app/appmanager.php18
-rw-r--r--lib/private/server.php10
2 files changed, 23 insertions, 5 deletions
diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php
index 1cfa0bce25c..c05b2a3b035 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
*/
@@ -54,10 +58,11 @@ class AppManager implements IAppManager {
* @param \OCP\IAppConfig $appConfig
* @param \OCP\IGroupManager $groupManager
*/
- 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 +162,7 @@ class AppManager implements IAppManager {
public function enableApp($appId) {
$this->installedAppsCache[$appId] = 'yes';
$this->appConfig->setValue($appId, 'enabled', 'yes');
+ $this->clearAppsCache();
}
/**
@@ -172,6 +178,7 @@ class AppManager implements IAppManager {
}, $groups);
$this->installedAppsCache[$appId] = json_encode($groupIds);
$this->appConfig->setValue($appId, 'enabled', json_encode($groupIds));
+ $this->clearAppsCache();
}
/**
@@ -186,5 +193,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');
}
}
diff --git a/lib/private/server.php b/lib/private/server.php
index 592f8d9a042..8c5169f229e 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -309,10 +309,12 @@ class Server extends SimpleContainer implements IServerContainer {
return new TempManager(get_temp_dir(), $c->getLogger());
});
$this->registerService('AppManager', function(Server $c) {
- $userSession = $c->getUserSession();
- $appConfig = $c->getAppConfig();
- $groupManager = $c->getGroupManager();
- return new \OC\App\AppManager($userSession, $appConfig, $groupManager);
+ return new \OC\App\AppManager(
+ $c->getUserSession(),
+ $c->getAppConfig(),
+ $c->getGroupManager(),
+ $c->getMemCacheFactory()
+ );
});
$this->registerService('DateTimeZone', function(Server $c) {
return new DateTimeZone(