Do not load calendar/addressbook plugins if not needed
Fixes #6711
Based on f0fb21cf35
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
9e00b51c87
commit
c5d5c7dc12
|
@ -78,7 +78,6 @@ class Server {
|
||||||
$this->baseUri = $baseUri;
|
$this->baseUri = $baseUri;
|
||||||
$logger = \OC::$server->getLogger();
|
$logger = \OC::$server->getLogger();
|
||||||
$dispatcher = \OC::$server->getEventDispatcher();
|
$dispatcher = \OC::$server->getEventDispatcher();
|
||||||
$sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes';
|
|
||||||
|
|
||||||
$root = new RootCollection();
|
$root = new RootCollection();
|
||||||
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
|
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
|
||||||
|
@ -137,10 +136,11 @@ class Server {
|
||||||
$this->server->addPlugin($acl);
|
$this->server->addPlugin($acl);
|
||||||
|
|
||||||
// calendar plugins
|
// calendar plugins
|
||||||
|
if ($this->requestIsForSubtree('calendars')) {
|
||||||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
|
||||||
$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
|
$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
|
||||||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
|
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin());
|
||||||
if ($sendInvitations) {
|
if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
|
||||||
$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
|
$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
|
||||||
}
|
}
|
||||||
$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
|
$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin());
|
||||||
|
@ -150,11 +150,14 @@ class Server {
|
||||||
\OC::$server->getConfig(),
|
\OC::$server->getConfig(),
|
||||||
\OC::$server->getURLGenerator()
|
\OC::$server->getURLGenerator()
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// addressbook plugins
|
// addressbook plugins
|
||||||
|
if ($this->requestIsForSubtree('addressbooks')) {
|
||||||
$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
|
$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
|
||||||
$this->server->addPlugin(new VCFExportPlugin());
|
$this->server->addPlugin(new VCFExportPlugin());
|
||||||
$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
|
$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache'))));
|
||||||
|
}
|
||||||
|
|
||||||
// system tags plugins
|
// system tags plugins
|
||||||
$this->server->addPlugin(new SystemTagPlugin(
|
$this->server->addPlugin(new SystemTagPlugin(
|
||||||
|
@ -280,4 +283,13 @@ class Server {
|
||||||
public function exec() {
|
public function exec() {
|
||||||
$this->server->exec();
|
$this->server->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $subTree
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function requestIsForSubtree($subTree) {
|
||||||
|
$subTree = trim($subTree, " /");
|
||||||
|
return strpos($this->server->getRequestUri(), "$subTree/") === 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue