aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-03-15 15:33:06 +0100
committerGitHub <noreply@github.com>2024-03-15 15:33:06 +0100
commit7ecd4747cf4a50f735837d1762bbe1e86a01597e (patch)
tree40a75a2215d2587b1ccedb0abc27f9909a9ab872
parent1a5ec3dec90635b23c1652c1dcaa3c55e6f0b75e (diff)
parentf5e3fea2850ebdf84df3e6eb7431aae9847d5974 (diff)
downloadnextcloud-server-7ecd4747cf4a50f735837d1762bbe1e86a01597e.tar.gz
nextcloud-server-7ecd4747cf4a50f735837d1762bbe1e86a01597e.zip
Merge branch 'master' into refactor/OC-Server-getCloudFederationFactory
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
-rw-r--r--apps/files/lib/Command/Scan.php2
-rw-r--r--lib/private/Files/Cache/Scanner.php2
-rw-r--r--lib/private/Files/Utils/Scanner.php3
-rw-r--r--lib/private/Files/View.php2
-rw-r--r--lib/private/Memcache/Redis.php4
-rw-r--r--lib/private/Security/Hasher.php4
-rw-r--r--lib/private/Server.php2
-rw-r--r--lib/private/Share20/ProviderFactory.php12
-rw-r--r--lib/private/Streamer.php3
-rw-r--r--lib/private/User/Database.php7
-rw-r--r--lib/private/User/Session.php3
-rw-r--r--lib/private/legacy/OC_Files.php5
-rw-r--r--lib/private/legacy/OC_JSON.php5
-rw-r--r--lib/private/legacy/OC_Util.php3
-rw-r--r--lib/public/Security/IHasher.php4
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php2
-rw-r--r--tests/lib/Files/ViewTest.php6
-rw-r--r--tests/lib/Lockdown/Filesystem/NoFSTest.php4
-rw-r--r--tests/lib/Preview/BackgroundCleanupJobTest.php4
-rw-r--r--tests/lib/Preview/Provider.php3
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php6
-rw-r--r--tests/lib/TestCase.php5
22 files changed, 52 insertions, 39 deletions
diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php
index 31c410241cf..600343a4528 100644
--- a/apps/files/lib/Command/Scan.php
+++ b/apps/files/lib/Command/Scan.php
@@ -90,7 +90,7 @@ class Scan extends Base {
->addOption(
'path',
'p',
- InputArgument::OPTIONAL,
+ InputOption::VALUE_REQUIRED,
'limit rescan to this path, eg. --path="/alice/files/Music", the user_id is determined by the path and the user_id parameter and --all are ignored'
)
->addOption(
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 0c82e21e30d..1c66f3af8d2 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -96,7 +96,7 @@ class Scanner extends BasicEmitter implements IScanner {
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->cacheActive = !\OC::$server->getConfig()->getSystemValueBool('filesystem_cache_readonly', false);
- $this->lockingProvider = \OC::$server->getLockingProvider();
+ $this->lockingProvider = \OC::$server->get(ILockingProvider::class);
$this->connection = \OC::$server->get(IDBConnection::class);
}
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index 6348427cb3b..ae6a0a33d2b 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -50,6 +50,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IDBConnection;
+use OCP\Lock\ILockingProvider;
use Psr\Log\LoggerInterface;
/**
@@ -100,7 +101,7 @@ class Scanner extends PublicEmitter {
$this->dispatcher = $dispatcher;
$this->logger = $logger;
// when DB locking is used, no DB transactions will be used
- $this->useTransaction = !(\OC::$server->getLockingProvider() instanceof DBLockingProvider);
+ $this->useTransaction = !(\OC::$server->get(ILockingProvider::class) instanceof DBLockingProvider);
}
/**
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index c80b42134c4..36d7002a269 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -106,7 +106,7 @@ class View {
}
$this->fakeRoot = $root;
- $this->lockingProvider = \OC::$server->getLockingProvider();
+ $this->lockingProvider = \OC::$server->get(ILockingProvider::class);
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
$this->userManager = \OC::$server->getUserManager();
$this->logger = \OC::$server->get(LoggerInterface::class);
diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php
index 5e9554eb94e..97b6d41ea5e 100644
--- a/lib/private/Memcache/Redis.php
+++ b/lib/private/Memcache/Redis.php
@@ -70,7 +70,7 @@ class Redis extends Cache implements IMemcacheTTL {
*/
public function getCache() {
if (is_null(self::$cache)) {
- self::$cache = \OC::$server->getGetRedisFactory()->getInstance();
+ self::$cache = \OC::$server->get('RedisFactory')->getInstance();
}
return self::$cache;
}
@@ -209,7 +209,7 @@ class Redis extends Cache implements IMemcacheTTL {
}
public static function isAvailable(): bool {
- return \OC::$server->getGetRedisFactory()->isAvailable();
+ return \OC::$server->get('RedisFactory')->isAvailable();
}
protected function evalLua(string $scriptName, array $keys, array $args) {
diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php
index 23747751053..196b58df2ce 100644
--- a/lib/private/Security/Hasher.php
+++ b/lib/private/Security/Hasher.php
@@ -42,10 +42,10 @@ use OCP\Security\IHasher;
*
* Usage:
* // Hashing a message
- * $hash = \OC::$server->getHasher()->hash('MessageToHash');
+ * $hash = \OC::$server->get(\OCP\Security\IHasher::class)->hash('MessageToHash');
* // Verifying a message - $newHash will contain the newly calculated hash
* $newHash = null;
- * var_dump(\OC::$server->getHasher()->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
+ * var_dump(\OC::$server->get(\OCP\Security\IHasher::class)->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
* var_dump($newHash);
*
* @package OC\Security
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 76c73383b2e..a8b066263bc 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -546,7 +546,7 @@ class Server extends ServerContainer implements IServerContainer {
$provider,
$c->get(\OCP\IConfig::class),
$c->get(ISecureRandom::class),
- $c->getLockdownManager(),
+ $c->get('LockdownManager'),
$c->get(LoggerInterface::class),
$c->get(IEventDispatcher::class)
);
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 6c0cc335fa5..cac25226f1a 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -45,7 +45,9 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
+use OCP\Files\IRootFolder;
use OCP\IServerContainer;
+use OCP\Security\IHasher;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
@@ -101,7 +103,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getDatabaseConnection(),
$this->serverContainer->getUserManager(),
$this->serverContainer->getGroupManager(),
- $this->serverContainer->getLazyRootFolder(),
+ $this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getMailer(),
$this->serverContainer->query(Defaults::class),
$this->serverContainer->getL10NFactory(),
@@ -157,7 +159,7 @@ class ProviderFactory implements IProviderFactory {
$notifications,
$tokenHandler,
$l,
- $this->serverContainer->getLazyRootFolder(),
+ $this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getConfig(),
$this->serverContainer->getUserManager(),
$this->serverContainer->getCloudIdManager(),
@@ -192,7 +194,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getDatabaseConnection(),
$this->serverContainer->getSecureRandom(),
$this->serverContainer->getUserManager(),
- $this->serverContainer->getLazyRootFolder(),
+ $this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getL10N('sharebymail'),
$this->serverContainer->get(LoggerInterface::class),
$this->serverContainer->getMailer(),
@@ -200,7 +202,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getActivityManager(),
$settingsManager,
$this->serverContainer->query(Defaults::class),
- $this->serverContainer->getHasher(),
+ $this->serverContainer->get(IHasher::class),
$this->serverContainer->get(IEventDispatcher::class),
$this->serverContainer->get(IManager::class)
);
@@ -234,7 +236,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getDatabaseConnection(),
$this->serverContainer->getSecureRandom(),
$this->serverContainer->getUserManager(),
- $this->serverContainer->getLazyRootFolder(),
+ $this->serverContainer->get(IRootFolder::class),
$this->serverContainer->getL10N('circles'),
$this->serverContainer->getLogger(),
$this->serverContainer->getURLGenerator()
diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php
index aafd3d95dfb..4a88278ed99 100644
--- a/lib/private/Streamer.php
+++ b/lib/private/Streamer.php
@@ -32,6 +32,7 @@ use OC\Files\Filesystem;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\InvalidPathException;
+use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IRequest;
@@ -118,7 +119,7 @@ class Streamer {
// prevent absolute dirs
$internalDir = ltrim($internalDir, '/');
- $userFolder = \OC::$server->getRootFolder()->get(Filesystem::getRoot());
+ $userFolder = \OC::$server->get(IRootFolder::class)->get(Filesystem::getRoot());
/** @var Folder $dirNode */
$dirNode = $userFolder->get($dir);
$files = $dirNode->getDirectoryListing();
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 9ef1bc67a58..55d0183ce52 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -50,6 +50,7 @@ use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
use OCP\Security\Events\ValidatePasswordPolicyEvent;
+use OCP\Security\IHasher;
use OCP\User\Backend\ABackend;
use OCP\User\Backend\ICheckPasswordBackend;
use OCP\User\Backend\ICountUsersBackend;
@@ -130,7 +131,7 @@ class Database extends ABackend implements
$qb->insert($this->table)
->values([
'uid' => $qb->createNamedParameter($uid),
- 'password' => $qb->createNamedParameter(\OC::$server->getHasher()->hash($password)),
+ 'password' => $qb->createNamedParameter(\OC::$server->get(IHasher::class)->hash($password)),
'uid_lower' => $qb->createNamedParameter(mb_strtolower($uid)),
]);
@@ -197,7 +198,7 @@ class Database extends ABackend implements
if ($this->userExists($uid)) {
$this->eventDispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password));
- $hasher = \OC::$server->getHasher();
+ $hasher = \OC::$server->get(IHasher::class);
$hashedPassword = $hasher->hash($password);
$return = $this->updatePassword($uid, $hashedPassword);
@@ -353,7 +354,7 @@ class Database extends ABackend implements
if ($found && is_array($this->cache[$loginName])) {
$storedHash = $this->cache[$loginName]['password'];
$newHash = '';
- if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) {
+ if (\OC::$server->get(IHasher::class)->verify($password, $storedHash, $newHash)) {
if (!empty($newHash)) {
$this->updatePassword($loginName, $newHash);
}
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index ab6ec9f38d3..f2c0010b6be 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -43,6 +43,7 @@ use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Hooks\Emitter;
use OC\Hooks\PublicEmitter;
use OC_User;
@@ -524,7 +525,7 @@ class Session implements IUserSession, Emitter {
$user = $users[0];
}
// DI not possible due to cyclic dependencies :'-/
- return OC::$server->getTwoFactorAuthManager()->isTwoFactorAuthenticated($user);
+ return OC::$server->get(TwoFactorAuthManager::class)->isTwoFactorAuthenticated($user);
}
/**
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index a2f47639e65..ef65aa33c93 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -46,6 +46,7 @@ use OC\Streamer;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\Files\Events\BeforeZipCreatedEvent;
+use OCP\Files\IRootFolder;
use OCP\Lock\ILockingProvider;
/**
@@ -187,7 +188,7 @@ class OC_Files {
foreach ($files as $file) {
$file = $dir . '/' . $file;
if (\OC\Files\Filesystem::is_file($file)) {
- $userFolder = \OC::$server->getRootFolder()->get(\OC\Files\Filesystem::getRoot());
+ $userFolder = \OC::$server->get(IRootFolder::class)->get(\OC\Files\Filesystem::getRoot());
$file = $userFolder->get($file);
if ($file instanceof \OC\Files\Node\File) {
try {
@@ -307,7 +308,7 @@ class OC_Files {
$file = null;
try {
- $userFolder = \OC::$server->getRootFolder()->get(\OC\Files\Filesystem::getRoot());
+ $userFolder = \OC::$server->get(IRootFolder::class)->get(\OC\Files\Filesystem::getRoot());
$file = $userFolder->get($filename);
if (!$file instanceof \OC\Files\Node\File || !$file->isReadable()) {
http_response_code(403);
diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php
index b6791fe4b85..5188a92fe1d 100644
--- a/lib/private/legacy/OC_JSON.php
+++ b/lib/private/legacy/OC_JSON.php
@@ -27,6 +27,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
+
class OC_JSON {
/**
* Check if the app is enabled, send json error msg if not
@@ -48,7 +51,7 @@ class OC_JSON {
* @suppress PhanDeprecatedFunction
*/
public static function checkLoggedIn() {
- $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager();
+ $twoFactorAuthManger = \OC::$server->get(TwoFactorAuthManager::class);
if (!\OC::$server->getUserSession()->isLoggedIn()
|| $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
$l = \OC::$server->getL10N('lib');
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 42a0d9450b5..09d0719ff2b 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -65,6 +65,7 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Files\SetupManager;
use OCP\Files\Template\ITemplateManager;
use OCP\IConfig;
@@ -785,7 +786,7 @@ class OC_Util {
exit();
}
// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
- if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
+ if (\OC::$server->get(TwoFactorAuthManager::class)->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
exit();
}
diff --git a/lib/public/Security/IHasher.php b/lib/public/Security/IHasher.php
index 7c4d743002c..f64bb064422 100644
--- a/lib/public/Security/IHasher.php
+++ b/lib/public/Security/IHasher.php
@@ -37,10 +37,10 @@ namespace OCP\Security;
*
* Usage:
* // Hashing a message
- * $hash = \OC::$server->getHasher()->hash('MessageToHash');
+ * $hash = \OC::$server->get(\OCP\Security\IHasher::class)->hash('MessageToHash');
* // Verifying a message - $newHash will contain the newly calculated hash
* $newHash = null;
- * var_dump(\OC::$server->getHasher()->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
+ * var_dump(\OC::$server->get(\OCP\Security\IHasher::class)->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
* var_dump($newHash);
*
* @since 8.0.0
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 69894f14855..99d058f22a6 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -70,7 +70,7 @@ class PublicKeyTokenProviderTest extends TestCase {
parent::setUp();
$this->mapper = $this->createMock(PublicKeyTokenMapper::class);
- $this->hasher = \OC::$server->getHasher();
+ $this->hasher = \OC::$server->get(IHasher::class);
$this->crypto = \OC::$server->getCrypto();
$this->config = $this->createMock(IConfig::class);
$this->config->method('getSystemValueInt')
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index b9dd49d71fe..c4e17fd3118 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -1388,7 +1388,7 @@ class ViewTest extends \Test\TestCase {
* Test that locks are on mount point paths instead of mount root
*/
public function testLockLocalMountPointPathInsteadOfStorageRoot() {
- $lockingProvider = \OC::$server->getLockingProvider();
+ $lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
Filesystem::mount($storage, [], '/');
@@ -1418,7 +1418,7 @@ class ViewTest extends \Test\TestCase {
* Test that locks are on mount point paths and also mount root when requested
*/
public function testLockStorageRootButNotLocalMountPoint() {
- $lockingProvider = \OC::$server->getLockingProvider();
+ $lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
Filesystem::mount($storage, [], '/');
@@ -1448,7 +1448,7 @@ class ViewTest extends \Test\TestCase {
* Test that locks are on mount point paths and also mount root when requested
*/
public function testLockMountPointPathFailReleasesBoth() {
- $lockingProvider = \OC::$server->getLockingProvider();
+ $lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
Filesystem::mount($storage, [], '/');
diff --git a/tests/lib/Lockdown/Filesystem/NoFSTest.php b/tests/lib/Lockdown/Filesystem/NoFSTest.php
index 4c0645447ec..adffb01758c 100644
--- a/tests/lib/Lockdown/Filesystem/NoFSTest.php
+++ b/tests/lib/Lockdown/Filesystem/NoFSTest.php
@@ -39,7 +39,7 @@ class NoFSTest extends \Test\TestCase {
$token->setScope([
'filesystem' => true
]);
- \OC::$server->getLockdownManager()->setToken($token);
+ \OC::$server->get('LockdownManager')->setToken($token);
parent::tearDown();
}
@@ -50,7 +50,7 @@ class NoFSTest extends \Test\TestCase {
'filesystem' => false
]);
- \OC::$server->getLockdownManager()->setToken($token);
+ \OC::$server->get('LockdownManager')->setToken($token);
$this->createUser('foo', 'var');
}
diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php
index aa15ea7f562..3b95676e470 100644
--- a/tests/lib/Preview/BackgroundCleanupJobTest.php
+++ b/tests/lib/Preview/BackgroundCleanupJobTest.php
@@ -84,7 +84,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$this->connection = \OC::$server->getDatabaseConnection();
$this->previewManager = \OC::$server->getPreviewManager();
- $this->rootFolder = \OC::$server->getRootFolder();
+ $this->rootFolder = \OC::$server->get(IRootFolder::class);
$this->mimeTypeLoader = \OC::$server->getMimeTypeLoader();
$this->timeFactory = \OCP\Server::get(ITimeFactory::class);
}
@@ -102,7 +102,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
private function getRoot(): Root {
return new Root(
- \OC::$server->getRootFolder(),
+ \OC::$server->get(IRootFolder::class),
\OC::$server->getSystemConfig()
);
}
diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php
index a2e5170c82c..b4b50c873a5 100644
--- a/tests/lib/Preview/Provider.php
+++ b/tests/lib/Preview/Provider.php
@@ -22,6 +22,7 @@
namespace Test\Preview;
use OC\Files\Node\File;
+use OCP\Files\IRootFolder;
abstract class Provider extends \Test\TestCase {
/** @var string */
@@ -137,7 +138,7 @@ abstract class Provider extends \Test\TestCase {
* @return bool|\OCP\IImage
*/
private function getPreview($provider) {
- $file = new File(\OC::$server->getRootFolder(), $this->rootView, $this->imgPath);
+ $file = new File(\OC::$server->get(IRootFolder::class), $this->rootView, $this->imgPath);
$preview = $provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp);
if (get_class($this) === BitmapTest::class && $preview === null) {
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index b658e20d837..e1cdb8530c3 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -2514,7 +2514,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function testGetSharesInFolder() {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
- $rootFolder = \OC::$server->getRootFolder();
+ $rootFolder = \OC::$server->get(IRootFolder::class);
$provider = new DefaultShareProvider(
$this->dbConn,
@@ -2612,7 +2612,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function testGetAccessListNoCurrentAccessRequired() {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
- $rootFolder = \OC::$server->getRootFolder();
+ $rootFolder = \OC::$server->get(IRootFolder::class);
$provider = new DefaultShareProvider(
$this->dbConn,
@@ -2708,7 +2708,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function testGetAccessListCurrentAccessRequired() {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
- $rootFolder = \OC::$server->getRootFolder();
+ $rootFolder = \OC::$server->get(IRootFolder::class);
$provider = new DefaultShareProvider(
$this->dbConn,
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index db124bd6823..4ca00901762 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -38,6 +38,7 @@ use OCP\Defaults;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
+use OCP\Lock\ILockingProvider;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
@@ -197,7 +198,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
// further cleanup
$hookExceptions = \OC_Hook::$thrownExceptions;
\OC_Hook::$thrownExceptions = [];
- \OC::$server->getLockingProvider()->releaseAll();
+ \OC::$server->get(ILockingProvider::class)->releaseAll();
if (!empty($hookExceptions)) {
throw $hookExceptions[0];
}
@@ -418,7 +419,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
* Clean up the list of locks
*/
protected static function tearDownAfterClassCleanStrayLocks() {
- \OC::$server->getLockingProvider()->releaseAll();
+ \OC::$server->get(ILockingProvider::class)->releaseAll();
}
/**