summaryrefslogtreecommitdiffstats
path: root/lib/private/server.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-12-03 14:10:05 +0100
committerRobin Appelman <icewind@owncloud.com>2016-01-20 16:32:56 +0100
commitbe380accb90d0a4f72a56a1166072b20731b0083 (patch)
treea6d276701c4ae1dcf9fb544f3b67abc7ec7d738e /lib/private/server.php
parent99415a9f7fa26a990848c2cb63333552c1619729 (diff)
downloadnextcloud-server-be380accb90d0a4f72a56a1166072b20731b0083.tar.gz
nextcloud-server-be380accb90d0a4f72a56a1166072b20731b0083.zip
clear mount cache when deleting user
Diffstat (limited to 'lib/private/server.php')
-rw-r--r--lib/private/server.php48
1 files changed, 31 insertions, 17 deletions
diff --git a/lib/private/server.php b/lib/private/server.php
index e3a303b84eb..9a1f8548b93 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -48,6 +48,7 @@ use OC\Diagnostics\NullEventLogger;
use OC\Diagnostics\NullQueryLogger;
use OC\Diagnostics\QueryLogger;
use OC\Files\Config\UserMountCache;
+use OC\Files\Config\UserMountCacheListener;
use OC\Files\Node\HookConnector;
use OC\Files\Node\Root;
use OC\Files\View;
@@ -137,7 +138,7 @@ class Server extends ServerContainer implements IServerContainer {
return new Encryption\Keys\Storage($view, $util);
});
- $this->registerService('TagMapper', function(Server $c) {
+ $this->registerService('TagMapper', function (Server $c) {
return new TagMapper($c->getDatabaseConnection());
});
$this->registerService('TagManager', function (Server $c) {
@@ -266,13 +267,13 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig();
- if($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
+ if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
$v = \OC_App::getAppVersions();
$v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
$version = implode(',', $v);
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
- $prefix = md5($instanceId.'-'.$version.'-'.$path);
+ $prefix = md5($instanceId . '-' . $version . '-' . $path);
return new \OC\Memcache\Factory($prefix, $c->getLogger(),
$config->getSystemValue('memcache.local', null),
$config->getSystemValue('memcache.distributed', null),
@@ -383,7 +384,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig()
);
});
- $this->registerService('AppManager', function(Server $c) {
+ $this->registerService('AppManager', function (Server $c) {
return new \OC\App\AppManager(
$c->getUserSession(),
$c->getAppConfig(),
@@ -391,13 +392,13 @@ class Server extends ServerContainer implements IServerContainer {
$c->getMemCacheFactory()
);
});
- $this->registerService('DateTimeZone', function(Server $c) {
+ $this->registerService('DateTimeZone', function (Server $c) {
return new DateTimeZone(
$c->getConfig(),
$c->getSession()
);
});
- $this->registerService('DateTimeFormatter', function(Server $c) {
+ $this->registerService('DateTimeFormatter', function (Server $c) {
$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
return new DateTimeFormatter(
@@ -405,9 +406,15 @@ class Server extends ServerContainer implements IServerContainer {
$c->getL10N('lib', $language)
);
});
+ $this->registerService('UserMountCache', function (Server $c) {
+ $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
+ $listener = new UserMountCacheListener($mountCache);
+ $listener->listen($c->getUserManager());
+ return $mountCache;
+ });
$this->registerService('MountConfigManager', function (Server $c) {
$loader = \OC\Files\Filesystem::getLoader();
- $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
+ $mountCache = $c->query('UserMountCache');
return new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
});
$this->registerService('IniWrapper', function ($c) {
@@ -480,14 +487,14 @@ class Server extends ServerContainer implements IServerContainer {
$stream
);
});
- $this->registerService('Mailer', function(Server $c) {
+ $this->registerService('Mailer', function (Server $c) {
return new Mailer(
$c->getConfig(),
$c->getLogger(),
new \OC_Defaults()
);
});
- $this->registerService('OcsClient', function(Server $c) {
+ $this->registerService('OcsClient', function (Server $c) {
return new OCSClient(
$this->getHTTPClientService(),
$this->getConfig(),
@@ -509,24 +516,24 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('MountManager', function () {
return new \OC\Files\Mount\Manager();
});
- $this->registerService('MimeTypeDetector', function(Server $c) {
+ $this->registerService('MimeTypeDetector', function (Server $c) {
return new \OC\Files\Type\Detection(
$c->getURLGenerator(),
\OC::$SERVERROOT . '/config/',
\OC::$SERVERROOT . '/resources/config/'
- );
+ );
});
- $this->registerService('MimeTypeLoader', function(Server $c) {
+ $this->registerService('MimeTypeLoader', function (Server $c) {
return new \OC\Files\Type\Loader(
$c->getDatabaseConnection()
);
});
- $this->registerService('NotificationManager', function() {
+ $this->registerService('NotificationManager', function () {
return new Manager();
});
$this->registerService('CapabilitiesManager', function (Server $c) {
$manager = new \OC\CapabilitiesManager();
- $manager->registerCapability(function() use ($c) {
+ $manager->registerCapability(function () use ($c) {
return new \OC\OCS\CoreCapabilities($c->getConfig());
});
return $manager;
@@ -538,7 +545,7 @@ class Server extends ServerContainer implements IServerContainer {
$factory = new $factoryClass();
return $factory->getManager();
});
- $this->registerService('EventDispatcher', function() {
+ $this->registerService('EventDispatcher', function () {
return new EventDispatcher();
});
$this->registerService('CryptoWrapper', function (Server $c) {
@@ -923,6 +930,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Returns an instance of the db facade
+ *
* @deprecated use getDatabaseConnection, will be removed in ownCloud 10
* @return \OCP\IDb
*/
@@ -932,6 +940,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Returns an instance of the HTTP helper class
+ *
* @deprecated Use getHTTPClientService()
* @return \OC\HTTPHelper
*/
@@ -1057,7 +1066,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* @return \OCP\Files\Config\IMountProviderCollection
*/
- public function getMountProviderCollection(){
+ public function getMountProviderCollection() {
return $this->query('MountConfigManager');
}
@@ -1073,7 +1082,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* @return \OCP\Command\IBus
*/
- public function getCommandBus(){
+ public function getCommandBus() {
return $this->query('AsyncCommandBus');
}
@@ -1173,6 +1182,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Not a public API as of 8.2, wait for 9.0
+ *
* @return \OCA\Files_External\Service\BackendService
*/
public function getStoragesBackendService() {
@@ -1181,6 +1191,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Not a public API as of 8.2, wait for 9.0
+ *
* @return \OCA\Files_External\Service\GlobalStoragesService
*/
public function getGlobalStoragesService() {
@@ -1189,6 +1200,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Not a public API as of 8.2, wait for 9.0
+ *
* @return \OCA\Files_External\Service\UserGlobalStoragesService
*/
public function getUserGlobalStoragesService() {
@@ -1197,6 +1209,7 @@ class Server extends ServerContainer implements IServerContainer {
/**
* Not a public API as of 8.2, wait for 9.0
+ *
* @return \OCA\Files_External\Service\UserStoragesService
*/
public function getUserStoragesService() {
@@ -1210,4 +1223,5 @@ class Server extends ServerContainer implements IServerContainer {
public function getShareManager() {
return $this->query('ShareManager');
}
+
}