]> source.dussan.org Git - nextcloud-server.git/commitdiff
Setup the external share manager in a hook
authorVincent Petry <pvince81@owncloud.com>
Mon, 23 Jun 2014 09:57:43 +0000 (11:57 +0200)
committerVincent Petry <pvince81@owncloud.com>
Mon, 23 Jun 2014 09:57:43 +0000 (11:57 +0200)
To make sure the external shares are initialized in the right order and
make sure the session is correctly initialized before, the external
share manager is now set up in a filesystem setup hook.

apps/files_sharing/appinfo/app.php
apps/files_sharing/lib/external/manager.php

index a9f4ff5089b5da195438a7f1ee91cabaa54caa16..a4a0a57c6750f3c0bd35687ed165221117c28a6b 100644 (file)
@@ -14,15 +14,8 @@ OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
 
 \OCP\App::registerAdmin('files_sharing', 'settings-admin');
 
-$externalManager = new \OCA\Files_Sharing\External\Manager(
-       \OC::$server->getDatabaseConnection(),
-       \OC\Files\Filesystem::getMountManager(),
-       \OC\Files\Filesystem::getLoader(),
-       \OC::$server->getUserSession()
-);
-$externalManager->setup();
-
 OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
+OCP\Util::connectHook('OC_Filesystem', 'setup', '\OCA\Files_Sharing\External\Manager', 'setup');
 OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
 OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
 
index 70a0e98ebd57b54043f5bbba662d240d541f41e4..4441a72fb16cda03552a2267f2a3ffb3b5fb7af2 100644 (file)
@@ -67,7 +67,7 @@ class Manager {
                }
        }
 
-       public function setup() {
+       private function setupMounts() {
                // don't setup server-to-server shares if the file_external app is disabled
                // FIXME no longer needed if we use the webdav implementation from  core
                if (\OC_App::isEnabled('files_external') === false) {
@@ -88,6 +88,16 @@ class Manager {
                }
        }
 
+       public static function setup() {
+               $externalManager = new \OCA\Files_Sharing\External\Manager(
+                       \OC::$server->getDatabaseConnection(),
+                       \OC\Files\Filesystem::getMountManager(),
+                       \OC\Files\Filesystem::getLoader(),
+                       \OC::$server->getUserSession()
+               );
+               $externalManager->setupMounts();
+       }
+
        protected function stripPath($path) {
                $prefix = '/' . $this->userSession->getUser()->getUID() . '/files';
                return rtrim(substr($path, strlen($prefix)), '/');