summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/appinfo
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/appinfo')
-rw-r--r--apps/files_sharing/appinfo/app.php37
-rw-r--r--apps/files_sharing/appinfo/application.php51
-rw-r--r--apps/files_sharing/appinfo/routes.php3
3 files changed, 73 insertions, 18 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index d009fbca3b9..19d3b6cd9cc 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -25,31 +25,38 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+namespace OCA\Files_Sharing\Appinfo;
+
$l = \OC::$server->getL10N('files_sharing');
-OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
-OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
-OC::$CLASSPATH['OC\Files\Storage\Shared'] = 'files_sharing/lib/sharedstorage.php';
-OC::$CLASSPATH['OC\Files\Cache\SharedScanner'] = 'files_sharing/lib/scanner.php';
-OC::$CLASSPATH['OC\Files\Cache\Shared_Cache'] = 'files_sharing/lib/cache.php';
-OC::$CLASSPATH['OC\Files\Cache\Shared_Permissions'] = 'files_sharing/lib/permissions.php';
-OC::$CLASSPATH['OC\Files\Cache\Shared_Updater'] = 'files_sharing/lib/updater.php';
-OC::$CLASSPATH['OC\Files\Cache\Shared_Watcher'] = 'files_sharing/lib/watcher.php';
-OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
-OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
+\OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
+\OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
+\OC::$CLASSPATH['OC\Files\Storage\Shared'] = 'files_sharing/lib/sharedstorage.php';
+\OC::$CLASSPATH['OC\Files\Cache\SharedScanner'] = 'files_sharing/lib/scanner.php';
+\OC::$CLASSPATH['OC\Files\Cache\Shared_Cache'] = 'files_sharing/lib/cache.php';
+\OC::$CLASSPATH['OC\Files\Cache\Shared_Permissions'] = 'files_sharing/lib/permissions.php';
+\OC::$CLASSPATH['OC\Files\Cache\Shared_Updater'] = 'files_sharing/lib/updater.php';
+\OC::$CLASSPATH['OC\Files\Cache\Shared_Watcher'] = 'files_sharing/lib/watcher.php';
+\OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
+\OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
// Exceptions
-OC::$CLASSPATH['OCA\Files_Sharing\Exceptions\BrokenPath'] = 'files_sharing/lib/exceptions.php';
+\OC::$CLASSPATH['OCA\Files_Sharing\Exceptions\BrokenPath'] = 'files_sharing/lib/exceptions.php';
+
+$application = new Application();
+$application->registerMountProviders();
+$application->setupPropagation();
\OCP\App::registerAdmin('files_sharing', 'settings-admin');
\OCA\Files_Sharing\Helper::registerHooks();
-OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
-OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
+\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
+\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
-OCP\Util::addScript('files_sharing', 'share');
-OCP\Util::addScript('files_sharing', 'external');
+\OCP\Util::addScript('files_sharing', 'share');
+\OCP\Util::addScript('files_sharing', 'external');
// FIXME: registering a job here will cause additional useless SQL queries
// when the route is not cron.php, needs a better way
diff --git a/apps/files_sharing/appinfo/application.php b/apps/files_sharing/appinfo/application.php
new file mode 100644
index 00000000000..6848c9e8363
--- /dev/null
+++ b/apps/files_sharing/appinfo/application.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA\Files_Sharing\Appinfo;
+
+use OCA\Files_Sharing\MountProvider;
+use OCA\Files_Sharing\Propagation\PropagationManager;
+use OCP\AppFramework\App;
+use \OCP\IContainer;
+
+class Application extends App {
+ public function __construct(array $urlParams = array()) {
+ parent::__construct('files_sharing', $urlParams);
+ $container = $this->getContainer();
+
+ $container->registerService('MountProvider', function (IContainer $c) {
+ /** @var \OCP\IServerContainer $server */
+ $server = $c->query('ServerContainer');
+ return new MountProvider(
+ $server->getConfig(),
+ $c->query('PropagationManager')
+ );
+ });
+
+ $container->registerService('PropagationManager', function (IContainer $c) {
+ /** @var \OCP\IServerContainer $server */
+ $server = $c->query('ServerContainer');
+ return new PropagationManager(
+ $server->getUserSession(),
+ $server->getConfig()
+ );
+ });
+ }
+
+ public function registerMountProviders() {
+ /** @var \OCP\IServerContainer $server */
+ $server = $this->getContainer()->query('ServerContainer');
+ $mountProviderCollection = $server->getMountProviderCollection();
+ $mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
+ }
+
+ public function setupPropagation() {
+ $propagationManager = $this->getContainer()->query('PropagationManager');
+ \OCP\Util::connectHook('OC_Filesystem', 'setup', $propagationManager, 'globalSetup');
+ }
+}
diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php
index 9ac3a1f731a..db4566eb612 100644
--- a/apps/files_sharing/appinfo/routes.php
+++ b/apps/files_sharing/appinfo/routes.php
@@ -25,9 +25,6 @@
*/
namespace OCA\Files_Sharing\AppInfo;
-use OCA\Files_Sharing\Application;
-use OCP\API;
-
$application = new Application();
$application->registerRoutes($this, [
'resources' => [