diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-23 15:10:27 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-25 19:34:58 +0200 |
commit | af6de04e9e141466dc229e444ff3f146f4a34765 (patch) | |
tree | 7b93f521865cdecdadb33637dea33bea242e7969 /core | |
parent | 1cc6b3577fdbeadece7e4e6478e7f7755555b41a (diff) | |
download | nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.tar.gz nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.zip |
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'core')
68 files changed, 266 insertions, 266 deletions
diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index c6cf833342f..231caa683af 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -61,13 +61,13 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { ksort($dirList); // drop the newest 3 directories $dirList = array_slice($dirList, 0, -3); - $this->log->info("List of all directories that will be deleted: " . json_encode($dirList)); + $this->log->info('List of all directories that will be deleted: ' . json_encode($dirList)); foreach ($dirList as $dir) { $this->log->info("Removing $dir ..."); \OC_Helper::rmdirr($dir); } - $this->log->info("Cleanup finished"); + $this->log->info('Cleanup finished'); } else { $this->log->info("Could not find updater directory $backupFolderPath - cleanup step not needed"); } diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index c40a1b11f06..b3fcf892720 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -98,7 +98,7 @@ class GenerateMetadataJob extends TimedJob { $nodeSize = $node->getSize(); $nodeLimit = $this->config->getSystemValueInt('metadata_max_filesize', self::DEFAULT_MAX_FILESIZE); if ($nodeSize > $nodeLimit * 1000000) { - $this->logger->debug("Skipping generating metadata for fileid " . $node->getId() . " as its size exceeds configured 'metadata_max_filesize'."); + $this->logger->debug('Skipping generating metadata for fileid ' . $node->getId() . " as its size exceeds configured 'metadata_max_filesize'."); continue; } @@ -111,7 +111,7 @@ class GenerateMetadataJob extends TimedJob { IFilesMetadataManager::PROCESS_LIVE | IFilesMetadataManager::PROCESS_BACKGROUND ); } catch (\Throwable $ex) { - $this->logger->warning("Error while generating metadata for fileid " . $node->getId(), ['exception' => $ex]); + $this->logger->warning('Error while generating metadata for fileid ' . $node->getId(), ['exception' => $ex]); } } } diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index e34417599e2..b351a14c39e 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -57,7 +57,7 @@ class Enable extends Command implements CompletionAwareInterface { protected function execute(InputInterface $input, OutputInterface $output): int { $appIds = $input->getArgument('app-id'); $groups = $this->resolveGroupIds($input->getOption('groups')); - $forceEnable = (bool) $input->getOption('force'); + $forceEnable = (bool)$input->getOption('force'); foreach ($appIds as $appId) { $this->enableApp($appId, $groups, $forceEnable, $output); diff --git a/core/Command/App/GetPath.php b/core/Command/App/GetPath.php index 5eedcbe4182..442af2f3570 100644 --- a/core/Command/App/GetPath.php +++ b/core/Command/App/GetPath.php @@ -40,7 +40,7 @@ class GetPath extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index aa263a8f3bf..4e9c846cbd4 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -56,7 +56,7 @@ class Install extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('app-id'); - $forceEnable = (bool) $input->getOption('force'); + $forceEnable = (bool)$input->getOption('force'); if ($this->appManager->isInstalled($appId)) { $output->writeln($appId . ' already installed'); diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 36422b4727c..b4018c94b79 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -71,7 +71,7 @@ class Update extends Command { } elseif ($input->getOption('all') || $input->getOption('showonly')) { $apps = \OC_App::getAllApps(); } else { - $output->writeln("<error>Please specify an app to update or \"--all\" to update all updatable apps\"</error>"); + $output->writeln('<error>Please specify an app to update or "--all" to update all updatable apps"</error>'); return 1; } diff --git a/core/Command/Background/Delete.php b/core/Command/Background/Delete.php index 45148d2d414..41efaf84665 100644 --- a/core/Command/Background/Delete.php +++ b/core/Command/Background/Delete.php @@ -34,7 +34,7 @@ class Delete extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $jobId = (int) $input->getArgument('job-id'); + $jobId = (int)$input->getArgument('job-id'); $job = $this->jobList->getById($jobId); if ($job === null) { diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index 8e09a28dce6..7fa005cf231 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -42,7 +42,7 @@ class Job extends Command { } protected function execute(InputInterface $input, OutputInterface $output): int { - $jobId = (int) $input->getArgument('job-id'); + $jobId = (int)$input->getArgument('job-id'); $job = $this->jobList->getById($jobId); if ($job === null) { @@ -90,11 +90,11 @@ class Job extends Command { $row = $this->jobList->getDetailsById($jobId); $lastRun = new \DateTime(); - $lastRun->setTimestamp((int) $row['last_run']); + $lastRun->setTimestamp((int)$row['last_run']); $lastChecked = new \DateTime(); - $lastChecked->setTimestamp((int) $row['last_checked']); + $lastChecked->setTimestamp((int)$row['last_checked']); $reservedAt = new \DateTime(); - $reservedAt->setTimestamp((int) $row['reserved_at']); + $reservedAt->setTimestamp((int)$row['reserved_at']); $output->writeln('Job class: ' . get_class($job)); $output->writeln('Arguments: ' . json_encode($job->getArgument())); @@ -110,7 +110,7 @@ class Job extends Command { $output->writeln(''); $output->writeln('Last checked: ' . $lastChecked->format(\DateTimeInterface::ATOM)); - if ((int) $row['reserved_at'] === 0) { + if ((int)$row['reserved_at'] === 0) { $output->writeln('Reserved at: -'); } else { $output->writeln('Reserved at: <comment>' . $reservedAt->format(\DateTimeInterface::ATOM) . '</comment>'); diff --git a/core/Command/Background/JobBase.php b/core/Command/Background/JobBase.php index 756e0ad7b80..7229d7589ee 100644 --- a/core/Command/Background/JobBase.php +++ b/core/Command/Background/JobBase.php @@ -32,11 +32,11 @@ abstract class JobBase extends \OC\Core\Command\Base { } $lastRun = new \DateTime(); - $lastRun->setTimestamp((int) $row['last_run']); + $lastRun->setTimestamp((int)$row['last_run']); $lastChecked = new \DateTime(); - $lastChecked->setTimestamp((int) $row['last_checked']); + $lastChecked->setTimestamp((int)$row['last_checked']); $reservedAt = new \DateTime(); - $reservedAt->setTimestamp((int) $row['reserved_at']); + $reservedAt->setTimestamp((int)$row['reserved_at']); $output->writeln('Job class: ' . get_class($job)); $output->writeln('Arguments: ' . json_encode($job->getArgument())); @@ -52,7 +52,7 @@ abstract class JobBase extends \OC\Core\Command\Base { $output->writeln(''); $output->writeln('Last checked: ' . $lastChecked->format(\DateTimeInterface::ATOM)); - if ((int) $row['reserved_at'] === 0) { + if ((int)$row['reserved_at'] === 0) { $output->writeln('Reserved at: -'); } else { $output->writeln('Reserved at: <comment>' . $reservedAt->format(\DateTimeInterface::ATOM) . '</comment>'); diff --git a/core/Command/Background/JobWorker.php b/core/Command/Background/JobWorker.php index 8e14397d350..8289021887b 100644 --- a/core/Command/Background/JobWorker.php +++ b/core/Command/Background/JobWorker.php @@ -160,16 +160,16 @@ class JobWorker extends JobBase { private function parseStopAfter(string $value): ?int { if (is_numeric($value)) { - return (int) $value; + return (int)$value; } if (preg_match("/^(\d+)s$/i", $value, $matches)) { - return (int) $matches[0]; + return (int)$matches[0]; } if (preg_match("/^(\d+)m$/i", $value, $matches)) { - return 60 * ((int) $matches[0]); + return 60 * ((int)$matches[0]); } if (preg_match("/^(\d+)h$/i", $value, $matches)) { - return 60 * 60 * ((int) $matches[0]); + return 60 * 60 * ((int)$matches[0]); } return null; } diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index c84931c81e4..005f0418579 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -53,7 +53,7 @@ class ListCommand extends Base { $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int)$input->getOption('offset'))); $this->writeTableInOutputFormat($input, $output, $jobsInfo); if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN && count($jobsInfo) >= $limit) { - $output->writeln("\n<comment>Output is currently limited to " . $limit . " jobs. Specify `-l, --limit[=LIMIT]` to override.</comment>"); + $output->writeln("\n<comment>Output is currently limited to " . $limit . ' jobs. Specify `-l, --limit[=LIMIT]` to override.</comment>'); } return 0; } diff --git a/core/Command/Check.php b/core/Command/Check.php index b1faa784274..dcc9b089e1c 100644 --- a/core/Command/Check.php +++ b/core/Command/Check.php @@ -31,7 +31,7 @@ class Check extends Base { $errors = \OC_Util::checkServer($this->config); if (!empty($errors)) { $errors = array_map(function ($item) { - return (string) $item['error']; + return (string)$item['error']; }, $errors); $this->writeArrayInOutputFormat($input, $output, $errors); diff --git a/core/Command/Config/App/GetConfig.php b/core/Command/Config/App/GetConfig.php index 2fd632384a2..f64efd3feaa 100644 --- a/core/Command/Config/App/GetConfig.php +++ b/core/Command/Config/App/GetConfig.php @@ -56,7 +56,7 @@ class GetConfig extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index f898271a6c1..461c024d038 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -177,14 +177,14 @@ class SetConfig extends Base { break; case IAppConfig::VALUE_INT: - if ($value !== ((string) ((int) $value))) { + if ($value !== ((string)((int)$value))) { throw new AppConfigIncorrectTypeException('Value is not an integer'); } $updated = $this->appConfig->setValueInt($appName, $configName, (int)$value, $lazy, $sensitive); break; case IAppConfig::VALUE_FLOAT: - if ($value !== ((string) ((float) $value))) { + if ($value !== ((string)((float)$value))) { throw new AppConfigIncorrectTypeException('Value is not a float'); } $updated = $this->appConfig->setValueFloat($appName, $configName, (float)$value, $lazy, $sensitive); diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index c9c40da34f5..c0a9623a84e 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -43,7 +43,7 @@ class GetConfig extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index ac132dbac89..4d23c191ac1 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -94,8 +94,8 @@ class SetConfig extends Base { throw new \InvalidArgumentException('Non-numeric value specified'); } return [ - 'value' => (int) $value, - 'readable-value' => 'integer ' . (int) $value, + 'value' => (int)$value, + 'readable-value' => 'integer ' . (int)$value, ]; case 'double': @@ -104,8 +104,8 @@ class SetConfig extends Base { throw new \InvalidArgumentException('Non-numeric value specified'); } return [ - 'value' => (double) $value, - 'readable-value' => 'double ' . (double) $value, + 'value' => (float)$value, + 'readable-value' => 'double ' . (float)$value, ]; case 'boolean': @@ -136,7 +136,7 @@ class SetConfig extends Base { ]; case 'string': - $value = (string) $value; + $value = (string)$value; return [ 'value' => $value, 'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value, diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 198a55979c7..33b4b24a6cb 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -37,7 +37,7 @@ class AddMissingColumns extends Command { $this ->setName('db:add-missing-columns') ->setDescription('Add missing optional columns to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 285b9330281..ec36400d291 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -37,7 +37,7 @@ class AddMissingIndices extends Command { $this ->setName('db:add-missing-indices') ->setDescription('Add missing indices to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php index 073ce7538cc..1eb11c894fa 100644 --- a/core/Command/Db/AddMissingPrimaryKeys.php +++ b/core/Command/Db/AddMissingPrimaryKeys.php @@ -37,7 +37,7 @@ class AddMissingPrimaryKeys extends Command { $this ->setName('db:add-missing-primary-keys') ->setDescription('Add missing primary keys to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index 618e15de3f4..8a2abecc804 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -34,14 +34,14 @@ class ConvertMysqlToMB4 extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { - $output->writeln("This command is only valid for MySQL/MariaDB databases."); + $output->writeln('This command is only valid for MySQL/MariaDB databases.'); return 1; } $tools = new MySqlTools(); if (!$tools->supports4ByteCharset($this->connection)) { $url = $this->urlGenerator->linkToDocs('admin-mysql-utf8mb4'); - $output->writeln("The database is not properly setup to use the charset utf8mb4."); + $output->writeln('The database is not properly setup to use the charset utf8mb4.'); $output->writeln("For more information please read the documentation at $url"); return 1; } diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index 1d30d8d08cc..62d5ad201ed 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -112,7 +112,7 @@ class {{classname}} extends SimpleMigrationStep { if ($fullVersion) { [$major, $minor] = explode('.', $fullVersion); - $shouldVersion = (string) ((int)$major * 1000 + (int)$minor); + $shouldVersion = (string)((int)$major * 1000 + (int)$minor); if ($version !== $shouldVersion) { $output->writeln('<comment>Unexpected migration version for current version: ' . $fullVersion . '</comment>'); $output->writeln('<comment> - Pattern: XYYY </comment>'); diff --git a/core/Command/Db/Migrations/PreviewCommand.php b/core/Command/Db/Migrations/PreviewCommand.php index 5a0e766ee6d..b15f89765b9 100644 --- a/core/Command/Db/Migrations/PreviewCommand.php +++ b/core/Command/Db/Migrations/PreviewCommand.php @@ -100,7 +100,7 @@ class PreviewCommand extends Command { $attributesStr[] = '<comment>(metadata not set)</comment>'; } foreach($attributes as $attribute) { - $definition = '<info>' . $attribute->definition() . "</info>"; + $definition = '<info>' . $attribute->definition() . '</info>'; $definition .= empty($attribute->getDescription()) ? '' : "\n " . $attribute->getDescription(); $definition .= empty($attribute->getNotes()) ? '' : "\n <comment>" . implode("</comment>\n <comment>", $attribute->getNotes()) . '</comment>'; $attributesStr[] = $definition; diff --git a/core/Command/Db/SchemaEncoder.php b/core/Command/Db/SchemaEncoder.php index d36a34e8583..beae3a81264 100644 --- a/core/Command/Db/SchemaEncoder.php +++ b/core/Command/Db/SchemaEncoder.php @@ -90,7 +90,7 @@ class SchemaEncoder { if ($platform instanceof PostgreSqlPlatform) { $name = $table->getName() . '_pkey'; } elseif ($platform instanceof AbstractMySQLPlatform) { - $name = "PRIMARY"; + $name = 'PRIMARY'; } else { $name = $index->getName(); } diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index a4431b36f2f..76cde1b8e77 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -79,10 +79,10 @@ class ChangeKeyStorageRoot extends Command { * @throws \Exception */ protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) { - $output->writeln("Start to move keys:"); + $output->writeln('Start to move keys:'); if ($this->rootView->is_dir($oldRoot) === false) { - $output->writeln("No old keys found: Nothing needs to be moved"); + $output->writeln('No old keys found: Nothing needs to be moved'); return false; } diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index 1de14debdec..92e2ba787e2 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -81,10 +81,10 @@ class DecryptAll extends Command { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when starting decryption,"); - $output->writeln("in order to load the relevant encryption modules correctly."); - $output->writeln("Your instance will automatically be put to maintenance mode"); - $output->writeln("during the actual decryption of the files."); + $output->writeln('Maintenance mode must be disabled when starting decryption,'); + $output->writeln('in order to load the relevant encryption modules correctly.'); + $output->writeln('Your instance will automatically be put to maintenance mode'); + $output->writeln('during the actual decryption of the files.'); return 1; } diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index a5cd403d3a7..b1f35b05bc9 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -33,8 +33,8 @@ class ListModules extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when listing modules"); - $output->writeln("in order to list the relevant encryption modules correctly."); + $output->writeln('Maintenance mode must be disabled when listing modules'); + $output->writeln('in order to list the relevant encryption modules correctly.'); return 1; } diff --git a/core/Command/Encryption/MigrateKeyStorage.php b/core/Command/Encryption/MigrateKeyStorage.php index 486a6149622..ddd17eaa0b7 100644 --- a/core/Command/Encryption/MigrateKeyStorage.php +++ b/core/Command/Encryption/MigrateKeyStorage.php @@ -40,9 +40,9 @@ class MigrateKeyStorage extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $root = $this->util->getKeyStorageRoot(); - $output->writeln("Updating key storage format"); + $output->writeln('Updating key storage format'); $this->updateKeys($root, $output); - $output->writeln("Key storage format successfully updated"); + $output->writeln('Key storage format successfully updated'); return 0; } @@ -56,7 +56,7 @@ class MigrateKeyStorage extends Command { * @throws \Exception */ protected function updateKeys(string $root, OutputInterface $output): bool { - $output->writeln("Start to update the keys:"); + $output->writeln('Start to update the keys:'); $this->updateSystemKeys($root); $this->updateUsersKeys($root, $output); diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php index 789138fac95..d10872afd38 100644 --- a/core/Command/Encryption/SetDefaultModule.php +++ b/core/Command/Encryption/SetDefaultModule.php @@ -39,8 +39,8 @@ class SetDefaultModule extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when setting default module,"); - $output->writeln("in order to load the relevant encryption modules correctly."); + $output->writeln('Maintenance mode must be disabled when setting default module,'); + $output->writeln('in order to load the relevant encryption modules correctly.'); return 1; } diff --git a/core/Command/FilesMetadata/Get.php b/core/Command/FilesMetadata/Get.php index eec01661e94..0b022d0951b 100644 --- a/core/Command/FilesMetadata/Get.php +++ b/core/Command/FilesMetadata/Get.php @@ -31,35 +31,35 @@ class Get extends Command { protected function configure(): void { $this->setName('metadata:get') - ->setDescription('get stored metadata about a file, by its id') - ->addArgument( - 'fileId', - InputArgument::REQUIRED, - 'id of the file document' - ) - ->addArgument( - 'userId', - InputArgument::OPTIONAL, - 'file owner' - ) - ->addOption( - 'as-array', - '', - InputOption::VALUE_NONE, - 'display metadata as a simple key=>value array' - ) - ->addOption( - 'refresh', - '', - InputOption::VALUE_NONE, - 'refresh metadata' - ) - ->addOption( - 'reset', - '', - InputOption::VALUE_NONE, - 'refresh metadata from scratch' - ); + ->setDescription('get stored metadata about a file, by its id') + ->addArgument( + 'fileId', + InputArgument::REQUIRED, + 'id of the file document' + ) + ->addArgument( + 'userId', + InputArgument::OPTIONAL, + 'file owner' + ) + ->addOption( + 'as-array', + '', + InputOption::VALUE_NONE, + 'display metadata as a simple key=>value array' + ) + ->addOption( + 'refresh', + '', + InputOption::VALUE_NONE, + 'refresh metadata' + ) + ->addOption( + 'reset', + '', + InputOption::VALUE_NONE, + 'refresh metadata from scratch' + ); } /** diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index e86d8d0a5bd..0a3006ac1d7 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -34,7 +34,7 @@ class File extends Command { private FileUtils $fileUtils, private \OC\Encryption\Util $encryptionUtil ) { - $this->l10n = $l10nFactory->get("core"); + $this->l10n = $l10nFactory->get('core'); parent::__construct(); $this->rootView = new View(); } @@ -43,9 +43,9 @@ class File extends Command { $this ->setName('info:file') ->setDescription('get information for a file') - ->addArgument('file', InputArgument::REQUIRED, "File id or path") - ->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders") - ->addOption('storage-tree', null, InputOption::VALUE_NONE, "Show storage and cache wrapping tree"); + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') + ->addOption('children', 'c', InputOption::VALUE_NONE, 'List children of folders') + ->addOption('storage-tree', null, InputOption::VALUE_NONE, 'Show storage and cache wrapping tree'); } public function execute(InputInterface $input, OutputInterface $output): int { @@ -58,50 +58,50 @@ class File extends Command { } $output->writeln($node->getName()); - $output->writeln(" fileid: " . $node->getId()); - $output->writeln(" mimetype: " . $node->getMimetype()); - $output->writeln(" modified: " . (string)$this->l10n->l("datetime", $node->getMTime())); - $output->writeln(" " . ($node->isEncrypted() ? "encrypted" : "not encrypted")); + $output->writeln(' fileid: ' . $node->getId()); + $output->writeln(' mimetype: ' . $node->getMimetype()); + $output->writeln(' modified: ' . (string)$this->l10n->l('datetime', $node->getMTime())); + $output->writeln(' ' . ($node->isEncrypted() ? 'encrypted' : 'not encrypted')); if ($node->isEncrypted()) { $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath()); if ($this->rootView->file_exists($keyPath)) { - $output->writeln(" encryption key at: " . $keyPath); + $output->writeln(' encryption key at: ' . $keyPath); } else { - $output->writeln(" <error>encryption key not found</error> should be located at: " . $keyPath); + $output->writeln(' <error>encryption key not found</error> should be located at: ' . $keyPath); } } - $output->writeln(" size: " . Util::humanFileSize($node->getSize())); - $output->writeln(" etag: " . $node->getEtag()); + $output->writeln(' size: ' . Util::humanFileSize($node->getSize())); + $output->writeln(' etag: ' . $node->getEtag()); if ($node instanceof Folder) { $children = $node->getDirectoryListing(); $childSize = array_sum(array_map(function (Node $node) { return $node->getSize(); }, $children)); if ($childSize != $node->getSize()) { - $output->writeln(" <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>."); - $output->writeln(" Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this."); + $output->writeln(' <error>warning: folder has a size of ' . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . '</error>.'); + $output->writeln(' Run <info>occ files:scan --path ' . $node->getPath() . '</info> to attempt to resolve this.'); } if ($showChildren) { - $output->writeln(" children: " . count($children) . ":"); + $output->writeln(' children: ' . count($children) . ':'); foreach ($children as $child) { - $output->writeln(" - " . $child->getName()); + $output->writeln(' - ' . $child->getName()); } } else { - $output->writeln(" children: " . count($children) . " (use <info>--children</info> option to list)"); + $output->writeln(' children: ' . count($children) . ' (use <info>--children</info> option to list)'); } } $this->outputStorageDetails($node->getMountPoint(), $node, $input, $output); $filesPerUser = $this->fileUtils->getFilesByUser($node); - $output->writeln(""); - $output->writeln("The following users have access to the file"); - $output->writeln(""); + $output->writeln(''); + $output->writeln('The following users have access to the file'); + $output->writeln(''); foreach ($filesPerUser as $user => $files) { $output->writeln("$user:"); foreach ($files as $userFile) { - $output->writeln(" " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); + $output->writeln(' ' . $userFile->getPath() . ': ' . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); $mount = $userFile->getMountPoint(); - $output->writeln(" " . $this->fileUtils->formatMountType($mount)); + $output->writeln(' ' . $this->fileUtils->formatMountType($mount)); } } @@ -118,7 +118,7 @@ class File extends Command { return; } if (!$storage->instanceOfStorage(IHomeStorage::class)) { - $output->writeln(" mounted at: " . $mountPoint->getMountPoint()); + $output->writeln(' mounted at: ' . $mountPoint->getMountPoint()); } if ($storage->instanceOfStorage(ObjectStoreStorage::class)) { /** @var ObjectStoreStorage $storage */ @@ -126,9 +126,9 @@ class File extends Command { $parts = explode(':', $objectStoreId); /** @var string $bucket */ $bucket = array_pop($parts); - $output->writeln(" bucket: " . $bucket); + $output->writeln(' bucket: ' . $bucket); if ($node instanceof \OC\Files\Node\File) { - $output->writeln(" object id: " . $storage->getURN($node->getId())); + $output->writeln(' object id: ' . $storage->getURN($node->getId())); try { $fh = $node->fopen('r'); if (!$fh) { @@ -137,23 +137,23 @@ class File extends Command { $stat = fstat($fh); fclose($fh); if ($stat['size'] !== $node->getSize()) { - $output->writeln(" <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired"); + $output->writeln(' <error>warning: object had a size of ' . $stat['size'] . ' but cache entry has a size of ' . $node->getSize() . '</error>. This should have been automatically repaired'); } } catch (\Exception $e) { - $output->writeln(" <error>warning: object not found in bucket</error>"); + $output->writeln(' <error>warning: object not found in bucket</error>'); } } } else { if (!$storage->file_exists($node->getInternalPath())) { - $output->writeln(" <error>warning: file not found in storage</error>"); + $output->writeln(' <error>warning: file not found in storage</error>'); } } if ($mountPoint instanceof ExternalMountPoint) { $storageConfig = $mountPoint->getStorageConfig(); - $output->writeln(" external storage id: " . $storageConfig->getId()); - $output->writeln(" external type: " . $storageConfig->getBackend()->getText()); + $output->writeln(' external storage id: ' . $storageConfig->getId()); + $output->writeln(' external type: ' . $storageConfig->getBackend()->getText()); } elseif ($mountPoint instanceof GroupMountPoint) { - $output->writeln(" groupfolder id: " . $mountPoint->getFolderId()); + $output->writeln(' groupfolder id: ' . $mountPoint->getFolderId()); } if ($input->getOption('storage-tree')) { $storageTmp = $storage; @@ -162,7 +162,7 @@ class File extends Command { $storageTmp = $storageTmp->getWrapperStorage(); $storageClass .= "\n\t".'> '.get_class($storageTmp).' (cache:'.get_class($storageTmp->getCache()).')'; } - $output->writeln(" storage wrapping: " . $storageClass); + $output->writeln(' storage wrapping: ' . $storageClass); } } diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php index 6c490d31c3d..df7dba175ba 100644 --- a/core/Command/Info/FileUtils.php +++ b/core/Command/Info/FileUtils.php @@ -84,18 +84,18 @@ class FileUtils { public function formatPermissions(string $type, int $permissions): string { if ($permissions == Constants::PERMISSION_ALL || ($type === 'file' && $permissions == (Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE))) { - return "full permissions"; + return 'full permissions'; } $perms = []; - $allPerms = [Constants::PERMISSION_READ => "read", Constants::PERMISSION_UPDATE => "update", Constants::PERMISSION_CREATE => "create", Constants::PERMISSION_DELETE => "delete", Constants::PERMISSION_SHARE => "share"]; + $allPerms = [Constants::PERMISSION_READ => 'read', Constants::PERMISSION_UPDATE => 'update', Constants::PERMISSION_CREATE => 'create', Constants::PERMISSION_DELETE => 'delete', Constants::PERMISSION_SHARE => 'share']; foreach ($allPerms as $perm => $name) { if (($permissions & $perm) === $perm) { $perms[] = $name; } } - return implode(", ", $perms); + return implode(', ', $perms); } /** @@ -105,29 +105,29 @@ class FileUtils { public function formatMountType(IMountPoint $mountPoint): string { $storage = $mountPoint->getStorage(); if ($storage && $storage->instanceOfStorage(IHomeStorage::class)) { - return "home storage"; + return 'home storage'; } elseif ($mountPoint instanceof SharedMount) { $share = $mountPoint->getShare(); $shares = $mountPoint->getGroupedShares(); $sharedBy = array_map(function (IShare $share) { $shareType = $this->formatShareType($share); if ($shareType) { - return $share->getSharedBy() . " (via " . $shareType . " " . $share->getSharedWith() . ")"; + return $share->getSharedBy() . ' (via ' . $shareType . ' ' . $share->getSharedWith() . ')'; } else { return $share->getSharedBy(); } }, $shares); - $description = "shared by " . implode(', ', $sharedBy); + $description = 'shared by ' . implode(', ', $sharedBy); if ($share->getSharedBy() !== $share->getShareOwner()) { - $description .= " owned by " . $share->getShareOwner(); + $description .= ' owned by ' . $share->getShareOwner(); } return $description; } elseif ($mountPoint instanceof GroupMountPoint) { - return "groupfolder " . $mountPoint->getFolderId(); + return 'groupfolder ' . $mountPoint->getFolderId(); } elseif ($mountPoint instanceof ExternalMountPoint) { - return "external storage " . $mountPoint->getStorageConfig()->getId(); + return 'external storage ' . $mountPoint->getStorageConfig()->getId(); } elseif ($mountPoint instanceof CircleMount) { - return "circle"; + return 'circle'; } return get_class($mountPoint); } @@ -135,17 +135,17 @@ class FileUtils { public function formatShareType(IShare $share): ?string { switch ($share->getShareType()) { case IShare::TYPE_GROUP: - return "group"; + return 'group'; case IShare::TYPE_CIRCLE: - return "circle"; + return 'circle'; case IShare::TYPE_DECK: - return "deck"; + return 'deck'; case IShare::TYPE_ROOM: - return "room"; + return 'room'; case IShare::TYPE_USER: return null; default: - return "Unknown (" . $share->getShareType() . ")"; + return 'Unknown (' . $share->getShareType() . ')'; } } @@ -197,7 +197,7 @@ class FileUtils { $count += 1; /** @var Node $child */ - $output->writeln("$prefix- " . $child->getName() . ": <info>" . Util::humanFileSize($child->getSize()) . "</info>"); + $output->writeln("$prefix- " . $child->getName() . ': <info>' . Util::humanFileSize($child->getSize()) . '</info>'); if ($child instanceof Folder) { $recurseSizeLimits = $sizeLimits; if (!$all) { @@ -212,7 +212,7 @@ class FileUtils { } sort($recurseSizeLimits); } - $recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . " ", $recurseSizeLimits, $all); + $recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . ' ', $recurseSizeLimits, $all); $sizeLimits = array_slice($sizeLimits, $recurseCount); $count += $recurseCount; } diff --git a/core/Command/Info/Space.php b/core/Command/Info/Space.php index 645deae04b2..35c1d5c3228 100644 --- a/core/Command/Info/Space.php +++ b/core/Command/Info/Space.php @@ -27,9 +27,9 @@ class Space extends Command { $this ->setName('info:file:space') ->setDescription('Summarize space usage of specified folder') - ->addArgument('file', InputArgument::REQUIRED, "File id or path") - ->addOption('count', 'c', InputOption::VALUE_REQUIRED, "Number of items to display", 25) - ->addOption('all', 'a', InputOption::VALUE_NONE, "Display all items"); + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') + ->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of items to display', 25) + ->addOption('all', 'a', InputOption::VALUE_NONE, 'Display all items'); } public function execute(InputInterface $input, OutputInterface $output): int { @@ -41,7 +41,7 @@ class Space extends Command { $output->writeln("<error>file $fileInput not found</error>"); return 1; } - $output->writeln($node->getName() . ": <info>" . Util::humanFileSize($node->getSize()) . "</info>"); + $output->writeln($node->getName() . ': <info>' . Util::humanFileSize($node->getSize()) . '</info>'); if ($node instanceof Folder) { $limits = $all ? [] : array_fill(0, $count - 1, 0); $this->fileUtils->outputLargeFilesTree($output, $node, '', $limits, $all); diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index bfe955f9979..a954beb406d 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -46,7 +46,7 @@ class Install extends Command { ->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'Login of the admin account', 'admin') ->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account') ->addOption('admin-email', null, InputOption::VALUE_OPTIONAL, 'E-Mail of the admin account') - ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data"); + ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT.'/data'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -85,7 +85,7 @@ class Install extends Command { if ($setupHelper->shouldRemoveCanInstallFile()) { $output->writeln('<warn>Could not remove CAN_INSTALL from the config folder. Please remove this file manually.</warn>'); } - $output->writeln("Nextcloud was successfully installed"); + $output->writeln('Nextcloud was successfully installed'); return 0; } @@ -99,7 +99,7 @@ class Install extends Command { $db = strtolower($input->getOption('database')); if (!in_array($db, $supportedDatabases)) { - throw new InvalidArgumentException("Database <$db> is not supported. " . implode(", ", $supportedDatabases) . " are supported."); + throw new InvalidArgumentException("Database <$db> is not supported. " . implode(', ', $supportedDatabases) . ' are supported.'); } $dbUser = $input->getOption('database-user'); @@ -117,7 +117,7 @@ class Install extends Command { $dbHost .= ':' . $dbPort; } if ($input->hasParameterOption('--database-pass')) { - $dbPass = (string) $input->getOption('database-pass'); + $dbPass = (string)$input->getOption('database-pass'); } $adminLogin = $input->getOption('admin-user'); $adminPassword = $input->getOption('admin-pass'); @@ -126,10 +126,10 @@ class Install extends Command { if ($db !== 'sqlite') { if (is_null($dbUser)) { - throw new InvalidArgumentException("Database account not provided."); + throw new InvalidArgumentException('Database account not provided.'); } if (is_null($dbName)) { - throw new InvalidArgumentException("Database name not provided."); + throw new InvalidArgumentException('Database name not provided.'); } if (is_null($dbPass)) { /** @var QuestionHelper $helper */ diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php index 56a95b68ed7..71bc50b0bb8 100644 --- a/core/Command/Maintenance/RepairShareOwnership.php +++ b/core/Command/Maintenance/RepairShareOwnership.php @@ -33,7 +33,7 @@ class RepairShareOwnership extends Command { ->setName('maintenance:repair-share-owner') ->setDescription('repair invalid share-owner entries in the database') ->addOption('no-confirm', 'y', InputOption::VALUE_NONE, "Don't ask for confirmation before repairing the shares") - ->addArgument('user', InputArgument::OPTIONAL, "User to fix incoming shares for, if omitted all users will be fixed"); + ->addArgument('user', InputArgument::OPTIONAL, 'User to fix incoming shares for, if omitted all users will be fixed'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -51,13 +51,13 @@ class RepairShareOwnership extends Command { } if ($shares) { - $output->writeln(""); - $output->writeln("Found " . count($shares) . " shares with invalid share owner"); + $output->writeln(''); + $output->writeln('Found ' . count($shares) . ' shares with invalid share owner'); foreach ($shares as $share) { /** @var array{shareId: int, fileTarget: string, initiator: string, receiver: string, owner: string, mountOwner: string} $share */ $output->writeln(" - share {$share['shareId']} from \"{$share['initiator']}\" to \"{$share['receiver']}\" at \"{$share['fileTarget']}\", owned by \"{$share['owner']}\", that should be owned by \"{$share['mountOwner']}\""); } - $output->writeln(""); + $output->writeln(''); if (!$noConfirm) { $helper = $this->getHelper('question'); @@ -67,10 +67,10 @@ class RepairShareOwnership extends Command { return 0; } } - $output->writeln("Repairing " . count($shares) . " shares"); + $output->writeln('Repairing ' . count($shares) . ' shares'); $this->repairShares($shares); } else { - $output->writeln("Found no shares with invalid share owner"); + $output->writeln('Found no shares with invalid share owner'); } return 0; @@ -96,7 +96,7 @@ class RepairShareOwnership extends Command { foreach ($brokenShares as $share) { $found[] = [ - 'shareId' => (int) $share['id'], + 'shareId' => (int)$share['id'], 'fileTarget' => $share['file_target'], 'initiator' => $share['uid_initiator'], 'receiver' => $share['share_with'], @@ -130,7 +130,7 @@ class RepairShareOwnership extends Command { foreach ($brokenShares as $share) { $found[] = [ - 'shareId' => (int) $share['id'], + 'shareId' => (int)$share['id'], 'fileTarget' => $share['file_target'], 'initiator' => $share['uid_initiator'], 'receiver' => $share['share_with'], diff --git a/core/Command/Memcache/RedisCommand.php b/core/Command/Memcache/RedisCommand.php index 4da627c6b84..429dd28f3b3 100644 --- a/core/Command/Memcache/RedisCommand.php +++ b/core/Command/Memcache/RedisCommand.php @@ -34,7 +34,7 @@ class RedisCommand extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $command = $input->getArgument('redis-command'); if (!$this->redisFactory->isAvailable()) { - $output->writeln("<error>No redis server configured</error>"); + $output->writeln('<error>No redis server configured</error>'); return 1; } try { @@ -47,7 +47,7 @@ class RedisCommand extends Base { $redis->setOption(\Redis::OPT_REPLY_LITERAL, true); $result = $redis->rawCommand(...$command); if ($result === false) { - $output->writeln("<error>Redis command failed</error>"); + $output->writeln('<error>Redis command failed</error>'); return 1; } $output->writeln($result); diff --git a/core/Command/Preview/Generate.php b/core/Command/Preview/Generate.php index 0a36217405a..222c42f613b 100644 --- a/core/Command/Preview/Generate.php +++ b/core/Command/Preview/Generate.php @@ -33,15 +33,15 @@ class Generate extends Command { $this ->setName('preview:generate') ->setDescription('generate a preview for a file') - ->addArgument("file", InputArgument::REQUIRED, "path or fileid of the file to generate the preview for") - ->addOption("size", "s", InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, "size to generate the preview for in pixels, defaults to 64x64", ["64x64"]) - ->addOption("crop", "c", InputOption::VALUE_NONE, "crop the previews instead of maintaining aspect ratio") - ->addOption("mode", "m", InputOption::VALUE_REQUIRED, "mode for generating uncropped previews, 'cover' or 'fill'", IPreview::MODE_FILL); + ->addArgument('file', InputArgument::REQUIRED, 'path or fileid of the file to generate the preview for') + ->addOption('size', 's', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'size to generate the preview for in pixels, defaults to 64x64', ['64x64']) + ->addOption('crop', 'c', InputOption::VALUE_NONE, 'crop the previews instead of maintaining aspect ratio') + ->addOption('mode', 'm', InputOption::VALUE_REQUIRED, "mode for generating uncropped previews, 'cover' or 'fill'", IPreview::MODE_FILL); } protected function execute(InputInterface $input, OutputInterface $output): int { - $fileInput = $input->getArgument("file"); - $sizes = $input->getOption("size"); + $fileInput = $input->getArgument('file'); + $sizes = $input->getOption('size'); $sizes = array_map(function (string $size) use ($output) { if (str_contains($size, 'x')) { $sizeParts = explode('x', $size, 2); @@ -53,18 +53,18 @@ class Generate extends Command { return null; } - return array_map("intval", $sizeParts); + return array_map('intval', $sizeParts); }, $sizes); if (in_array(null, $sizes)) { return 1; } - $mode = $input->getOption("mode"); + $mode = $input->getOption('mode'); if ($mode !== IPreview::MODE_FILL && $mode !== IPreview::MODE_COVER) { $output->writeln("<error>Invalid mode $mode</error>"); return 1; } - $crop = $input->getOption("crop"); + $crop = $input->getOption('crop'); $file = $this->getFile($fileInput); if (!$file) { $output->writeln("<error>File $fileInput not found</error>"); @@ -76,7 +76,7 @@ class Generate extends Command { } if (!$this->previewManager->isAvailable($file)) { - $output->writeln("<error>No preview generator available for file of type" . $file->getMimetype() . "</error>"); + $output->writeln('<error>No preview generator available for file of type' . $file->getMimetype() . '</error>'); return 1; } @@ -91,9 +91,9 @@ class Generate extends Command { $this->previewManager->generatePreviews($file, $specifications); if (count($specifications) > 1) { - $output->writeln("generated <info>" . count($specifications) . "</info> previews"); + $output->writeln('generated <info>' . count($specifications) . '</info> previews'); } else { - $output->writeln("preview generated"); + $output->writeln('preview generated'); } return 0; } diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index 2b24e993b4f..641e204e050 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -59,11 +59,11 @@ class Repair extends Command { $thresholdInMiB = round($this->memoryTreshold / 1024 / 1024, 1); $output->writeln("Memory limit is $limitInMiB MiB"); $output->writeln("Memory threshold is $thresholdInMiB MiB"); - $output->writeln(""); + $output->writeln(''); $memoryCheckEnabled = true; } else { - $output->writeln("No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit."); - $output->writeln(""); + $output->writeln('No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit.'); + $output->writeln(''); $memoryCheckEnabled = false; } @@ -72,16 +72,16 @@ class Repair extends Command { if ($dryMode) { - $output->writeln("INFO: The migration is run in dry mode and will not modify anything."); - $output->writeln(""); + $output->writeln('INFO: The migration is run in dry mode and will not modify anything.'); + $output->writeln(''); } elseif ($deleteMode) { - $output->writeln("WARN: The migration will _DELETE_ old previews."); - $output->writeln(""); + $output->writeln('WARN: The migration will _DELETE_ old previews.'); + $output->writeln(''); } $instanceId = $this->config->getSystemValueString('instanceid'); - $output->writeln("This will migrate all previews from the old preview location to the new one."); + $output->writeln('This will migrate all previews from the old preview location to the new one.'); $output->writeln(''); $output->writeln('Fetching previews that need to be migrated …'); @@ -122,13 +122,13 @@ class Repair extends Command { } if ($total === 0) { - $output->writeln("All previews are already migrated."); + $output->writeln('All previews are already migrated.'); return 0; } $output->writeln("A total of $total preview files need to be migrated."); - $output->writeln(""); - $output->writeln("The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This will finish the current batch and then stop the migration. This migration can then just be started and it will continue."); + $output->writeln(''); + $output->writeln('The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This will finish the current batch and then stop the migration. This migration can then just be started and it will continue.'); if ($input->getOption('batch')) { $output->writeln('Batch mode active: migration is started right away.'); @@ -144,12 +144,12 @@ class Repair extends Command { // register the SIGINT listener late in here to be able to exit in the early process of this command pcntl_signal(SIGINT, [$this, 'sigIntHandler']); - $output->writeln(""); - $output->writeln(""); + $output->writeln(''); + $output->writeln(''); $section1 = $output->section(); $section2 = $output->section(); $progressBar = new ProgressBar($section2, $total); - $progressBar->setFormat("%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%"); + $progressBar->setFormat('%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%'); $time = (new \DateTime())->format('H:i:s'); $progressBar->setMessage("$time Starting …"); $progressBar->maxSecondsBetweenRedraws(0.2); @@ -191,10 +191,10 @@ class Repair extends Command { $memoryUsage = memory_get_usage(); if ($memoryCheckEnabled && $memoryUsage > $this->memoryTreshold) { - $section1->writeln(""); - $section1->writeln(""); - $section1->writeln(""); - $section1->writeln(" Stopped process 25 MB before reaching the memory limit to avoid a hard crash."); + $section1->writeln(''); + $section1->writeln(''); + $section1->writeln(''); + $section1->writeln(' Stopped process 25 MB before reaching the memory limit to avoid a hard crash.'); $time = (new \DateTime())->format('H:i:s'); $section1->writeln("$time Reached memory limit and stopped to avoid hard crash."); return 1; @@ -205,7 +205,7 @@ class Repair extends Command { $section1->writeln(" Locking \"$lockName\" …", OutputInterface::VERBOSITY_VERBOSE); $this->lockingProvider->acquireLock($lockName, ILockingProvider::LOCK_EXCLUSIVE); } catch (LockedException $e) { - $section1->writeln(" Skipping because it is locked - another process seems to work on this …"); + $section1->writeln(' Skipping because it is locked - another process seems to work on this …'); continue; } @@ -273,14 +273,14 @@ class Repair extends Command { } $this->lockingProvider->releaseLock($lockName, ILockingProvider::LOCK_EXCLUSIVE); - $section1->writeln(" Unlocked", OutputInterface::VERBOSITY_VERBOSE); + $section1->writeln(' Unlocked', OutputInterface::VERBOSITY_VERBOSE); $section1->writeln(" Finished migrating previews of file with fileId $name …"); $progressBar->advance(); } $progressBar->finish(); - $output->writeln(""); + $output->writeln(''); return 0; } diff --git a/core/Command/Security/BruteforceAttempts.php b/core/Command/Security/BruteforceAttempts.php index f688a96e18b..d5fa0a284fd 100644 --- a/core/Command/Security/BruteforceAttempts.php +++ b/core/Command/Security/BruteforceAttempts.php @@ -50,11 +50,11 @@ class BruteforceAttempts extends Base { 'bypass-listed' => $this->throttler->isBypassListed($ip), 'attempts' => $this->throttler->getAttempts( $ip, - (string) $input->getArgument('action'), + (string)$input->getArgument('action'), ), 'delay' => $this->throttler->getDelay( $ip, - (string) $input->getArgument('action'), + (string)$input->getArgument('action'), ), ]; diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php index aeb3854fc60..c60c1245735 100644 --- a/core/Command/TwoFactorAuth/Disable.php +++ b/core/Command/TwoFactorAuth/Disable.php @@ -38,14 +38,14 @@ class Disable extends Base { $providerId = $input->getArgument('provider_id'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } if ($this->manager->tryDisableProviderFor($providerId, $user)) { $output->writeln("Two-factor provider <options=bold>$providerId</> disabled for user <options=bold>$uid</>."); return 0; } else { - $output->writeln("<error>The provider does not support this operation.</error>"); + $output->writeln('<error>The provider does not support this operation.</error>'); return 2; } } diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php index fac44d11374..215cb31397e 100644 --- a/core/Command/TwoFactorAuth/Enable.php +++ b/core/Command/TwoFactorAuth/Enable.php @@ -38,14 +38,14 @@ class Enable extends Base { $providerId = $input->getArgument('provider_id'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } if ($this->manager->tryEnableProviderFor($providerId, $user)) { $output->writeln("Two-factor provider <options=bold>$providerId</> enabled for user <options=bold>$uid</>."); return 0; } else { - $output->writeln("<error>The provider does not support this operation.</error>"); + $output->writeln('<error>The provider does not support this operation.</error>'); return 2; } } diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index 19a859695c1..ab2e8f2aecf 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -37,7 +37,7 @@ class State extends Base { $uid = $input->getArgument('uid'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } @@ -51,9 +51,9 @@ class State extends Base { $output->writeln("Two-factor authentication is not enabled for user $uid"); } - $output->writeln(""); - $this->printProviders("Enabled providers", $enabled, $output); - $this->printProviders("Disabled providers", $disabled, $output); + $output->writeln(''); + $this->printProviders('Enabled providers', $enabled, $output); + $this->printProviders('Disabled providers', $disabled, $output); return 0; } @@ -80,9 +80,9 @@ class State extends Base { return; } - $output->writeln($title . ":"); + $output->writeln($title . ':'); foreach ($providers as $provider) { - $output->writeln("- " . $provider); + $output->writeln('- ' . $provider); } } } diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index adfda87ffbc..7b1526766f3 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -142,9 +142,9 @@ class Upgrade extends Command { $updater->listen('\OC\Updater', 'updateEnd', function ($success) use ($output, $self) { if ($success) { - $message = "<info>Update successful</info>"; + $message = '<info>Update successful</info>'; } else { - $message = "<error>Update failed</error>"; + $message = '<error>Update failed</error>'; } $output->writeln($message); }); @@ -175,16 +175,16 @@ class Upgrade extends Command { $output->writeln("<error>$message</error>"); }); $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($output) { - $output->writeln("<info>Setting log level to debug</info>"); + $output->writeln('<info>Setting log level to debug</info>'); }); $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($output) { - $output->writeln("<info>Resetting log level</info>"); + $output->writeln('<info>Resetting log level</info>'); }); $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($output) { - $output->writeln("<info>Starting code integrity check...</info>"); + $output->writeln('<info>Starting code integrity check...</info>'); }); $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($output) { - $output->writeln("<info>Finished code integrity check</info>"); + $output->writeln('<info>Finished code integrity check</info>'); }); $success = $updater->upgrade(); diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 60cf67e8df3..033d2bdc9a2 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -114,11 +114,11 @@ class Add extends Command { $confirm = $helper->ask($input, $output, $question); if ($password !== $confirm) { - $output->writeln("<error>Passwords did not match!</error>"); + $output->writeln('<error>Passwords did not match!</error>'); return 1; } } else { - $output->writeln("<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>"); + $output->writeln('<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>'); return 1; } diff --git a/core/Command/User/AuthTokens/Delete.php b/core/Command/User/AuthTokens/Delete.php index 65c0147aa24..f2c75a8ad99 100644 --- a/core/Command/User/AuthTokens/Delete.php +++ b/core/Command/User/AuthTokens/Delete.php @@ -46,7 +46,7 @@ class Delete extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $uid = $input->getArgument('uid'); - $id = (int) $input->getArgument('id'); + $id = (int)$input->getArgument('id'); $before = $input->getOption('last-used-before'); if ($before) { diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php index fc9d70709c8..515b3a913b7 100644 --- a/core/Command/User/ClearGeneratedAvatarCacheCommand.php +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -27,9 +27,9 @@ class ClearGeneratedAvatarCacheCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $output->writeln("Clearing avatar cache has started"); + $output->writeln('Clearing avatar cache has started'); $this->avatarManager->clearCachedAvatars(); - $output->writeln("Cleared avatar cache successfully"); + $output->writeln('Cleared avatar cache successfully'); return 0; } } diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index 61a6c97ce72..dbb611a4fff 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -64,7 +64,7 @@ class LastSeen extends Base { } if (!$input->getOption('all')) { - $output->writeln("<error>Please specify a username, or \"--all\" to list all</error>"); + $output->writeln('<error>Please specify a username, or "--all" to list all</error>'); return 1; } diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php index 3d592afd7ee..7c4364fccbc 100644 --- a/core/Command/User/ListCommand.php +++ b/core/Command/User/ListCommand.php @@ -58,9 +58,9 @@ class ListCommand extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { if ($input->getOption('disabled')) { - $users = $this->userManager->getDisabledUsers((int) $input->getOption('limit'), (int) $input->getOption('offset')); + $users = $this->userManager->getDisabledUsers((int)$input->getOption('limit'), (int)$input->getOption('offset')); } else { - $users = $this->userManager->searchDisplayName('', (int) $input->getOption('limit'), (int) $input->getOption('offset')); + $users = $this->userManager->searchDisplayName('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); } $this->writeArrayInOutputFormat($input, $output, $this->formatUsers($users, (bool)$input->getOption('info'))); diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index 3233424ff4c..2f18c3d473e 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -81,7 +81,7 @@ class ResetPassword extends Base { $password = $helper->ask($input, $output, $question); if ($password === null) { - $output->writeln("<error>Password cannot be empty!</error>"); + $output->writeln('<error>Password cannot be empty!</error>'); return 1; } @@ -90,11 +90,11 @@ class ResetPassword extends Base { $confirm = $helper->ask($input, $output, $question); if ($password !== $confirm) { - $output->writeln("<error>Passwords did not match!</error>"); + $output->writeln('<error>Passwords did not match!</error>'); return 1; } } else { - $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); + $output->writeln('<error>Interactive input or --password-from-env is needed for entering a new password!</error>'); return 1; } @@ -107,9 +107,9 @@ class ResetPassword extends Base { } if ($success) { - $output->writeln("<info>Successfully reset password for " . $username . "</info>"); + $output->writeln('<info>Successfully reset password for ' . $username . '</info>'); } else { - $output->writeln("<error>Error while resetting password!</error>"); + $output->writeln('<error>Error while resetting password!</error>'); return 1; } return 0; diff --git a/core/Command/User/SyncAccountDataCommand.php b/core/Command/User/SyncAccountDataCommand.php index 6a70f1239f6..e8fcccdaa28 100644 --- a/core/Command/User/SyncAccountDataCommand.php +++ b/core/Command/User/SyncAccountDataCommand.php @@ -48,7 +48,7 @@ class SyncAccountDataCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $users = $this->userManager->searchDisplayName('', (int) $input->getOption('limit'), (int) $input->getOption('offset')); + $users = $this->userManager->searchDisplayName('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); foreach ($users as $user) { $this->updateUserAccount($user, $output); diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 6a5071aed16..654570e66ec 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -123,7 +123,7 @@ class AutoCompleteController extends OCSController { $shareWithDisplayNameUnique = array_key_exists('shareWithDisplayNameUnique', $result) ? $result['shareWithDisplayNameUnique'] : null; $output[] = [ - 'id' => (string) $result['value']['shareWith'], + 'id' => (string)$result['value']['shareWith'], 'label' => $label, 'icon' => $icon ?? '', 'source' => $type, diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 5d117f6ae7f..5003d5824e3 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -292,7 +292,7 @@ class AvatarController extends Controller { $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l10n->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t('No temporary profile picture available, try again') ]], Http::STATUS_NOT_FOUND); } @@ -315,19 +315,19 @@ class AvatarController extends Controller { #[FrontpageRoute(verb: 'POST', url: '/avatar/cropped')] public function postCroppedAvatar(?array $crop = null): JSONResponse { if (is_null($crop)) { - return new JSONResponse(['data' => ['message' => $this->l10n->t("No crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t('No crop data provided')]], Http::STATUS_BAD_REQUEST); } if (!isset($crop['x'], $crop['y'], $crop['w'], $crop['h'])) { - return new JSONResponse(['data' => ['message' => $this->l10n->t("No valid crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t('No valid crop data provided')]], Http::STATUS_BAD_REQUEST); } $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l10n->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t('No temporary profile picture available, try again') ]], Http::STATUS_BAD_REQUEST); } diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index ccf70cc9d30..a7205abc0fc 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -337,7 +337,7 @@ class ClientFlowLoginController extends Controller { $protocol = $this->request->getServerProtocol(); - if ($protocol !== "https") { + if ($protocol !== 'https') { $xForwardedProto = $this->request->getHeader('X-Forwarded-Proto'); $xForwardedSSL = $this->request->getHeader('X-Forwarded-Ssl'); if ($xForwardedProto === 'https' || $xForwardedSSL === 'on') { @@ -345,6 +345,6 @@ class ClientFlowLoginController extends Controller { } } - return $protocol . "://" . $this->request->getServerHost() . $serverPostfix; + return $protocol . '://' . $this->request->getServerHost() . $serverPostfix; } } diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 2a5e5503952..001ab737c7e 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -94,7 +94,7 @@ class LostController extends Controller { ) { $response = new TemplateResponse( 'core', 'error', [ - "errors" => [["error" => $e->getMessage()]] + 'errors' => [['error' => $e->getMessage()]] ], TemplateResponse::RENDER_AS_GUEST ); diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index e0c8eb90464..b459143aa7e 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -210,7 +210,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param string|null $customId An arbitrary identifier for the task * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * - * 200: Tasks returned + * 200: Tasks returned */ #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/tasks/app/{appId}', root: '/taskprocessing')] @@ -237,7 +237,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param string|null $customId An arbitrary identifier for the task * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * - * 200: Tasks returned + * 200: Tasks returned */ #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/tasks', root: '/taskprocessing')] @@ -264,8 +264,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param int $fileId The file id of the file to retrieve * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 200: File content returned - * 404: Task or file not found + * 200: File content returned + * 404: Task or file not found */ #[NoAdminRequired] #[Http\Attribute\NoCSRFRequired] @@ -288,8 +288,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param int $fileId The file id of the file to retrieve * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 200: File content returned - * 404: Task or file not found + * 200: File content returned + * 404: Task or file not found */ #[ExAppRequired] #[ApiRoute(verb: 'GET', url: '/tasks_provider/{taskId}/file/{fileId}', root: '/taskprocessing')] @@ -312,9 +312,9 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param int $taskId The id of the task * @return DataResponse<Http::STATUS_CREATED, array{fileId: int}, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 201: File created - * 400: File upload failed or no file was uploaded - * 404: Task not found + * 201: File created + * 400: File upload failed or no file was uploaded + * 404: Task not found */ #[ExAppRequired] #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/file', root: '/taskprocessing')] @@ -409,8 +409,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param float $progress The progress * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 200: Progress updated successfully - * 404: Task not found + * 200: Progress updated successfully + * 404: Task not found */ #[ExAppRequired] #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/progress', root: '/taskprocessing')] @@ -440,8 +440,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param string|null $errorMessage An error message if the task failed * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 200: Result updated successfully - * 404: Task not found + * 200: Result updated successfully + * 404: Task not found */ #[ExAppRequired] #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/result', root: '/taskprocessing')] @@ -470,8 +470,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param int $taskId The id of the task * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> * - * 200: Task canceled successfully - * 404: Task not found + * 200: Task canceled successfully + * 404: Task not found */ #[NoAdminRequired] #[ApiRoute(verb: 'POST', url: '/tasks/{taskId}/cancel', root: '/taskprocessing')] @@ -503,8 +503,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param list<string> $taskTypeIds The ids of the task types * @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask, provider: array{name: string}}, array{}>|DataResponse<Http::STATUS_NO_CONTENT, null, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * - * 200: Task returned - * 204: No task found + * 200: Task returned + * 204: No task found */ #[ExAppRequired] #[ApiRoute(verb: 'GET', url: '/tasks_provider/next', root: '/taskprocessing')] diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index 40e569ee1d9..82cd088d29d 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -193,7 +193,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { * @param string|null $identifier An arbitrary identifier for the task * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * - * 200: Task list returned + * 200: Task list returned */ #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/tasks/app/{appId}', root: '/textprocessing')] diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 4a560d8b04d..c8528c19cc2 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -155,7 +155,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { $res->throttle(['action' => 'text2image']); return $res; } - $file = $folder->getFolder((string) $task->getId())->getFile((string) $index); + $file = $folder->getFolder((string)$task->getId())->getFile((string)$index); $info = getimagesizefromstring($file->getContent()); return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => image_type_to_mime_type($info[2])]); @@ -214,7 +214,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { * @param string|null $identifier An arbitrary identifier for the task * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTextToImageTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * - * 200: Task list returned + * 200: Task list returned */ #[NoAdminRequired] #[AnonRateLimit(limit: 5, period: 120)] diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 153e1e7559a..ef0f420fc82 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -123,7 +123,7 @@ class TwoFactorChallengeController extends Controller { if ($this->session->exists('two_factor_auth_error')) { $this->session->remove('two_factor_auth_error'); $error = true; - $errorMessage = $this->session->get("two_factor_auth_error_message"); + $errorMessage = $this->session->get('two_factor_auth_error_message'); $this->session->remove('two_factor_auth_error_message'); } $tmpl = $provider->getTemplate($user); diff --git a/core/Controller/WellKnownController.php b/core/Controller/WellKnownController.php index 89a648d6bef..9ce83686355 100644 --- a/core/Controller/WellKnownController.php +++ b/core/Controller/WellKnownController.php @@ -41,7 +41,7 @@ class WellKnownController extends Controller { ); if ($response === null) { - $httpResponse = new JSONResponse(["message" => "$service not supported"], Http::STATUS_NOT_FOUND); + $httpResponse = new JSONResponse(['message' => "$service not supported"], Http::STATUS_NOT_FOUND); } else { $httpResponse = $response->toHttpResponse(); } diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 06b27b0d302..58cb70c863a 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -49,7 +49,7 @@ class WhatsNewController extends OCSController { public function get():DataResponse { $user = $this->userSession->getUser(); if ($user === null) { - throw new \RuntimeException("Acting user cannot be resolved"); + throw new \RuntimeException('Acting user cannot be resolved'); } $lastRead = $this->config->getUserValue($user->getUID(), 'core', 'whatsNewLastRead', 0); $currentVersion = $this->whatsNewService->normalizeVersion($this->config->getSystemValue('version')); @@ -96,7 +96,7 @@ class WhatsNewController extends OCSController { public function dismiss(string $version):DataResponse { $user = $this->userSession->getUser(); if ($user === null) { - throw new \RuntimeException("Acting user cannot be resolved"); + throw new \RuntimeException('Acting user cannot be resolved'); } $version = $this->whatsNewService->normalizeVersion($version); // checks whether it's a valid version, throws an Exception otherwise diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 819eb84f118..b2db87de8fd 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -1013,9 +1013,9 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { $result = $query->execute(); while ($row = $result->fetch()) { preg_match('/(calendar)\/([A-z0-9-@_]+)\//', $row['propertypath'], $match); - $insert->setParameter('propertypath', (string) $row['propertypath']) - ->setParameter('propertyname', (string) $row['propertyname']) - ->setParameter('propertyvalue', (string) $row['propertyvalue']) + $insert->setParameter('propertypath', (string)$row['propertypath']) + ->setParameter('propertyname', (string)$row['propertyname']) + ->setParameter('propertyvalue', (string)$row['propertyvalue']) ->setParameter('userid', ($match[2] ?? '')); $insert->execute(); } diff --git a/core/Migrations/Version13000Date20170926101637.php b/core/Migrations/Version13000Date20170926101637.php index 4a270c5e1cb..42bbf74fb74 100644 --- a/core/Migrations/Version13000Date20170926101637.php +++ b/core/Migrations/Version13000Date20170926101637.php @@ -13,7 +13,7 @@ use OCP\Migration\BigIntMigration; class Version13000Date20170926101637 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/core/Migrations/Version20000Date20201109081918.php b/core/Migrations/Version20000Date20201109081918.php index 5f0051c4690..a24b1ab82b4 100644 --- a/core/Migrations/Version20000Date20201109081918.php +++ b/core/Migrations/Version20000Date20201109081918.php @@ -79,9 +79,9 @@ class Version20000Date20201109081918 extends SimpleMigrationStep { $result = $query->execute(); while ($row = $result->fetch()) { - $insert->setParameter('user', (string) $row['user']) - ->setParameter('identifier', (string) $row['identifier']) - ->setParameter('credentials', (string) $row['credentials']); + $insert->setParameter('user', (string)$row['user']) + ->setParameter('identifier', (string)$row['identifier']) + ->setParameter('credentials', (string)$row['credentials']); $insert->execute(); } $result->closeCursor(); diff --git a/core/Migrations/Version23000Date20211213203940.php b/core/Migrations/Version23000Date20211213203940.php index 69f6257e812..f31f13a14d7 100644 --- a/core/Migrations/Version23000Date20211213203940.php +++ b/core/Migrations/Version23000Date20211213203940.php @@ -14,7 +14,7 @@ use OCP\Migration\BigIntMigration; class Version23000Date20211213203940 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] */ protected function getColumnsByTable() { return [ diff --git a/core/Migrations/Version27000Date20220613163520.php b/core/Migrations/Version27000Date20220613163520.php index f3f6e374572..4a5601b6cd5 100644 --- a/core/Migrations/Version27000Date20220613163520.php +++ b/core/Migrations/Version27000Date20220613163520.php @@ -16,7 +16,7 @@ use OCP\Migration\SimpleMigrationStep; class Version27000Date20220613163520 extends SimpleMigrationStep { public function name(): string { - return "Add mountpoint path to mounts table unique index"; + return 'Add mountpoint path to mounts table unique index'; } public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { diff --git a/core/routes.php b/core/routes.php index 2234a4a5c17..086afcdbac8 100644 --- a/core/routes.php +++ b/core/routes.php @@ -8,7 +8,7 @@ declare(strict_types=1); * SPDX-License-Identifier: AGPL-3.0-only */ -/** @var $this OCP\Route\IRouter */ +/** @var OC\Route\Router $this */ // Core ajax actions // Routing $this->create('core_ajax_update', '/core/ajax/update.php') diff --git a/core/strings.php b/core/strings.php index ed62ce167f6..3feab3af888 100644 --- a/core/strings.php +++ b/core/strings.php @@ -9,8 +9,8 @@ declare(strict_types=1); */ //some strings that are used in /lib but won't be translatable unless they are in /core too $l = \OCP\Util::getL10N('core'); -$l->t("Personal"); -$l->t("Accounts"); -$l->t("Apps"); -$l->t("Admin"); -$l->t("Help"); +$l->t('Personal'); +$l->t('Accounts'); +$l->t('Apps'); +$l->t('Admin'); +$l->t('Help'); diff --git a/core/templates/error.php b/core/templates/error.php index 82acb08f9ed..ac9bd34d558 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -8,7 +8,7 @@ <div class="guest-box"> <h2><?php p($l->t('Error')) ?></h2> <ul> - <?php foreach ($_["errors"] as $error):?> + <?php foreach ($_['errors'] as $error):?> <li> <p><?php p($error['error']) ?></p> <?php if (isset($error['hint']) && $error['hint']): ?> diff --git a/core/templates/twofactorshowchallenge.php b/core/templates/twofactorshowchallenge.php index 42cc14e5f22..16f4390f177 100644 --- a/core/templates/twofactorshowchallenge.php +++ b/core/templates/twofactorshowchallenge.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ /** @var \OCP\IL10N $l */ -/** @var array $_*/ +/** @var array $_ */ /** @var boolean $error */ $error = $_['error']; /* @var $error_message string */ |