diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php
index 0226a9461b7..c48db3bb65c 100644
--- a/apps/dav/lib/Command/CreateCalendar.php
+++ b/apps/dav/lib/Command/CreateCalendar.php
@@ -22,6 +22,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Server;
use Psr\Log\LoggerInterface;
@@ -66,7 +67,7 @@ class CreateCalendar extends Command {
Server::get(ProxyMapper::class),
Server::get(KnownUserService::class),
Server::get(IConfig::class),
- \OC::$server->getL10NFactory(),
+ Server::get(IFactory::class),
);
$random = Server::get(ISecureRandom::class);
$logger = Server::get(LoggerInterface::class);
diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php
index a11bea72c59..2c01d1ff4ba 100644
--- a/apps/dav/lib/Files/RootCollection.php
+++ b/apps/dav/lib/Files/RootCollection.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Files;
use OCP\Files\FileInfo;
+use OCP\Files\IRootFolder;
use OCP\IUserSession;
use OCP\Server;
use Sabre\DAV\INode;
@@ -35,7 +36,7 @@ class RootCollection extends AbstractPrincipalCollection {
// in the future this could be considered to be used for accessing shared files
return new SimpleCollection($name);
}
- $userFolder = \OC::$server->getUserFolder();
+ $userFolder = Server::get(IRootFolder::class)->getUserFolder($user->getUID());
if (!($userFolder instanceof FileInfo)) {
throw new \Exception('Home does not exist');
}
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index 81f98da4c45..08e945f47ad 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -42,6 +42,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Server;
use OCP\SystemTag\ISystemTagManager;
@@ -75,7 +76,7 @@ class RootCollection extends SimpleCollection {
$proxyMapper,
Server::get(KnownUserService::class),
Server::get(IConfig::class),
- \OC::$server->getL10NFactory()
+ Server::get(IFactory::class)
);
$groupPrincipalBackend = new GroupPrincipalBackend($groupManager, $userSession, $shareManager, $config);
diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php
index d63ce008435..781961e55f7 100644
--- a/apps/files_sharing/tests/ExternalStorageTest.php
+++ b/apps/files_sharing/tests/ExternalStorageTest.php
@@ -13,13 +13,15 @@ use OCA\Files_Sharing\External\Storage;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
+use OCP\ICertificateManager;
+use OCP\Server;
/**
* Tests for the external Storage class for remote shares.
*/
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class ExternalStorageTest extends \Test\TestCase {
- public static function optionsProvider() {
+ public static function optionsProvider(): array {
return [
[
'http://remoteserver:8080/owncloud',
@@ -54,7 +56,7 @@ class ExternalStorageTest extends \Test\TestCase {
}
private function getTestStorage($uri) {
- $certificateManager = \OC::$server->getCertificateManager();
+ $certificateManager = Server::get(ICertificateManager::class);
$httpClientService = $this->createMock(IClientService::class);
$manager = $this->createMock(ExternalShareManager::class);
$client = $this->createMock(IClient::class);
diff --git a/apps/testing/lib/AppInfo/Application.php b/apps/testing/lib/AppInfo/Application.php
index 22cce3cd431..2035dbbf6fc 100644
--- a/apps/testing/lib/AppInfo/Application.php
+++ b/apps/testing/lib/AppInfo/Application.php
@@ -30,7 +30,9 @@ use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\IAppConfig;
use OCP\IGroupManager;
+use OCP\IUserManager;
use OCP\Settings\Events\DeclarativeSettingsGetValueEvent;
use OCP\Settings\Events\DeclarativeSettingsRegisterFormEvent;
use OCP\Settings\Events\DeclarativeSettingsSetValueEvent;
@@ -67,9 +69,9 @@ class Application extends App implements IBootstrap {
public function boot(IBootContext $context): void {
$server = $context->getServerContainer();
- $config = $server->getConfig();
- if ($config->getAppValue(self::APP_ID, 'enable_alt_user_backend', 'no') === 'yes') {
- $userManager = $server->getUserManager();
+ $config = $server->get(IAppConfig::class);
+ if ($config->getValueBool(self::APP_ID, 'enable_alt_user_backend')) {
+ $userManager = $server->get(IUserManager::class);
// replace all user backends with this one
$userManager->clearBackends();
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index cbe08c0b2b4..24fb44941e8 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -444,11 +444,6 @@
principalUri]]>
-
-
-
-
-
@@ -775,11 +770,6 @@
-
-
-
-
-
@@ -830,7 +820,6 @@
-
@@ -2345,13 +2334,6 @@
-
-
-
-
-
-
-
@@ -3951,12 +3933,6 @@
-
-
-
-
-
-
diff --git a/lib/base.php b/lib/base.php
index fcc6fe700d0..a11334c50cf 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -8,6 +8,7 @@ declare(strict_types=1);
*/
use OC\Profiler\BuiltInProfiler;
+use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Share20\GroupDeletedListener;
use OC\Share20\Hooks;
use OC\Share20\UserDeletedListener;
@@ -22,6 +23,7 @@ use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\ILogger;
use OCP\IRequest;
+use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Security\Bruteforce\IThrottler;
@@ -298,7 +300,7 @@ class OC {
Util::addScript('core', 'update');
$initialState = Server::get(IInitialStateService::class);
- $serverVersion = \OCP\Server::get(\OCP\ServerVersion::class);
+ $serverVersion = Server::get(\OCP\ServerVersion::class);
if ($disableWebUpdater || ($tooBig && !$ignoreTooBigWarning)) {
// send http status 503
http_response_code(503);
@@ -621,7 +623,7 @@ class OC {
* @see \OCP\AppFramework\Http\Response::getHeaders
*/
$policy = 'default-src \'self\'; '
- . 'script-src \'self\' \'nonce-' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '\'; '
+ . 'script-src \'self\' \'nonce-' . Server::get(ContentSecurityPolicyNonceManager::class)->getNonce() . '\'; '
. 'style-src \'self\' \'unsafe-inline\'; '
. 'frame-src *; '
. 'img-src * data: blob:; '
@@ -727,7 +729,7 @@ class OC {
$config = Server::get(IConfig::class);
if (!defined('PHPUNIT_RUN')) {
$errorHandler = new OC\Log\ErrorHandler(
- \OCP\Server::get(\Psr\Log\LoggerInterface::class),
+ Server::get(\Psr\Log\LoggerInterface::class),
);
$exceptionHandler = [$errorHandler, 'onException'];
if ($config->getSystemValueBool('debug', false)) {
@@ -812,7 +814,7 @@ class OC {
// User and Groups
if (!$systemConfig->getValue('installed', false)) {
- self::$server->getSession()->set('user_id', '');
+ Server::get(ISession::class)->set('user_id', '');
}
$eventLogger->start('setup_backends', 'Setup group and user backends');
@@ -1076,7 +1078,7 @@ class OC {
// Check if Nextcloud is installed or in maintenance (update) mode
if (!$systemConfig->getValue('installed', false)) {
- \OC::$server->getSession()->clear();
+ Server::get(ISession::class)->clear();
$controller = Server::get(\OC\Core\Controller\SetupController::class);
$controller->run($_POST);
exit();
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 49a91cced9c..8d40aa2d93c 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -118,7 +118,7 @@ class DAV extends Common {
}
if ($this->secure === true) {
// inject mock for testing
- $this->certManager = \OC::$server->getCertificateManager();
+ $this->certManager = Server::get(ICertificateManager::class);
}
$this->root = rawurldecode($parameters['root'] ?? '/');
$this->root = '/' . ltrim($this->root, '/');
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 532ac3887c4..05af431c00f 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -122,7 +122,6 @@ use OC\Security\CertificateManager;
use OC\Security\CredentialsManager;
use OC\Security\Crypto;
use OC\Security\CSP\ContentSecurityPolicyManager;
-use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Security\CSRF\CsrfTokenManager;
use OC\Security\CSRF\TokenStorage\SessionStorage;
use OC\Security\Hasher;
@@ -201,7 +200,6 @@ use OCP\Files\Config\IMountProviderCollection;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Conversion\IConversionManager;
use OCP\Files\Folder;
-use OCP\Files\IAppData;
use OCP\Files\IFilenameValidator;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IMimeTypeLoader;
@@ -629,7 +627,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(IFactory::class, function (Server $c) {
return new \OC\L10N\Factory(
$c->get(IConfig::class),
- $c->getRequest(),
+ $c->get(IRequest::class),
$c->get(IUserSession::class),
$c->get(ICacheFactory::class),
\OC::$SERVERROOT,
@@ -681,7 +679,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
$l10n = $this->get(IFactory::class)->get('lib');
return new \OC\Activity\Manager(
- $c->getRequest(),
+ $c->get(IRequest::class),
$c->get(IUserSession::class),
$c->get(IConfig::class),
$c->get(IValidator::class),
@@ -702,8 +700,8 @@ class Server extends ServerContainer implements IServerContainer {
return new AvatarManager(
$c->get(IUserSession::class),
$c->get(\OC\User\Manager::class),
- $c->getAppDataDir('avatar'),
- $c->getL10N('lib'),
+ $c->get(IAppDataFactory::class)->get('avatar'),
+ $c->get(IFactory::class)->get('lib'),
$c->get(LoggerInterface::class),
$c->get(IConfig::class),
$c->get(IAccountManager::class),
@@ -1066,7 +1064,7 @@ class Server extends ServerContainer implements IServerContainer {
if ($classExists
&& $c->get(IConfig::class)->getSystemValueBool('installed', false)
&& $c->get(IAppManager::class)->isEnabledForAnyone('theming')
- && $c->get(TrustedDomainHelper::class)->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
+ && $c->get(TrustedDomainHelper::class)->isTrustedDomain($c->get(IRequest::class)->getInsecureServerHost())) {
$backgroundService = new BackgroundService(
$c->get(IRootFolder::class),
$c->get(IAppDataFactory::class)->get('theming'),
@@ -1111,7 +1109,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerService(JSCombiner::class, function (Server $c) {
return new JSCombiner(
- $c->getAppDataDir('js'),
+ $c->get(IAppDataFactory::class)->get('js'),
$c->get(IURLGenerator::class),
$this->get(ICacheFactory::class),
$c->get(IConfig::class),
@@ -1352,62 +1350,6 @@ class Server extends ServerContainer implements IServerContainer {
GenerateBlurhashMetadata::loadListeners($eventDispatcher);
}
- /**
- * @return \OCP\Contacts\IManager
- * @deprecated 20.0.0
- */
- public function getContactsManager() {
- return $this->get(\OCP\Contacts\IManager::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getEncryptionManager(): \OCP\Encryption\IManager {
- return $this->get(\OCP\Encryption\IManager::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getEncryptionFilesHelper(): IFile {
- return $this->get(IFile::class);
- }
-
- /**
- * The current request object holding all information about the request
- * currently being processed is returned from this method.
- * In case the current execution was not initiated by a web request null is returned
- *
- * @return IRequest
- * @deprecated 20.0.0
- */
- public function getRequest() {
- return $this->get(IRequest::class);
- }
-
- /**
- * Returns the root folder of ownCloud's data directory
- *
- * @return IRootFolder
- * @deprecated 20.0.0
- */
- public function getRootFolder() {
- return $this->get(IRootFolder::class);
- }
-
- /**
- * Returns the root folder of ownCloud's data directory
- * This is the lazy variant so this gets only initialized once it
- * is actually used.
- *
- * @return IRootFolder
- * @deprecated 20.0.0
- */
- public function getLazyRootFolder() {
- return $this->get(IRootFolder::class);
- }
-
/**
* Returns a view to ownCloud's files folder
*
@@ -1427,34 +1369,6 @@ class Server extends ServerContainer implements IServerContainer {
return $root->getUserFolder($userId);
}
- /**
- * @deprecated 20.0.0
- */
- public function getUserManager(): IUserManager {
- return $this->get(IUserManager::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getGroupManager(): IGroupManager {
- return $this->get(IGroupManager::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getUserSession(): IUserSession {
- return $this->get(IUserSession::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getSession(): ISession {
- return $this->get(Session::class)->getSession();
- }
-
public function setSession(ISession $session): void {
$this->get(SessionStorage::class)->setSession($session);
$this->get(Session::class)->setSession($session);
@@ -1462,24 +1376,13 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
+ * Get the webroot
+ *
+ * @return string
* @deprecated 20.0.0
*/
- public function getConfig(): IConfig {
- return $this->get(AllConfig::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getSystemConfig(): SystemConfig {
- return $this->get(SystemConfig::class);
- }
-
- /**
- * @deprecated 20.0.0
- */
- public function getL10NFactory(): IFactory {
- return $this->get(IFactory::class);
+ public function getWebRoot(): string {
+ return $this->webRoot;
}
/**
@@ -1493,241 +1396,4 @@ class Server extends ServerContainer implements IServerContainer {
public function getL10N($app, $lang = null) {
return $this->get(IFactory::class)->get($app, $lang);
}
-
- /**
- * @return IURLGenerator
- * @deprecated 20.0.0
- */
- public function getURLGenerator() {
- return $this->get(IURLGenerator::class);
- }
-
- /**
- * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
- * getMemCacheFactory() instead.
- *
- * @return ICache
- * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
- */
- public function getCache() {
- return $this->get(ICache::class);
- }
-
- /**
- * Returns an \OCP\CacheFactory instance
- *
- * @return ICacheFactory
- * @deprecated 20.0.0
- */
- public function getMemCacheFactory() {
- return $this->get(ICacheFactory::class);
- }
-
- /**
- * Returns the current session
- *
- * @return IDBConnection
- * @deprecated 20.0.0
- */
- public function getDatabaseConnection() {
- return $this->get(IDBConnection::class);
- }
-
- /**
- * Returns the activity manager
- *
- * @return \OCP\Activity\IManager
- * @deprecated 20.0.0
- */
- public function getActivityManager() {
- return $this->get(\OCP\Activity\IManager::class);
- }
-
- /**
- * Returns an job list for controlling background jobs
- *
- * @return IJobList
- * @deprecated 20.0.0
- */
- public function getJobList() {
- return $this->get(IJobList::class);
- }
-
- /**
- * Returns a SecureRandom instance
- *
- * @return ISecureRandom
- * @deprecated 20.0.0
- */
- public function getSecureRandom() {
- return $this->get(ISecureRandom::class);
- }
-
- /**
- * Returns a Crypto instance
- *
- * @return ICrypto
- * @deprecated 20.0.0
- */
- public function getCrypto() {
- return $this->get(ICrypto::class);
- }
-
- /**
- * Returns a Hasher instance
- *
- * @return IHasher
- * @deprecated 20.0.0
- */
- public function getHasher() {
- return $this->get(IHasher::class);
- }
-
- /**
- * Get the certificate manager
- *
- * @return ICertificateManager
- */
- public function getCertificateManager() {
- return $this->get(ICertificateManager::class);
- }
-
- /**
- * Get the manager for temporary files and folders
- *
- * @return ITempManager
- * @deprecated 20.0.0
- */
- public function getTempManager() {
- return $this->get(ITempManager::class);
- }
-
- /**
- * Get the app manager
- *
- * @return IAppManager
- * @deprecated 20.0.0
- */
- public function getAppManager() {
- return $this->get(IAppManager::class);
- }
-
- /**
- * Creates a new mailer
- *
- * @return IMailer
- * @deprecated 20.0.0
- */
- public function getMailer() {
- return $this->get(IMailer::class);
- }
-
- /**
- * Get the webroot
- *
- * @return string
- * @deprecated 20.0.0
- */
- public function getWebRoot() {
- return $this->webRoot;
- }
-
- /**
- * Get the locking provider
- *
- * @return ILockingProvider
- * @since 8.1.0
- * @deprecated 20.0.0
- */
- public function getLockingProvider() {
- return $this->get(ILockingProvider::class);
- }
-
- /**
- * Get the MimeTypeDetector
- *
- * @return IMimeTypeDetector
- * @deprecated 20.0.0
- */
- public function getMimeTypeDetector() {
- return $this->get(IMimeTypeDetector::class);
- }
-
- /**
- * Get the MimeTypeLoader
- *
- * @return IMimeTypeLoader
- * @deprecated 20.0.0
- */
- public function getMimeTypeLoader() {
- return $this->get(IMimeTypeLoader::class);
- }
-
- /**
- * Get the Notification Manager
- *
- * @return \OCP\Notification\IManager
- * @since 8.2.0
- * @deprecated 20.0.0
- */
- public function getNotificationManager() {
- return $this->get(\OCP\Notification\IManager::class);
- }
-
- /**
- * @return ThemingDefaults
- * @deprecated 20.0.0
- */
- public function getThemingDefaults() {
- return $this->get('ThemingDefaults');
- }
-
- /**
- * @return Checker
- * @deprecated 20.0.0
- */
- public function getIntegrityCodeChecker() {
- return $this->get('IntegrityCodeChecker');
- }
-
- /**
- * @return CsrfTokenManager
- * @deprecated 20.0.0
- */
- public function getCsrfTokenManager() {
- return $this->get(CsrfTokenManager::class);
- }
-
- /**
- * @return ContentSecurityPolicyNonceManager
- * @deprecated 20.0.0
- */
- public function getContentSecurityPolicyNonceManager() {
- return $this->get(ContentSecurityPolicyNonceManager::class);
- }
-
- /**
- * @return \OCP\Settings\IManager
- * @deprecated 20.0.0
- */
- public function getSettingsManager() {
- return $this->get(\OC\Settings\Manager::class);
- }
-
- /**
- * @return IAppData
- * @deprecated 20.0.0 Use get(\OCP\Files\AppData\IAppDataFactory::class)->get($app) instead
- */
- public function getAppDataDir($app) {
- $factory = $this->get(\OC\Files\AppData\Factory::class);
- return $factory->get($app);
- }
-
- /**
- * @return ICloudIdManager
- * @deprecated 20.0.0
- */
- public function getCloudIdManager() {
- return $this->get(ICloudIdManager::class);
- }
}
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 8cab6bc437e..4580c3890cc 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -23,36 +23,6 @@ use Psr\Container\ContainerInterface;
*/
interface IServerContainer extends ContainerInterface, IContainer {
- /**
- * The contacts manager will act as a broker between consumers for contacts information and
- * providers which actual deliver the contact information.
- *
- * @return \OCP\Contacts\IManager
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getContactsManager();
-
- /**
- * The current request object holding all information about the request currently being processed
- * is returned from this method.
- * In case the current execution was not initiated by a web request null is returned
- *
- * @return \OCP\IRequest
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getRequest();
-
- /**
- * Returns the root folder of Nextcloud's data directory
- *
- * @return \OCP\Files\IRootFolder
- * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getRootFolder();
-
/**
* Returns a view to ownCloud's files folder
*
@@ -64,78 +34,9 @@ interface IServerContainer extends ContainerInterface, IContainer {
*/
public function getUserFolder($userId = null);
- /**
- * Returns a user manager
- *
- * @return \OCP\IUserManager
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getUserManager();
-
- /**
- * Returns a group manager
- *
- * @return \OCP\IGroupManager
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getGroupManager();
-
- /**
- * Returns the user session
- *
- * @return \OCP\IUserSession
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getUserSession();
-
- /**
- * Returns the config manager
- *
- * @return \OCP\IConfig
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getConfig();
-
- /**
- * Returns a Crypto instance
- *
- * @return \OCP\Security\ICrypto
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getCrypto();
-
- /**
- * Returns a Hasher instance
- *
- * @return \OCP\Security\IHasher
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getHasher();
-
- /**
- * Returns a SecureRandom instance
- *
- * @return \OCP\Security\ISecureRandom
- * @since 8.1.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getSecureRandom();
-
- /**
- * @return \OCP\L10N\IFactory
- * @since 8.2.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getL10NFactory();
-
/**
* get an L10N instance
+ *
* @param string $app appid
* @param string $lang
* @return \OCP\IL10N
@@ -144,110 +45,6 @@ interface IServerContainer extends ContainerInterface, IContainer {
*/
public function getL10N($app, $lang = null);
- /**
- * @return \OCP\Encryption\IManager
- * @since 8.1.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getEncryptionManager();
-
- /**
- * @return \OCP\Encryption\IFile
- * @since 8.1.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getEncryptionFilesHelper();
-
- /**
- * Returns the URL generator
- *
- * @return \OCP\IURLGenerator
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getURLGenerator();
-
- /**
- * Returns an ICache instance
- *
- * @return \OCP\ICache
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getCache();
-
- /**
- * Returns an \OCP\CacheFactory instance
- *
- * @return \OCP\ICacheFactory
- * @since 7.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getMemCacheFactory();
-
- /**
- * Returns the current session
- *
- * @return \OCP\ISession
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getSession();
-
- /**
- * Returns the activity manager
- *
- * @return \OCP\Activity\IManager
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getActivityManager();
-
- /**
- * Returns the current session
- *
- * @return \OCP\IDBConnection
- * @since 6.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getDatabaseConnection();
-
- /**
- * Returns an job list for controlling background jobs
- *
- * @return \OCP\BackgroundJob\IJobList
- * @since 7.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getJobList();
-
- /**
- * Get the certificate manager
- *
- * @return \OCP\ICertificateManager
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getCertificateManager();
-
- /**
- * Get the manager for temporary files and folders
- *
- * @return \OCP\ITempManager
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getTempManager();
-
- /**
- * Get the app manager
- *
- * @return \OCP\App\IAppManager
- * @since 8.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getAppManager();
-
/**
* Get the webroot
*
@@ -255,57 +52,5 @@ interface IServerContainer extends ContainerInterface, IContainer {
* @since 8.0.0
* @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
*/
- public function getWebRoot();
-
- /**
- * Creates a new mailer
- *
- * @return \OCP\Mail\IMailer
- * @since 8.1.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getMailer();
-
- /**
- * Get the locking provider
- *
- * @return \OCP\Lock\ILockingProvider
- * @since 8.1.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getLockingProvider();
-
- /**
- * Get the MimeTypeDetector
- *
- * @return \OCP\Files\IMimeTypeDetector
- * @since 8.2.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getMimeTypeDetector();
-
- /**
- * Get the MimeTypeLoader
- *
- * @return \OCP\Files\IMimeTypeLoader
- * @since 8.2.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getMimeTypeLoader();
-
- /**
- * Get the Notification Manager
- *
- * @return \OCP\Notification\IManager
- * @since 9.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getNotificationManager();
-
- /**
- * @return \OCP\Federation\ICloudIdManager
- * @since 12.0.0
- * @deprecated 20.0.0 have it injected or fetch it through \Psr\Container\ContainerInterface::get
- */
- public function getCloudIdManager();
+ public function getWebRoot(): string;
}
diff --git a/ocs-provider/index.php b/ocs-provider/index.php
index 28844d9e581..74fe6a11034 100644
--- a/ocs-provider/index.php
+++ b/ocs-provider/index.php
@@ -6,15 +6,17 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+use OCP\App\IAppManager;
+use OCP\IRequest;
+use OCP\Server;
+
require_once __DIR__ . '/../lib/base.php';
header('Content-Type: application/json');
-$server = \OC::$server;
-
$controller = new \OC\OCS\Provider(
'ocs_provider',
- $server->getRequest(),
- $server->getAppManager()
+ Server::get(IRequest::class),
+ Server::get(IAppManager::class),
);
echo $controller->buildProviderList()->render();
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index d478bea089e..2587845cbd1 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -12,6 +12,7 @@ use OC\App\AppStore\Fetcher\AppFetcher;
use OC\Config;
use OC\Server;
use OCP\Comments\ICommentsManager;
+use OCP\IConfig;
/**
* Class Server
@@ -49,17 +50,12 @@ class ServerTest extends \Test\TestCase {
* @param string $instanceOf
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestQuery')]
- public function testQuery($serviceName, $instanceOf): void {
+ public function testQuery(string $serviceName, string $instanceOf): void {
$this->assertInstanceOf($instanceOf, $this->server->query($serviceName), 'Service "' . $serviceName . '"" did not return the right class');
}
- public function testGetCertificateManager(): void {
- $this->assertInstanceOf('\OC\Security\CertificateManager', $this->server->getCertificateManager(), 'service returned by "getCertificateManager" did not return the right class');
- $this->assertInstanceOf('\OCP\ICertificateManager', $this->server->getCertificateManager(), 'service returned by "getCertificateManager" did not return the right class');
- }
-
public function testOverwriteDefaultCommentsManager(): void {
- $config = $this->server->getConfig();
+ $config = $this->server->get(IConfig::class);
$defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
$config->setSystemValue('comments.managerFactory', '\Test\Comments\FakeFactory');