diff options
Diffstat (limited to 'apps/federation/lib/BackgroundJob/GetSharedSecret.php')
-rw-r--r-- | apps/federation/lib/BackgroundJob/GetSharedSecret.php | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 761ad951e73..d679fcb6aa3 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -34,6 +34,7 @@ use OCA\Federation\TrustedServers; use OCP\AppFramework\Http; use OCP\BackgroundJob\IJobList; use OCP\Http\Client\IClient; +use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; use OCP\ILogger; use OCP\IURLGenerator; @@ -82,7 +83,7 @@ class GetSharedSecret extends Job{ /** * RequestSharedSecret constructor. * - * @param IClient $httpClient + * @param IClientService $httpClientService * @param IURLGenerator $urlGenerator * @param IJobList $jobList * @param TrustedServers $trustedServers @@ -91,33 +92,21 @@ class GetSharedSecret extends Job{ * @param IDiscoveryService $ocsDiscoveryService */ public function __construct( - IClient $httpClient = null, - IURLGenerator $urlGenerator = null, - IJobList $jobList = null, - TrustedServers $trustedServers = null, - ILogger $logger = null, - DbHandler $dbHandler = null, - IDiscoveryService $ocsDiscoveryService = null + IClientService $httpClientService, + IURLGenerator $urlGenerator, + IJobList $jobList, + TrustedServers $trustedServers, + ILogger $logger, + DbHandler $dbHandler, + IDiscoveryService $ocsDiscoveryService ) { - $this->logger = $logger ? $logger : \OC::$server->getLogger(); - $this->httpClient = $httpClient ? $httpClient : \OC::$server->getHTTPClientService()->newClient(); - $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->query(\OCP\OCS\IDiscoveryService::class); - if ($trustedServers) { - $this->trustedServers = $trustedServers; - } else { - $this->trustedServers = new TrustedServers( - $this->dbHandler, - \OC::$server->getHTTPClientService(), - $this->logger, - $this->jobList, - \OC::$server->getSecureRandom(), - \OC::$server->getConfig(), - \OC::$server->getEventDispatcher() - ); - } + $this->logger = $logger; + $this->httpClient = $httpClientService->newClient(); + $this->jobList = $jobList; + $this->urlGenerator = $urlGenerator; + $this->dbHandler = $dbHandler; + $this->ocsDiscoveryService = $ocsDiscoveryService; + $this->trustedServers = $trustedServers; } /** |