diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-02-25 16:23:09 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-02-25 16:23:09 +0100 |
commit | 3a21755963d8d9897a48ab58292345c0b710e239 (patch) | |
tree | f6b8fd3065a03f2c5627b4f0d89c4b51d69c5c42 /apps/files/appinfo/remote.php | |
parent | 9b4af31bac977cb788a6f4a013d32ba0a21437f0 (diff) | |
download | nextcloud-server-3a21755963d8d9897a48ab58292345c0b710e239.tar.gz nextcloud-server-3a21755963d8d9897a48ab58292345c0b710e239.zip |
Pass the filesystem view as argument in the sabredav connectors and use the fileinfo object
Diffstat (limited to 'apps/files/appinfo/remote.php')
-rw-r--r-- | apps/files/appinfo/remote.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index ef22fe92188..1922bc4fcdd 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -34,12 +34,8 @@ $authBackend = new OC_Connector_Sabre_Auth(); $lockBackend = new OC_Connector_Sabre_Locks(); $requestBackend = new OC_Connector_Sabre_Request(); -// Create ownCloud Dir -$rootDir = new OC_Connector_Sabre_Directory(''); -$objectTree = new \OC\Connector\Sabre\ObjectTree($rootDir); - // Fire up server -$server = new OC_Connector_Sabre_Server($objectTree); +$server = new OC_Connector_Sabre_Server(); $server->httpRequest = $requestBackend; $server->setBaseUri($baseuri); @@ -49,10 +45,22 @@ $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName()) $server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend)); $server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload $server->addPlugin(new OC_Connector_Sabre_FilesPlugin()); -$server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin()); -$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin()); $server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin()); $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav')); +// wait with registering these until auth is handled and the filesystem is setup +$server->subscribeEvent('beforeMethod', function () use ($server) { + $view = \OC\Files\Filesystem::getView(); + $rootInfo = $view->getFileInfo(''); + + // Create ownCloud Dir + $rootDir = new OC_Connector_Sabre_Directory($view, $rootInfo); + $objectTree = new \OC\Connector\Sabre\ObjectTree($rootDir, $view); + $server->setObjectTree($objectTree); + + $server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view)); + $server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view)); +}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request + // And off we go! $server->exec(); |