Skip to content

Commit

Permalink
chore(deps): Update nextcloud/coding-standard to v1.2.3
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Sep 9, 2024
1 parent 2c8f72c commit 7cf4672
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 102 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function register(IRegistrationContext $context): void {
$c->get(ISession::class),
$c->get(IMountProviderCollection::class),
$c->get(IDBConnection::class),
$c->get(ICacheFactory::class)->createLocal("groupfolders"),
$c->get(ICacheFactory::class)->createLocal('groupfolders'),
$allowRootShare,
$enableEncryption
);
Expand Down
4 changes: 2 additions & 2 deletions lib/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function configure() {
$this
->setName('groupfolders:list')
->setDescription('List the configured group folders')
->addOption('user', 'u', InputArgument::OPTIONAL, "List group folders applicable for a user");
->addOption('user', 'u', InputArgument::OPTIONAL, 'List group folders applicable for a user');
parent::configure();
}

Expand Down Expand Up @@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
$output->writeln('[]');
} else {
$output->writeln("<info>No folders configured</info>");
$output->writeln('<info>No folders configured</info>');
}
return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Command/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$folderId = $input->getArgument('folder_id');
$all = $input->getOption('all');
if ($folderId === null && !$all) {
$output->writeln("Either a group folder id or --all needs to be provided");
$output->writeln('Either a group folder id or --all needs to be provided');
return -1;
}

if ($folderId !== null && $all) {
$output->writeln("Specifying a group folder id and --all are mutually exclusive");
$output->writeln('Specifying a group folder id and --all are mutually exclusive');
return -1;
}

