diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 10ef1ef8..b17b7f0b 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -37,8 +37,10 @@ use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\IAppContainer; +use OCP\IGroupManager; use OCP\IServerContainer; use OCP\IUser; +use OCP\IUserManager; use OCP\Notification\IManager as INotificationManager; use OCP\Share\Events\ShareCreatedEvent; @@ -55,16 +57,14 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class); $context->registerEventListener(ShareCreatedEvent::class, ShareAutoAcceptListener::class); $context->registerEventListener(BeforeTemplateRenderedEvent::class, TalkIntegrationListener::class); - - // need to cheat here since there's no way to register these in IRegistrationContext - $container = $this->getContainer(); - $server = $container->getServer(); - $server->getUserManager()->registerBackend($container->query(UserBackend::class)); - \OC_App::loadApp('theming'); - $server->getGroupManager()->addBackend($container->query(GroupBackend::class)); } public function boot(IBootContext $context): void { + // need to cheat here since there's no way to register these in IRegistrationContext + $container = $context->getServerContainer(); + $container->get(IUserManager::class)->registerBackend($container->query(UserBackend::class)); + $container->get(IGroupManager::class)->addBackend($container->query(GroupBackend::class)); + $this->setupGuestManagement($context->getAppContainer(), $context->getServerContainer()); $this->setupGuestRestrictions($context->getAppContainer(), $context->getServerContainer()); $this->setupNotifications($context->getAppContainer()); diff --git a/lib/GroupBackend.php b/lib/GroupBackend.php index 09497712..49fa332b 100644 --- a/lib/GroupBackend.php +++ b/lib/GroupBackend.php @@ -111,7 +111,7 @@ public function getUserGroups($uid): array { * Returns a list with all groups */ public function getGroups($search = '', $limit = -1, $offset = 0): array { - return $offset === 0 ? [$this->groupName] : []; + return $offset == 0 ? [$this->groupName] : []; } /** diff --git a/lib/Storage/DirMask.php b/lib/Storage/DirMask.php index 1aaae8a4..7a62e049 100644 --- a/lib/Storage/DirMask.php +++ b/lib/Storage/DirMask.php @@ -100,41 +100,47 @@ public function getPermissions($path): int { } } - public function rename($path1, $path2): bool { - if (!$this->isUpdatable($path1)) { + /** + * @psalm-suppress ParamNameMismatch + */ + public function rename($source, $target): bool { + if (!$this->isUpdatable($source)) { return false; } - if ($this->file_exists($path2)) { - if ($this->isUpdatable($path2)) { - return $this->storage->rename($path1, $path2); + if ($this->file_exists($target)) { + if ($this->isUpdatable($target)) { + return $this->storage->rename($source, $target); } } else { - $parent = dirname($path2); + $parent = dirname($target); if ($parent === '.') { $parent = ''; } if ($this->isCreatable($parent)) { - return $this->storage->rename($path1, $path2); + return $this->storage->rename($source, $target); } } return false; } - - public function copy($path1, $path2): bool { - if (!$this->isReadable($path1)) { + + /** + * @psalm-suppress ParamNameMismatch + */ + public function copy($source, $target): bool { + if (!$this->isReadable($source)) { return false; } - if ($this->file_exists($path2)) { - if ($this->isUpdatable($path2)) { - return $this->storage->copy($path1, $path2); + if ($this->file_exists($target)) { + if ($this->isUpdatable($target)) { + return $this->storage->copy($source, $target); } } else { - $parent = dirname($path2); + $parent = dirname($target); if ($parent === '.') { $parent = ''; } if ($this->isCreatable($parent)) { - return $this->storage->copy($path1, $path2); + return $this->storage->copy($source, $target); } } return false; diff --git a/lib/UserBackend.php b/lib/UserBackend.php index f4df108f..5e7cb406 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -247,7 +247,7 @@ public function getDisplayNames($search = '', $limit = null, $offset = null): ar /** * Check if the password is correct * - * @return string|bool + * @return string|false * * Check if the password is correct without logging in the user * returns the user id or false @@ -377,7 +377,7 @@ public function hasUserListings() { /** * counts the users in the database * - * @return int|bool + * @return int|false */ public function countUsers() { $query = $this->dbConn->getQueryBuilder();