Skip to content

Commit

Permalink
refactor: Replace \OC::$server->get with \OCP\Server::get
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Sep 10, 2024
1 parent 91c7662 commit 7923dfd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Command/Trashbin/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Folder/FolderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \OCP\Server::get(IUserManager::class)->get($entry['mapping_id']);
if ($user === null) {
return null;
}
Expand All @@ -240,7 +240,7 @@ private function getManageAcl(array $mappings): array {
'displayname' => (string)$user->getDisplayName()
];
}
$group = \OC::$server->get(IGroupManager::class)->get($entry['mapping_id']);
$group = \OCP\Server::get(IGroupManager::class)->get($entry['mapping_id']);
if ($group === null) {
return [];
}
Expand Down Expand Up @@ -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 = \OCP\Server::get(IRootFolder::class)->get($path);
/** @var GroupMountPoint $mountPoint */
$mountPoint = $node->getMountPoint();
return $mountPoint->getFolderId();
Expand Down Expand Up @@ -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 = \OCP\Server::get('\OC\Settings\AuthorizedGroupMapper');
$settingClasses = $authorizedGroupMapper->findAllClassesForUser($user);
if (in_array('OCA\GroupFolders\Settings\Admin', $settingClasses, true)) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mount/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions tests/Trash/TrashBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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();
}
Expand Down

0 comments on commit 7923dfd

Please sign in to comment.