Expand Down Expand Up @@ -89,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$output->writeln("Scanning group folder with id\t<info>{$folder['id']}</info>", OutputInterface::VERBOSITY_VERBOSE);
if ($scanner instanceof ObjectStoreScanner) {
$output->writeln("Scanning group folders using an object store as primary storage is not supported.");
$output->writeln('Scanning group folders using an object store as primary storage is not supported.');
return -1;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$end = microtime(true);
$statsRow[3] = date('H:i:s', (int)($end - $start));
$output->writeln("", OutputInterface::VERBOSITY_VERBOSE);
$output->writeln('', OutputInterface::VERBOSITY_VERBOSE);
$stats[] = $statsRow;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/DelegationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getAllCircles(): DataResponse {
*/
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/delegation/authorized-groups')]
public function getAuthorizedGroups(string $classname = ""): DataResponse {
public function getAuthorizedGroups(string $classname = ''): DataResponse {
$data = [];
$authorizedGroups = $this->authorizedGroupService->findExistingGroupsForClass($classname);

Expand Down
4 changes: 2 additions & 2 deletions lib/DAV/GroupFoldersHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ private function getFolder(string $name): ?array {
* @return GroupFolderNode
*/
private function getDirectoryForFolder(array $folder): GroupFolderNode {
$userHome = "/" . $this->user->getUID() . "/files";
$node = $this->rootFolder->get($userHome . "/" . $folder['mount_point']);
$userHome = '/' . $this->user->getUID() . '/files';
$node = $this->rootFolder->get($userHome . '/' . $folder['mount_point']);
return new GroupFolderNode(Filesystem::getView($userHome), $node, $folder['folder_id']);
}

Expand Down
78 changes: 39 additions & 39 deletions lib/Folder/FolderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function getGroupFolderRootId(int $rootStorageId): int {
private function joinQueryWithFileCache(IQueryBuilder $query, int $rootStorageId): void {
$query->leftJoin('f', 'filecache', 'c', $query->expr()->andX(
// concat with empty string to work around missing cast to string
$query->expr()->eq('c.name', $query->func()->concat('f.folder_id', $query->expr()->literal(""))),
$query->expr()->eq('c.name', $query->func()->concat('f.folder_id', $query->expr()->literal(''))),
$query->expr()->eq('c.parent', $query->createNamedParameter($this->getGroupFolderRootId($rootStorageId)))
));
}
Expand Down Expand Up @@ -191,7 +191,7 @@ private function getAllFolderMappings(): array {
$query = $this->connection->getQueryBuilder();

$query->select('*')
->from('group_folders_manage', 'g');
->from('group_folders_manage', 'g');

$rows = $query->executeQuery()->fetchAll();

Expand Down Expand Up @@ -324,7 +324,7 @@ private function getAllApplicable(): array {

$query = $queryHelper?->getQueryBuilder() ?? $this->connection->getQueryBuilder();
$query->select('g.folder_id', 'g.group_id', 'g.circle_id', 'g.permissions')
->from('group_folders_groups', 'g');
->from('group_folders_groups', 'g');

$queryHelper?->addCircleDetails('g', 'circle_id');

Expand Down Expand Up @@ -627,15 +627,15 @@ public function getFoldersFromCircleMemberships(IUser $user, int $rootStorageId
'c.encrypted',
'c.parent'
)
->selectAlias('a.permissions', 'group_permissions')
->selectAlias('c.permissions', 'permissions')
->from('group_folders', 'f')
->innerJoin(
'f',
'group_folders_groups',
'a',
$query->expr()->eq('f.folder_id', 'a.folder_id')
);
->selectAlias('a.permissions', 'group_permissions')
->selectAlias('c.permissions', 'permissions')
->from('group_folders', 'f')
->innerJoin(
'f',
'group_folders_groups',
'a',
$query->expr()->eq('f.folder_id', 'a.folder_id')
);

$queryHelper->limitToInheritedMembers('a', 'circle_id', $federatedUser);
$this->joinQueryWithFileCache($query, $rootStorageId);
Expand Down Expand Up @@ -704,17 +704,17 @@ public function removeApplicableGroup(int $folderId, string $groupId): void {
$query = $this->connection->getQueryBuilder();

$query->delete('group_folders_groups')
->where(
$query->expr()->eq(
'folder_id', $query->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)
)
)
->andWhere(
$query->expr()->orX(
$query->expr()->eq('group_id', $query->createNamedParameter($groupId)),
$query->expr()->eq('circle_id', $query->createNamedParameter($groupId))
)
);
->where(
$query->expr()->eq(
'folder_id', $query->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)
)
)
->andWhere(
$query->expr()->orX(
$query->expr()->eq('group_id', $query->createNamedParameter($groupId)),
$query->expr()->eq('circle_id', $query->createNamedParameter($groupId))
)
);
$query->executeStatement();

$this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('The group "%s" was revoked access to the groupfolder with id %d', [$groupId, $folderId]));
Expand All @@ -728,18 +728,18 @@ public function setGroupPermissions(int $folderId, string $groupId, int $permiss
$query = $this->connection->getQueryBuilder();

$query->update('group_folders_groups')
->set('permissions', $query->createNamedParameter($permissions, IQueryBuilder::PARAM_INT))
->where(
$query->expr()->eq(
'folder_id', $query->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)
)
)
->andWhere(
$query->expr()->orX(
$query->expr()->eq('group_id', $query->createNamedParameter($groupId)),
$query->expr()->eq('circle_id', $query->createNamedParameter($groupId))
)
);
->set('permissions', $query->createNamedParameter($permissions, IQueryBuilder::PARAM_INT))
->where(
$query->expr()->eq(
'folder_id', $query->createNamedParameter($folderId, IQueryBuilder::PARAM_INT)
)
)
->andWhere(
$query->expr()->orX(
$query->expr()->eq('group_id', $query->createNamedParameter($groupId)),
$query->expr()->eq('circle_id', $query->createNamedParameter($groupId))
)
);

$query->executeStatement();

Expand All @@ -766,7 +766,7 @@ public function setManageACL(int $folderId, string $type, string $id, bool $mana
}
$query->executeStatement();

$action = $manageAcl ? "given" : "revoked";
$action = $manageAcl ? 'given' : 'revoked';
$this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('The %s "%s" was %s acl management rights to the groupfolder with id %d', [$type, $id, $action, $folderId]));
}

Expand Down Expand Up @@ -841,7 +841,7 @@ public function deleteCircle(string $circleId): void {
$query = $this->connection->getQueryBuilder();

$query->delete('group_folders_groups')
->where($query->expr()->eq('circle_id', $query->createNamedParameter($circleId)));
->where($query->expr()->eq('circle_id', $query->createNamedParameter($circleId)));
$query->executeStatement();

$query = $this->connection->getQueryBuilder();
Expand Down Expand Up @@ -870,7 +870,7 @@ public function setFolderACL(int $folderId, bool $acl): void {
$query->executeStatement();
}

$action = $acl ? "enabled" : "disabled";
$action = $acl ? 'enabled' : 'disabled';
$this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('Advanced permissions for the groupfolder with id %d was %s', [$folderId, $action]));
}

Expand Down Expand Up @@ -965,7 +965,7 @@ public function isCirclesAvailable(?CirclesManager &$circlesManager = null): boo
try {
/** @var CirclesManager $circlesManager */
$circlesManager = Server::get(CirclesManager::class);
} catch (ContainerExceptionInterface | AutoloadNotAllowedException $e) {
} catch (ContainerExceptionInterface|AutoloadNotAllowedException $e) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Migration/Version16000Date20230821085801.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

if ($schema->hasTable("group_folders_versions")) {
if ($schema->hasTable('group_folders_versions')) {
return null;
}

$table = $schema->createTable("group_folders_versions");
$table = $schema->createTable('group_folders_versions');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
Expand Down
4 changes: 2 additions & 2 deletions lib/Mount/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public function __construct(

private function getRootStorageId(): int {
if ($this->rootStorageId === null) {
$cached = $this->cache->get("root_storage_id");
$cached = $this->cache->get('root_storage_id');
if ($cached !== null) {
$this->rootStorageId = $cached;
} else {
$id = $this->getRootFolder()->getStorage()->getCache()->getNumericStorageId();
$this->cache->set("root_storage_id", $id);
$this->cache->set('root_storage_id', $id);
$this->rootStorageId = $id;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function getSection(): string {

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function getName() {

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/Trash/TrashBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function moveToTrash(IStorage $storage, string $internalPath): bool {
$trashStorage->getCache()->moveFromCache($unJailedStorage->getCache(), $unJailedInternalPath, $targetInternalPath);
}
} else {
throw new \Exception("Failed to move groupfolder item to trash");
throw new \Exception('Failed to move groupfolder item to trash');
}
return true;
} else {
Expand Down Expand Up @@ -441,9 +441,9 @@ public function expire(Expiration $expiration): array {
$node = $nodes[$nodeName];

if ($expiration->isExpired($groupTrashItem['deleted_time'], $folder['quota'] > 0 && $folder['quota'] < ($folder['size'] + $sizeInTrash))) {
$this->logger->debug("expiring " . $node->getPath());
$this->logger->debug('expiring ' . $node->getPath());
if ($node->getStorage()->unlink($node->getInternalPath()) === false) {
$this->logger->error("Failed to remove item from trashbin: " . $node->getPath());
$this->logger->error('Failed to remove item from trashbin: ' . $node->getPath());
continue;
}
// only count up after checking if removal is possible
Expand Down
22 changes: 11 additions & 11 deletions lib/Versions/GroupVersionsMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function findAllVersionsForFileId(int $fileId): array {
$qb = $this->db->getQueryBuilder();

$qb->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)));
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)));

return $this->findEntities($qb);
}
Expand All @@ -40,10 +40,10 @@ public function findCurrentVersionForFileId(int $fileId): GroupVersionEntity {
$qb = $this->db->getQueryBuilder();

$qb->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->orderBy('timestamp', 'DESC')
->setMaxResults(1);
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->orderBy('timestamp', 'DESC')
->setMaxResults(1);

return $this->findEntity($qb);
}
Expand All @@ -52,9 +52,9 @@ public function findVersionForFileId(int $fileId, int $timestamp): GroupVersionE
$qb = $this->db->getQueryBuilder();

$qb->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp)));
->from($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp)));

return $this->findEntity($qb);
}
Expand All @@ -63,7 +63,7 @@ public function deleteAllVersionsForFileId(int $fileId): int {
$qb = $this->db->getQueryBuilder();

return $qb->delete($this->getTableName())
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->executeStatement();
->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
->executeStatement();
}
}
4 changes: 2 additions & 2 deletions lib/Versions/VersionsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function getFolderIdForFile(FileInfo $file): int {
/** @var GroupFolderStorage $storage */
return $storage->getFolderId();
} else {
throw new \LogicException("groupfolder version backend called for non groupfolder file");
throw new \LogicException('groupfolder version backend called for non groupfolder file');
}
}

Expand Down Expand Up @@ -363,7 +363,7 @@ private function currentUserHasPermissions(FileInfo $sourceFile, int $permission
$currentUserId = $this->userSession->getUser()?->getUID();

if ($currentUserId === null) {
throw new NotFoundException("No user logged in");
throw new NotFoundException('No user logged in');
}

return ($sourceFile->getPermissions() & $permissions) === $permissions;
Expand Down
Loading

0 comments on commit 7cf4672

Please sign in to comment.