diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index daeb049a31e8533bc7c7cdcd704d127e2ef98bae..9d8464e37d5bd1dbad14dfd399cf4058c0bf6f6d 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -51,7 +51,7 @@ class Application extends App { $notification = new Notifications( $addressHandler, $server->getHTTPClientService(), - $server->getOCSDiscoveryService(), + $server->query(\OCP\OCS\IDiscoveryService::class), \OC::$server->getJobList() ); return new RequestHandlerController( @@ -99,7 +99,7 @@ class Application extends App { $notifications = new \OCA\FederatedFileSharing\Notifications( $addressHandler, \OC::$server->getHTTPClientService(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), \OC::$server->getJobList() ); $tokenHandler = new \OCA\FederatedFileSharing\TokenHandler( diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index 8d81d56802dc40b72f6e88afa9ef2b11b6727e03..821647e5e395eebd7db28955eece4ce0b377963e 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -70,7 +70,7 @@ class RetryJob extends Job { $this->notifications = new Notifications( $addressHandler, \OC::$server->getHTTPClientService(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), \OC::$server->getJobList() ); } diff --git a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php index d20018f38a37bca112e5b0d1288a2923908f1360..d7e466d1a64570264e02bbcfd03cb592dfe44a3f 100644 --- a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php +++ b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php @@ -254,7 +254,7 @@ class MountPublicLinkController extends Controller { Filesystem::getLoader(), \OC::$server->getHTTPClientService(), \OC::$server->getNotificationManager(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), \OC::$server->getUserSession()->getUser()->getUID() ); diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index fa212680225be5b32242de04f587084c92dad890..2b643810fb4a5b99b0e325aed253b55f7011f9ff 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -158,7 +158,7 @@ class RequestHandlerController extends OCSController { \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPClientService(), \OC::$server->getNotificationManager(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), $shareWith ); diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index c695fb140e53189ad4cc9c30e87f215c3b2300b8..512000181c1c7c9051fca8a8fbc790175dfc6690 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -276,7 +276,7 @@ class RequestHandlerControllerTest extends TestCase { Filesystem::getLoader(), $httpClientService, \OC::$server->getNotificationManager(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), $toDelete ); diff --git a/apps/federation/lib/AppInfo/Application.php b/apps/federation/lib/AppInfo/Application.php index e76a8f850c863a9849dffb6b46291ceaa16b3a95..3166316b1080ab943e91279dfb2ed70034320f3f 100644 --- a/apps/federation/lib/AppInfo/Application.php +++ b/apps/federation/lib/AppInfo/Application.php @@ -135,7 +135,7 @@ class Application extends \OCP\AppFramework\App { public function getSyncService() { $syncService = \OC::$server->query('CardDAVSyncService'); $dbHandler = $this->getContainer()->query('DbHandler'); - $discoveryService = \OC::$server->getOCSDiscoveryService(); + $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); return new SyncFederationAddressBooks($dbHandler, $syncService, $discoveryService); } diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 8262297890884f2e3e4d234bf65e3e7c4dd1b480..b25c51afd0e9b53557537c0e8a4c2b0851920e67 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -101,7 +101,7 @@ class GetSharedSecret extends Job{ $this->jobList = $jobList ? $jobList : \OC::$server->getJobList(); $this->urlGenerator = $urlGenerator ? $urlGenerator : \OC::$server->getURLGenerator(); $this->dbHandler = $dbHandler ? $dbHandler : new DbHandler(\OC::$server->getDatabaseConnection(), \OC::$server->getL10N('federation')); - $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->getOCSDiscoveryService(); + $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->query(\OCP\OCS\IDiscoveryService::class); if ($trustedServers) { $this->trustedServers = $trustedServers; } else { diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index 6687b080bb074548ff5ad123b47ffb83893ed4c8..1587a3b16e95be054f3c19a96eb21618a521c758 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -99,7 +99,7 @@ class RequestSharedSecret extends Job { $this->urlGenerator = $urlGenerator ? $urlGenerator : \OC::$server->getURLGenerator(); $this->dbHandler = $dbHandler ? $dbHandler : new DbHandler(\OC::$server->getDatabaseConnection(), \OC::$server->getL10N('federation')); $this->logger = \OC::$server->getLogger(); - $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->getOCSDiscoveryService(); + $this->ocsDiscoveryService = $ocsDiscoveryService ? $ocsDiscoveryService : \OC::$server->query(\OCP\OCS\IDiscoveryService::class); if ($trustedServers) { $this->trustedServers = $trustedServers; } else { diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index d4e83ce5d6bfc584022ccc45dd716b80b557a11e..f502d905fe81a48f83a7a6dfee8ff61cea8f8be5 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -98,7 +98,7 @@ class Application extends App { \OC\Files\Filesystem::getLoader(), $server->getHTTPClientService(), $server->getNotificationManager(), - $server->getOCSDiscoveryService(), + $server->query(\OCP\OCS\IDiscoveryService::class), $uid ); }); diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 7e0f1fd0b758f23ce8c45d0fc336a3452c533ec1..12ee3265c2ae63cd38dde8552e354c2013035fd8 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -65,7 +65,7 @@ class Storage extends DAV implements ISharedStorage { $this->manager = $options['manager']; $this->cloudId = $options['cloudId']; - $discoveryService = \OC::$server->getOCSDiscoveryService(); + $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); list($protocol, $remote) = explode('://', $this->cloudId->getRemote()); if (strpos($remote, '/')) { diff --git a/apps/files_sharing/lib/Hooks.php b/apps/files_sharing/lib/Hooks.php index 8c5fc6a8d6a3e19d1207bd601bde2f3a48ef6613..821c3046595546788d38c08fed4eb713b7a2ec7f 100644 --- a/apps/files_sharing/lib/Hooks.php +++ b/apps/files_sharing/lib/Hooks.php @@ -38,7 +38,7 @@ class Hooks { \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPClientService(), \OC::$server->getNotificationManager(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), $params['uid']); $manager->removeUserShares($params['uid']); diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index efe4065e3833ceed7f92818a05e8414ed8060276..9f60261c203349c21e6772f3ac116f669f3ce941 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -77,7 +77,7 @@ class ManagerTest extends TestCase { new StorageFactory(), $this->clientService, \OC::$server->getNotificationManager(), - \OC::$server->getOCSDiscoveryService(), + \OC::$server->query(\OCP\OCS\IDiscoveryService::class), $this->uid ); $this->testMountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function() { diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 4b72c2c9e3e50dd416918c82f6246f2a4351ed6c..4fb13b09ae0647f472e3a1d98ec0b6e45a0364c5 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -56,8 +56,6 @@ use OCP\IL10N; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserSession; -use OCP\Files\Mount\IMountManager; -use OCP\OCS\IDiscoveryService; use OCP\RichObjectStrings\IValidator; use OCP\Util; @@ -139,13 +137,6 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $c; }); - $this->registerService(IMountManager::class, function () { - return $this->getServer()->getMountManager(); - }); - $this->registerService(IDiscoveryService::class, function($c) { - return $this->getServer()->getOCSDiscoveryService(); - }); - // commonly used attributes $this->registerService('UserId', function ($c) { return $c->query('OCP\\IUserSession')->getSession()->get('user_id'); diff --git a/lib/private/Server.php b/lib/private/Server.php index 13387ebd3ed6d9e4d1003e5dbfbdc77e4866ae6f..67075076801bded5f110d59782660321a4472c54 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -937,7 +937,7 @@ class Server extends ServerContainer implements IServerContainer { }); }); - $this->registerService('OCSDiscoveryService', function (Server $c) { + $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); }); @@ -1001,14 +1001,6 @@ class Server extends ServerContainer implements IServerContainer { return $this->query('EncryptionKeyStorage'); } - /** - * @return \OC\OCS\DiscoveryService - */ - public function getOCSDiscoveryService() { - return $this->query('OCSDiscoveryService'); - } - - /** * The current request object holding all information about the request * currently being processed is returned from this method. diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 2b4a57b89a449982d803ceb1cc449b1804b1bbab..b3e4cb2d4aa5fac7985428ef699af24a205ab185 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -2742,7 +2742,7 @@ class Share extends Constants { 'result' => '', ]; $try = 0; - $discoveryService = \OC::$server->getOCSDiscoveryService(); + $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); while ($result['success'] === false && $try < 2) { $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 5eb34a483e7af35ab14a58531855504f58aff942..ba6699ae7ad805228152f321468ae41886820aab 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -107,7 +107,7 @@ class ProviderFactory implements IProviderFactory { $notifications = new Notifications( $addressHandler, $this->serverContainer->getHTTPClientService(), - $this->serverContainer->getOCSDiscoveryService(), + $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), $this->serverContainer->getJobList() ); $tokenHandler = new TokenHandler( diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php index 4d084aae79ef35f5bf6317ad273d9cc034b9514b..8c74c05d8017a7c36b24ac35027b3ea88d6008d9 100644 --- a/lib/public/IServerContainer.php +++ b/lib/public/IServerContainer.php @@ -531,10 +531,4 @@ interface IServerContainer extends IContainer { * @since 12.0.0 */ public function getCloudIdManager(); - - /** - * @return \OC\OCS\DiscoveryService - * @since 12.0.0 - */ - public function getOCSDiscoveryService(); }