Merge pull request #9150 from owncloud/remoteshare-fixsetuporder

Setup the external share manager in a hook
This commit is contained in:
Frank Karlitschek 2014-06-23 07:29:20 -04:00
commit 65e4348080
2 changed files with 12 additions and 9 deletions

View File

@ -14,15 +14,8 @@ OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
\OCP\App::registerAdmin('files_sharing', 'settings-admin'); \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', '\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('file', 'OC_Share_Backend_File');
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');

View 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 // 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 // FIXME no longer needed if we use the webdav implementation from core
if (\OC_App::isEnabled('files_external') === false) { 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) { protected function stripPath($path) {
$prefix = '/' . $this->userSession->getUser()->getUID() . '/files'; $prefix = '/' . $this->userSession->getUser()->getUID() . '/files';
return rtrim(substr($path, strlen($prefix)), '/'); return rtrim(substr($path, strlen($prefix)), '/');