From f2e70441e42a17b27248b93a05b0008717b124b1 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 27 Jan 2016 14:48:52 +0100 Subject: [PATCH] [Share 2.0] Add getShareManager to OCP\IServerContainer --- .../appframework/dependencyinjection/dicontainer.php | 4 ++++ lib/private/server.php | 3 +-- lib/public/iservercontainer.php | 8 ++++++++ tests/lib/server.php | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index 175d6c747e4..61a04482431 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -227,6 +227,10 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getSecureRandom(); }); + $this->registerService('OCP\\Share\\IManager', function($c) { + return $this->getServer()->getShareManager(); + }); + $this->registerService('OCP\\SystemTag\\ISystemTagManager', function() { return $this->getServer()->getSystemTagManager(); }); diff --git a/lib/private/server.php b/lib/private/server.php index 4f731300baf..d453a42d3a0 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -1256,9 +1256,8 @@ class Server extends ServerContainer implements IServerContainer { return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\UserStoragesService'); } - /** - * @return \OC\Share20\Manager + * @return \OCP\Share\IManager */ public function getShareManager() { return $this->query('ShareManager'); diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index e21c9fb8e4b..ce1364cc4ea 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -504,4 +504,12 @@ interface IServerContainer { * @since 9.0.0 */ public function getSystemTagObjectMapper(); + + /** + * Returns the share manager + * + * @return \OCP\Share\IManager + * @since 9.0.0 + */ + public function getShareManager(); } diff --git a/tests/lib/server.php b/tests/lib/server.php index 91beea7c2f8..8b2fec1f5a1 100644 --- a/tests/lib/server.php +++ b/tests/lib/server.php @@ -139,6 +139,8 @@ class Server extends \Test\TestCase { ['Search', '\OCP\ISearch'], ['SecureRandom', '\OC\Security\SecureRandom'], ['SecureRandom', '\OCP\Security\ISecureRandom'], + ['ShareManager', '\OC\Share20\Manager'], + ['ShareManager', '\OCP\Share\IManager'], ['SystemConfig', '\OC\SystemConfig'], ['URLGenerator', '\OC\URLGenerator'], -- 2.39.5