aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Command
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/lib/Command')
-rw-r--r--apps/files/lib/Command/Copy.php8
-rw-r--r--apps/files/lib/Command/Delete.php22
-rw-r--r--apps/files/lib/Command/DeleteOrphanedFiles.php4
-rw-r--r--apps/files/lib/Command/Get.php6
-rw-r--r--apps/files/lib/Command/Move.php6
-rw-r--r--apps/files/lib/Command/Object/Delete.php6
-rw-r--r--apps/files/lib/Command/Object/Get.php6
-rw-r--r--apps/files/lib/Command/Object/ObjectUtil.php10
-rw-r--r--apps/files/lib/Command/Object/Put.php10
-rw-r--r--apps/files/lib/Command/Put.php4
-rw-r--r--apps/files/lib/Command/RepairTree.php2
-rw-r--r--apps/files/lib/Command/ScanAppData.php2
-rw-r--r--apps/files/lib/Command/TransferOwnership.php8
13 files changed, 47 insertions, 47 deletions
diff --git a/apps/files/lib/Command/Copy.php b/apps/files/lib/Command/Copy.php
index 9981497232f..e51a1689907 100644
--- a/apps/files/lib/Command/Copy.php
+++ b/apps/files/lib/Command/Copy.php
@@ -30,10 +30,10 @@ class Copy extends Command {
$this
->setName('files:copy')
->setDescription('Copy a file or folder')
- ->addArgument('source', InputArgument::REQUIRED, "Source file id or path")
- ->addArgument('target', InputArgument::REQUIRED, "Target path")
+ ->addArgument('source', InputArgument::REQUIRED, 'Source file id or path')
+ ->addArgument('target', InputArgument::REQUIRED, 'Target path')
->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for confirmation and don't output any warnings")
- ->addOption('no-target-directory', 'T', InputOption::VALUE_NONE, "When target path is folder, overwrite the folder instead of copying into the folder");
+ ->addOption('no-target-directory', 'T', InputOption::VALUE_NONE, 'When target path is folder, overwrite the folder instead of copying into the folder');
}
public function execute(InputInterface $input, OutputInterface $output): int {
@@ -98,7 +98,7 @@ class Copy extends Command {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
- $question = new ConfirmationQuestion("<info>" . $targetInput . "</info> already exists, overwrite? [y/N] ", false);
+ $question = new ConfirmationQuestion('<info>' . $targetInput . '</info> already exists, overwrite? [y/N] ', false);
if (!$helper->ask($input, $output, $question)) {
return 1;
}
diff --git a/apps/files/lib/Command/Delete.php b/apps/files/lib/Command/Delete.php
index 32aa52aed2f..f59b636079b 100644
--- a/apps/files/lib/Command/Delete.php
+++ b/apps/files/lib/Command/Delete.php
@@ -30,7 +30,7 @@ class Delete extends Command {
$this
->setName('files:delete')
->setDescription('Delete a file or folder')
- ->addArgument('file', InputArgument::REQUIRED, "File id or path")
+ ->addArgument('file', InputArgument::REQUIRED, 'File id or path')
->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings");
}
@@ -59,30 +59,30 @@ class Delete extends Command {
return self::SUCCESS;
} else {
$node = $storage->getShare()->getNode();
- $output->writeln("");
+ $output->writeln('');
}
}
$filesByUsers = $this->fileUtils->getFilesByUser($node);
if (count($filesByUsers) > 1) {
- $output->writeln("Warning: the provided file is accessible by more than one user");
- $output->writeln(" all of the following users will lose access to the file when deleted:");
- $output->writeln("");
+ $output->writeln('Warning: the provided file is accessible by more than one user');
+ $output->writeln(' all of the following users will lose access to the file when deleted:');
+ $output->writeln('');
foreach ($filesByUsers as $user => $filesByUser) {
- $output->writeln($user . ":");
+ $output->writeln($user . ':');
foreach($filesByUser as $file) {
- $output->writeln(" - " . $file->getPath());
+ $output->writeln(' - ' . $file->getPath());
}
}
- $output->writeln("");
+ $output->writeln('');
}
if ($node instanceof Folder) {
$maybeContents = " and all it's contents";
} else {
- $maybeContents = "";
+ $maybeContents = '';
}
- $question = new ConfirmationQuestion("Delete " . $node->getPath() . $maybeContents . "? [y/N] ", false);
+ $question = new ConfirmationQuestion('Delete ' . $node->getPath() . $maybeContents . '? [y/N] ', false);
$deleteConfirmed = $helper->ask($input, $output, $question);
}
@@ -90,7 +90,7 @@ class Delete extends Command {
if ($node->isDeletable()) {
$node->delete();
} else {
- $output->writeln("<error>File cannot be deleted, insufficient permissions.</error>");
+ $output->writeln('<error>File cannot be deleted, insufficient permissions.</error>');
}
}
diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php
index b7101c07258..50031da4f63 100644
--- a/apps/files/lib/Command/DeleteOrphanedFiles.php
+++ b/apps/files/lib/Command/DeleteOrphanedFiles.php
@@ -53,7 +53,7 @@ class DeleteOrphanedFiles extends Command {
$result = $query->execute();
while ($row = $result->fetch()) {
$deletedInLastChunk++;
- $deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid'])
+ $deletedEntries += $deleteQuery->setParameter('objectid', (int)$row['fileid'])
->execute();
}
$result->closeCursor();
@@ -120,7 +120,7 @@ class DeleteOrphanedFiles extends Command {
$result = $query->execute();
while ($row = $result->fetch()) {
$deletedInLastChunk++;
- $deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id'])
+ $deletedEntries += $deleteQuery->setParameter('storageid', (int)$row['storage_id'])
->execute();
}
$result->closeCursor();
diff --git a/apps/files/lib/Command/Get.php b/apps/files/lib/Command/Get.php
index 0d901fe8250..60e028f615e 100644
--- a/apps/files/lib/Command/Get.php
+++ b/apps/files/lib/Command/Get.php
@@ -26,8 +26,8 @@ class Get extends Command {
$this
->setName('files:get')
->setDescription('Get the contents of a file')
- ->addArgument('file', InputArgument::REQUIRED, "Source file id or Nextcloud path")
- ->addArgument('output', InputArgument::OPTIONAL, "Target local file to output to, defaults to STDOUT");
+ ->addArgument('file', InputArgument::REQUIRED, 'Source file id or Nextcloud path')
+ ->addArgument('output', InputArgument::OPTIONAL, 'Target local file to output to, defaults to STDOUT');
}
public function execute(InputInterface $input, OutputInterface $output): int {
@@ -48,7 +48,7 @@ class Get extends Command {
$isTTY = stream_isatty(STDOUT);
if ($outputName === null && $isTTY && $node->getMimePart() !== 'text') {
$output->writeln([
- "<error>Warning: Binary output can mess up your terminal</error>",
+ '<error>Warning: Binary output can mess up your terminal</error>',
" Use <info>occ files:get $fileInput -</info> to output it to the terminal anyway",
" Or <info>occ files:get $fileInput <FILE></info> to save to a file instead"
]);
diff --git a/apps/files/lib/Command/Move.php b/apps/files/lib/Command/Move.php
index dd1cd1aae76..cd9e56f8e29 100644
--- a/apps/files/lib/Command/Move.php
+++ b/apps/files/lib/Command/Move.php
@@ -31,8 +31,8 @@ class Move extends Command {
$this
->setName('files:move')
->setDescription('Move a file or folder')
- ->addArgument('source', InputArgument::REQUIRED, "Source file id or path")
- ->addArgument('target', InputArgument::REQUIRED, "Target path")
+ ->addArgument('source', InputArgument::REQUIRED, 'Source file id or path')
+ ->addArgument('target', InputArgument::REQUIRED, 'Target path')
->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings");
}
@@ -88,7 +88,7 @@ class Move extends Command {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
- $question = new ConfirmationQuestion("<info>" . $targetInput . "</info> already exists, overwrite? [y/N] ", false);
+ $question = new ConfirmationQuestion('<info>' . $targetInput . '</info> already exists, overwrite? [y/N] ', false);
if (!$helper->ask($input, $output, $question)) {
return 1;
}
diff --git a/apps/files/lib/Command/Object/Delete.php b/apps/files/lib/Command/Object/Delete.php
index f9fc3a58229..07613ecc616 100644
--- a/apps/files/lib/Command/Object/Delete.php
+++ b/apps/files/lib/Command/Object/Delete.php
@@ -27,13 +27,13 @@ class Delete extends Command {
$this
->setName('files:object:delete')
->setDescription('Delete an object from the object store')
- ->addArgument('object', InputArgument::REQUIRED, "Object to delete")
+ ->addArgument('object', InputArgument::REQUIRED, 'Object to delete')
->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to delete the object from, only required in cases where it can't be determined from the config");
}
public function execute(InputInterface $input, OutputInterface $output): int {
$object = $input->getArgument('object');
- $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output);
+ $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output);
if (!$objectStore) {
return -1;
}
@@ -41,7 +41,7 @@ class Delete extends Command {
if ($fileId = $this->objectUtils->objectExistsInDb($object)) {
$output->writeln("<error>Warning, object $object belongs to an existing file, deleting the object will lead to unexpected behavior if not replaced</error>");
$output->writeln(" Note: use <info>occ files:delete $fileId</info> to delete the file cleanly or <info>occ info:file $fileId</info> for more information about the file");
- $output->writeln("");
+ $output->writeln('');
}
if (!$objectStore->objectExists($object)) {
diff --git a/apps/files/lib/Command/Object/Get.php b/apps/files/lib/Command/Object/Get.php
index 054278211f6..c32de020c5a 100644
--- a/apps/files/lib/Command/Object/Get.php
+++ b/apps/files/lib/Command/Object/Get.php
@@ -25,15 +25,15 @@ class Get extends Command {
$this
->setName('files:object:get')
->setDescription('Get the contents of an object')
- ->addArgument('object', InputArgument::REQUIRED, "Object to get")
- ->addArgument('output', InputArgument::REQUIRED, "Target local file to output to, use - for STDOUT")
+ ->addArgument('object', InputArgument::REQUIRED, 'Object to get')
+ ->addArgument('output', InputArgument::REQUIRED, 'Target local file to output to, use - for STDOUT')
->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to get the object from, only required in cases where it can't be determined from the config");
}
public function execute(InputInterface $input, OutputInterface $output): int {
$object = $input->getArgument('object');
$outputName = $input->getArgument('output');
- $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output);
+ $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output);
if (!$objectStore) {
return self::FAILURE;
}
diff --git a/apps/files/lib/Command/Object/ObjectUtil.php b/apps/files/lib/Command/Object/ObjectUtil.php
index 7021c815490..c4ab59608fb 100644
--- a/apps/files/lib/Command/Object/ObjectUtil.php
+++ b/apps/files/lib/Command/Object/ObjectUtil.php
@@ -41,19 +41,19 @@ class ObjectUtil {
public function getObjectStore(?string $bucket, OutputInterface $output): ?IObjectStore {
$config = $this->getObjectStoreConfig();
if (!$config) {
- $output->writeln("<error>Instance is not using primary object store</error>");
+ $output->writeln('<error>Instance is not using primary object store</error>');
return null;
}
if ($config['multibucket'] && !$bucket) {
- $output->writeln("<error>--bucket option required</error> because <info>multi bucket</info> is enabled.");
+ $output->writeln('<error>--bucket option required</error> because <info>multi bucket</info> is enabled.');
return null;
}
if (!isset($config['arguments'])) {
- throw new \Exception("no arguments configured for object store configuration");
+ throw new \Exception('no arguments configured for object store configuration');
}
if (!isset($config['class'])) {
- throw new \Exception("no class configured for object store configuration");
+ throw new \Exception('no class configured for object store configuration');
}
if ($bucket) {
@@ -65,7 +65,7 @@ class ObjectUtil {
$store = new $config['class']($config['arguments']);
if (!$store instanceof IObjectStore) {
- throw new \Exception("configured object store class is not an object store implementation");
+ throw new \Exception('configured object store class is not an object store implementation');
}
return $store;
}
diff --git a/apps/files/lib/Command/Object/Put.php b/apps/files/lib/Command/Object/Put.php
index 34e4ceb854b..8516eb51183 100644
--- a/apps/files/lib/Command/Object/Put.php
+++ b/apps/files/lib/Command/Object/Put.php
@@ -29,8 +29,8 @@ class Put extends Command {
$this
->setName('files:object:put')
->setDescription('Write a file to the object store')
- ->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN")
- ->addArgument('object', InputArgument::REQUIRED, "Object to write")
+ ->addArgument('input', InputArgument::REQUIRED, 'Source local path, use - to read from STDIN')
+ ->addArgument('object', InputArgument::REQUIRED, 'Object to write')
->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config");
;
}
@@ -38,7 +38,7 @@ class Put extends Command {
public function execute(InputInterface $input, OutputInterface $output): int {
$object = $input->getArgument('object');
$inputName = (string)$input->getArgument('input');
- $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output);
+ $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output);
if (!$objectStore) {
return -1;
}
@@ -46,11 +46,11 @@ class Put extends Command {
if ($fileId = $this->objectUtils->objectExistsInDb($object)) {
$output->writeln("<error>Warning, object $object belongs to an existing file, overwriting the object contents can lead to unexpected behavior.</error>");
$output->writeln("You can use <info>occ files:put $inputName $fileId</info> to write to the file safely.");
- $output->writeln("");
+ $output->writeln('');
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
- $question = new ConfirmationQuestion("Write to the object anyway? [y/N] ", false);
+ $question = new ConfirmationQuestion('Write to the object anyway? [y/N] ', false);
if (!$helper->ask($input, $output, $question)) {
return -1;
}
diff --git a/apps/files/lib/Command/Put.php b/apps/files/lib/Command/Put.php
index f72fa902346..fd9d75db78c 100644
--- a/apps/files/lib/Command/Put.php
+++ b/apps/files/lib/Command/Put.php
@@ -29,8 +29,8 @@ class Put extends Command {
$this
->setName('files:put')
->setDescription('Write contents of a file')
- ->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN")
- ->addArgument('file', InputArgument::REQUIRED, "Target Nextcloud file path to write to or fileid of existing file");
+ ->addArgument('input', InputArgument::REQUIRED, 'Source local path, use - to read from STDIN')
+ ->addArgument('file', InputArgument::REQUIRED, 'Target Nextcloud file path to write to or fileid of existing file');
}
public function execute(InputInterface $input, OutputInterface $output): int {
diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php
index 99e92741a2e..622ccba48a3 100644
--- a/apps/files/lib/Command/RepairTree.php
+++ b/apps/files/lib/Command/RepairTree.php
@@ -33,7 +33,7 @@ class RepairTree extends Command {
$rows = $this->findBrokenTreeBits();
$fix = !$input->getOption('dry-run');
- $output->writeln("Found " . count($rows) . " file entries with an invalid path");
+ $output->writeln('Found ' . count($rows) . ' file entries with an invalid path');
if ($fix) {
$this->connection->beginTransaction();
diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php
index 61f4b6f3ba2..5360d38bdb6 100644
--- a/apps/files/lib/Command/ScanAppData.php
+++ b/apps/files/lib/Command/ScanAppData.php
@@ -210,7 +210,7 @@ class ScanAppData extends Base {
}
protected function reconnectToDatabase(OutputInterface $output): Connection {
- /** @var Connection $connection*/
+ /** @var Connection $connection */
$connection = \OC::$server->get(Connection::class);
try {
$connection->close();
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index db4c19dc54e..edc73e62c38 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -78,12 +78,12 @@ class TransferOwnership extends Command {
$destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
if (!$sourceUserObject instanceof IUser) {
- $output->writeln("<error>Unknown source user " . $input->getArgument('source-user') . "</error>");
+ $output->writeln('<error>Unknown source user ' . $input->getArgument('source-user') . '</error>');
return self::FAILURE;
}
if (!$destinationUserObject instanceof IUser) {
- $output->writeln("<error>Unknown destination user " . $input->getArgument('destination-user') . "</error>");
+ $output->writeln('<error>Unknown destination user ' . $input->getArgument('destination-user') . '</error>');
return self::FAILURE;
}
@@ -105,7 +105,7 @@ class TransferOwnership extends Command {
}
break;
default:
- $output->writeln("<error>Option --transfer-incoming-shares: wrong usage. Transfer aborted.</error>");
+ $output->writeln('<error>Option --transfer-incoming-shares: wrong usage. Transfer aborted.</error>');
return self::FAILURE;
}
@@ -119,7 +119,7 @@ class TransferOwnership extends Command {
$includeIncoming
);
} catch (TransferOwnershipException $e) {
- $output->writeln("<error>" . $e->getMessage() . "</error>");
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
return $e->getCode() !== 0 ? $e->getCode() : self::FAILURE;
}