diff --git a/lib/Command/Trashbin/Cleanup.php b/lib/Command/Trashbin/Cleanup.php index bdf0c58cd..7abccee08 100644 --- a/lib/Command/Trashbin/Cleanup.php +++ b/lib/Command/Trashbin/Cleanup.php @@ -25,7 +25,7 @@ class Cleanup extends Base { public function __construct(FolderManager $folderManager, IRootFolder $rootFolder) { parent::__construct(); if (\OC::$server->getAppManager()->isEnabledForUser('files_trashbin')) { - $this->trashBackend = \OC::$server->get(TrashBackend::class); + $this->trashBackend = \OCP\Server::get(TrashBackend::class); $this->folderManager = $folderManager; } } diff --git a/lib/Folder/FolderManager.php b/lib/Folder/FolderManager.php index 4ff3b78dc..a41b42353 100644 --- a/lib/Folder/FolderManager.php +++ b/lib/Folder/FolderManager.php @@ -230,7 +230,7 @@ private function getFolderMappings(int $id): array { private function getManageAcl(array $mappings): array { return array_filter(array_map(function (array $entry): ?array { if ($entry['mapping_type'] === 'user') { - $user = \OC::$server->get(IUserManager::class)->get($entry['mapping_id']); + $user = Server::get(IUserManager::class)->get($entry['mapping_id']); if ($user === null) { return null; } @@ -240,14 +240,14 @@ private function getManageAcl(array $mappings): array { 'displayname' => (string)$user->getDisplayName() ]; } - $group = \OC::$server->get(IGroupManager::class)->get($entry['mapping_id']); + $group = Server::get(IGroupManager::class)->get($entry['mapping_id']); if ($group === null) { return []; } return [ 'type' => 'group', - 'id' => (string)$group->getGID(), - 'displayname' => (string)$group->getDisplayName() + 'id' => $group->getGID(), + 'displayname' => $group->getDisplayName() ]; }, $mappings), function (?array $element): bool { return $element !== null; @@ -304,7 +304,7 @@ public function getFolderAclEnabled(int $id): bool { public function getFolderByPath(string $path): int { /** @var Node $node */ - $node = \OC::$server->get(IRootFolder::class)->get($path); + $node = Server::get(IRootFolder::class)->get($path); /** @var GroupMountPoint $mountPoint */ $mountPoint = $node->getMountPoint(); return $mountPoint->getFolderId(); @@ -412,7 +412,7 @@ public function canManageACL(int $folderId, IUser $user): bool { // Call private server api if (class_exists('\OC\Settings\AuthorizedGroupMapper')) { - $authorizedGroupMapper = \OC::$server->get('\OC\Settings\AuthorizedGroupMapper'); + $authorizedGroupMapper = Server::get('\OC\Settings\AuthorizedGroupMapper'); $settingClasses = $authorizedGroupMapper->findAllClassesForUser($user); if (in_array('OCA\GroupFolders\Settings\Admin', $settingClasses, true)) { return true; diff --git a/lib/Mount/MountProvider.php b/lib/Mount/MountProvider.php index eaff0a700..5d34a1eb2 100644 --- a/lib/Mount/MountProvider.php +++ b/lib/Mount/MountProvider.php @@ -163,7 +163,7 @@ private function getCurrentUID(): ?string { try { // wopi requests are not logged in, instead we need to get the editor user from the access token if (strpos($this->request->getRawPathInfo(), 'apps/richdocuments/wopi') && class_exists('OCA\Richdocuments\Db\WopiMapper')) { - $wopiMapper = \OC::$server->get('OCA\Richdocuments\Db\WopiMapper'); + $wopiMapper = \OCP\Server::get('OCA\Richdocuments\Db\WopiMapper'); $token = $this->request->getParam('access_token'); if ($token) { $wopi = $wopiMapper->getPathForToken($token); diff --git a/tests/Trash/TrashBackendTest.php b/tests/Trash/TrashBackendTest.php index c902728fb..9c45ea428 100644 --- a/tests/Trash/TrashBackendTest.php +++ b/tests/Trash/TrashBackendTest.php @@ -50,18 +50,18 @@ public function setUp(): void { $this->normalUser = $this->createUser('normal', 'test'); /** @var Database $groupBackend */ - $groupBackend = \OC::$server->get(Database::class); + $groupBackend = \OCP\Server::get(Database::class); $groupBackend->createGroup('gf_manager'); $groupBackend->createGroup('gf_normal'); $groupBackend->addToGroup('manager', 'gf_manager'); $groupBackend->addToGroup('normal', 'gf_normal'); - $this->trashBackend = \OC::$server->get(TrashBackend::class); - $this->folderManager = \OC::$server->get(FolderManager::class); + $this->trashBackend = \OCP\Server::get(TrashBackend::class); + $this->folderManager = \OCP\Server::get(FolderManager::class); /** @var ACLManagerFactory $aclManagerFactory */ - $aclManagerFactory = \OC::$server->get(ACLManagerFactory::class); + $aclManagerFactory = \OCP\Server::get(ACLManagerFactory::class); $this->aclManager = $aclManagerFactory->getACLManager($this->managerUser); - $this->ruleManager = \OC::$server->get(RuleManager::class); + $this->ruleManager = \OCP\Server::get(RuleManager::class); $this->folderId = $this->folderManager->createFolder($this->folderName); $this->folderManager->addApplicableGroup($this->folderId, 'gf_manager'); @@ -70,7 +70,7 @@ public function setUp(): void { $this->folderManager->setManageACL($this->folderId, 'user', 'manager', true); /** @var IRootFolder $rootFolder */ - $rootFolder = \OC::$server->get(IRootFolder::class); + $rootFolder = \OCP\Server::get(IRootFolder::class); $this->managerUserFolder = $rootFolder->getUserFolder('manager'); $this->normalUserFolder = $rootFolder->getUserFolder('normal'); @@ -90,7 +90,7 @@ protected function tearDown(): void { $this->folderManager->removeFolder($this->folderId); /** @var SetupManager $setupManager */ - $setupManager = \OC::$server->get(SetupManager::class); + $setupManager = \OCP\Server::get(SetupManager::class); $setupManager->tearDown(); parent::tearDown(); }