aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Avatars/RootCollection.php3
-rw-r--r--apps/user_ldap/lib/Jobs/Sync.php2
-rw-r--r--apps/user_ldap/tests/Integration/AbstractIntegrationTest.php3
-rw-r--r--apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php11
-rw-r--r--build/integration/features/bootstrap/RemoteContext.php5
-rw-r--r--lib/private/Files/Storage/DAV.php2
-rw-r--r--lib/private/Mail/Mailer.php2
-rw-r--r--lib/private/Share20/ProviderFactory.php8
-rw-r--r--lib/private/legacy/OC_Util.php5
-rw-r--r--lib/public/Contacts/IManager.php2
-rw-r--r--lib/public/Mail/IMailer.php2
-rw-r--r--lib/public/Util.php3
-rw-r--r--tests/lib/InstallerTest.php6
13 files changed, 31 insertions, 23 deletions
diff --git a/apps/dav/lib/Avatars/RootCollection.php b/apps/dav/lib/Avatars/RootCollection.php
index 1f05274944c..d7cdb92c6be 100644
--- a/apps/dav/lib/Avatars/RootCollection.php
+++ b/apps/dav/lib/Avatars/RootCollection.php
@@ -6,6 +6,7 @@
*/
namespace OCA\DAV\Avatars;
+use OCP\IAvatarManager;
use Sabre\DAVACL\AbstractPrincipalCollection;
class RootCollection extends AbstractPrincipalCollection {
@@ -21,7 +22,7 @@ class RootCollection extends AbstractPrincipalCollection {
* @return AvatarHome
*/
public function getChildForPrincipal(array $principalInfo) {
- $avatarManager = \OC::$server->getAvatarManager();
+ $avatarManager = \OC::$server->get(IAvatarManager::class);
return new AvatarHome($principalInfo, $avatarManager);
}
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php
index 16371df1562..0f9e8e3be93 100644
--- a/apps/user_ldap/lib/Jobs/Sync.php
+++ b/apps/user_ldap/lib/Jobs/Sync.php
@@ -319,7 +319,7 @@ class Sync extends TimedJob {
if (isset($argument['avatarManager'])) {
$this->avatarManager = $argument['avatarManager'];
} else {
- $this->avatarManager = \OC::$server->getAvatarManager();
+ $this->avatarManager = \OC::$server->get(IAvatarManager::class);
}
if (isset($argument['dbc'])) {
diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
index 5ec04484bef..7cc1ab62a7d 100644
--- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
+++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
@@ -35,6 +35,7 @@ use OCA\User_LDAP\Helper;
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\UserPluginManager;
+use OCP\IAvatarManager;
use OCP\Share\IManager;
use Psr\Log\LoggerInterface;
@@ -124,7 +125,7 @@ abstract class AbstractIntegrationTest {
\OC::$server->getConfig(),
new FilesystemHelper(),
\OC::$server->get(LoggerInterface::class),
- \OC::$server->getAvatarManager(),
+ \OC::$server->get(IAvatarManager::class),
new \OCP\Image(),
\OC::$server->getUserManager(),
\OC::$server->getNotificationManager(),
diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
index c5b7f73bbcc..d6fb512010b 100644
--- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
+++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
@@ -35,6 +35,7 @@ use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\User;
use OCA\User_LDAP\User_LDAP;
use OCA\User_LDAP\UserPluginManager;
+use OCP\IAvatarManager;
use OCP\Image;
use Psr\Log\LoggerInterface;
@@ -78,8 +79,8 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
\OC_Util::setupFS($username);
\OC::$server->getUserFolder($username);
\OC::$server->getConfig()->deleteUserValue($username, 'user_ldap', User::USER_PREFKEY_LASTREFRESH);
- if (\OC::$server->getAvatarManager()->getAvatar($username)->exists()) {
- \OC::$server->getAvatarManager()->getAvatar($username)->remove();
+ if (\OC::$server->get(IAvatarManager::class)->getAvatar($username)->exists()) {
+ \OC::$server->get(IAvatarManager::class)->getAvatar($username)->remove();
}
// finally attempt to get the avatar set
@@ -99,7 +100,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
$this->execFetchTest($dn, $username, $image);
- return \OC::$server->getAvatarManager()->getAvatar($username)->exists();
+ return \OC::$server->get(IAvatarManager::class)->getAvatar($username)->exists();
}
/**
@@ -116,7 +117,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
$this->execFetchTest($dn, $username, $image);
- return !\OC::$server->getAvatarManager()->getAvatar($username)->exists();
+ return !\OC::$server->get(IAvatarManager::class)->getAvatar($username)->exists();
}
/**
@@ -136,7 +137,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
\OC::$server->getConfig(),
new FilesystemHelper(),
\OC::$server->get(LoggerInterface::class),
- \OC::$server->getAvatarManager(),
+ \OC::$server->get(IAvatarManager::class),
new Image(),
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager(),
diff --git a/build/integration/features/bootstrap/RemoteContext.php b/build/integration/features/bootstrap/RemoteContext.php
index 8c6708c4c37..b1605e4da25 100644
--- a/build/integration/features/bootstrap/RemoteContext.php
+++ b/build/integration/features/bootstrap/RemoteContext.php
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Behat\Behat\Context\Context;
+use OCP\Http\Client\IClientService;
use PHPUnit\Framework\Assert;
require __DIR__ . '/../../vendor/autoload.php';
@@ -31,7 +32,7 @@ class RemoteContext implements Context {
}
protected function getApiClient() {
- return new \OC\Remote\Api\OCS($this->remoteInstance, $this->credentails, \OC::$server->getHTTPClientService());
+ return new \OC\Remote\Api\OCS($this->remoteInstance, $this->credentails, \OC::$server->get(IClientService::class));
}
/**
@@ -47,7 +48,7 @@ class RemoteContext implements Context {
}
$this->lastException = null;
try {
- $this->remoteInstance = new \OC\Remote\Instance($baseUri, \OC::$server->getMemCacheFactory()->createLocal(), \OC::$server->getHTTPClientService());
+ $this->remoteInstance = new \OC\Remote\Instance($baseUri, \OC::$server->getMemCacheFactory()->createLocal(), \OC::$server->get(IClientService::class));
// trigger the status request
$this->remoteInstance->getProtocol();
} catch (\Exception $e) {
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 50e0dd5271a..63ef1399a69 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -86,7 +86,7 @@ class DAV extends Common {
*/
public function __construct($params) {
$this->statCache = new ArrayCache();
- $this->httpClientService = \OC::$server->getHTTPClientService();
+ $this->httpClientService = \OC::$server->get(IClientService::class);
if (isset($params['host']) && isset($params['user']) && isset($params['password'])) {
$host = $params['host'];
//remove leading http[s], will be generated in createBaseUri()
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index c4e89df7304..041ab8b0ff7 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -38,7 +38,7 @@ use Symfony\Component\Mime\Exception\RfcComplianceException;
*
* Example usage:
*
- * $mailer = \OC::$server->getMailer();
+ * $mailer = \OC::$server->get(\OCP\Mail\IMailer::class);
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(array('cloud@domain.org' => 'ownCloud Notifier'));
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 99af6da04a6..fde63a4c394 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -20,8 +20,10 @@ use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
use OCP\Files\IRootFolder;
+use OCP\Http\Client\IClientService;
use OCP\IServerContainer;
use OCP\L10N\IFactory;
+use OCP\Mail\IMailer;
use OCP\Security\IHasher;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
@@ -79,7 +81,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getUserManager(),
$this->serverContainer->getGroupManager(),
$this->serverContainer->get(IRootFolder::class),
- $this->serverContainer->getMailer(),
+ $this->serverContainer->get(IMailer::class),
$this->serverContainer->query(Defaults::class),
$this->serverContainer->get(IFactory::class),
$this->serverContainer->getURLGenerator(),
@@ -116,7 +118,7 @@ class ProviderFactory implements IProviderFactory {
);
$notifications = new Notifications(
$addressHandler,
- $this->serverContainer->getHTTPClientService(),
+ $this->serverContainer->get(IClientService::class),
$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
$this->serverContainer->getJobList(),
\OC::$server->getCloudFederationProviderManager(),
@@ -172,7 +174,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getL10N('sharebymail'),
$this->serverContainer->get(LoggerInterface::class),
- $this->serverContainer->getMailer(),
+ $this->serverContainer->get(IMailer::class),
$this->serverContainer->getURLGenerator(),
$this->serverContainer->getActivityManager(),
$settingsManager,
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 2c7390881c0..14918dfe89a 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -9,6 +9,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Files\SetupManager;
use OCP\Files\Template\ITemplateManager;
+use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IURLGenerator;
@@ -878,7 +879,7 @@ class OC_Util {
// accessing the file via http
$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
try {
- $content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
+ $content = \OC::$server->get(IClientService::class)->newClient()->get($url)->getBody();
} catch (\Exception $e) {
$content = false;
}
@@ -890,7 +891,7 @@ class OC_Util {
}
try {
- $fallbackContent = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
+ $fallbackContent = \OC::$server->get(IClientService::class)->newClient()->get($url)->getBody();
} catch (\Exception $e) {
$fallbackContent = false;
}
diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php
index 7a80a35e045..f19e72e0763 100644
--- a/lib/public/Contacts/IManager.php
+++ b/lib/public/Contacts/IManager.php
@@ -35,7 +35,7 @@ interface IManager {
* Following function shows how to search for contacts for the name and the email address.
*
* public static function getMatchingRecipient($term) {
- * $cm = \OC::$server->getContactsManager();
+ * $cm = \OCP\Server::get(\OCP\Contacts\IManager::class);
* // The API is not active -> nothing to do
* if (!$cm->isEnabled()) {
* return array();
diff --git a/lib/public/Mail/IMailer.php b/lib/public/Mail/IMailer.php
index dc49ed007b4..93efdce1a2d 100644
--- a/lib/public/Mail/IMailer.php
+++ b/lib/public/Mail/IMailer.php
@@ -14,7 +14,7 @@ namespace OCP\Mail;
*
* Example usage:
*
- * $mailer = \OC::$server->getMailer();
+ * $mailer = \OC::$server->get(\OCP\Mail\IMailer::class);
* $message = $mailer->createMessage();
* $message->setSubject('Your Subject');
* $message->setFrom(['cloud@domain.org' => 'Nextcloud Notifier']);
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 20b4fe9c20d..179d4066c9b 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -14,6 +14,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppScriptDependency;
use OC\AppScriptSort;
use OCP\L10N\IFactory;
+use OCP\Mail\IMailer;
use OCP\Share\IManager;
use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
@@ -303,7 +304,7 @@ class Util {
$host_name = $config->getSystemValueString('mail_domain', $host_name);
$defaultEmailAddress = $user_part.'@'.$host_name;
- $mailer = \OC::$server->getMailer();
+ $mailer = \OC::$server->get(IMailer::class);
if ($mailer->validateMailAddress($defaultEmailAddress)) {
return $defaultEmailAddress;
}
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index 3a62a57fdab..1fd48ea4fc9 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -51,7 +51,7 @@ class InstallerTest extends TestCase {
$config->setSystemValue('appstoreenabled', true);
$installer = new Installer(
\OC::$server->get(AppFetcher::class),
- \OC::$server->getHTTPClientService(),
+ \OC::$server->get(IClientService::class),
\OC::$server->getTempManager(),
\OC::$server->get(LoggerInterface::class),
$config,
@@ -74,7 +74,7 @@ class InstallerTest extends TestCase {
protected function tearDown(): void {
$installer = new Installer(
\OC::$server->get(AppFetcher::class),
- \OC::$server->getHTTPClientService(),
+ \OC::$server->get(IClientService::class),
\OC::$server->getTempManager(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->getConfig(),
@@ -98,7 +98,7 @@ class InstallerTest extends TestCase {
// Install app
$installer = new Installer(
\OC::$server->get(AppFetcher::class),
- \OC::$server->getHTTPClientService(),
+ \OC::$server->get(IClientService::class),
\OC::$server->getTempManager(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->getConfig(),