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/DeleteOrphanedFiles.php4
-rw-r--r--apps/files/lib/Command/Scan.php7
-rw-r--r--apps/files/lib/Command/ScanAppData.php18
-rw-r--r--apps/files/lib/Command/TransferOwnership.php2
4 files changed, 21 insertions, 10 deletions
diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php
index 2a63f344a92..855958511d7 100644
--- a/apps/files/lib/Command/DeleteOrphanedFiles.php
+++ b/apps/files/lib/Command/DeleteOrphanedFiles.php
@@ -32,8 +32,7 @@ use Symfony\Component\Console\Output\OutputInterface;
* Delete all file entries that have no matching entries in the storage table.
*/
class DeleteOrphanedFiles extends Command {
-
- const CHUNK_SIZE = 200;
+ public const CHUNK_SIZE = 200;
/**
* @var IDBConnection
@@ -79,5 +78,4 @@ class DeleteOrphanedFiles extends Command {
$output->writeln("$deletedEntries orphaned file cache entries deleted");
}
-
}
diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php
index 39eebbb2c43..c75073e428f 100644
--- a/apps/files/lib/Command/Scan.php
+++ b/apps/files/lib/Command/Scan.php
@@ -173,9 +173,9 @@ class Scan extends Base {
$inputPath = $input->getOption('path');
if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/');
- list (, $user,) = explode('/', $inputPath, 3);
- $users = array($user);
- } else if ($input->getOption('all')) {
+ list(, $user,) = explode('/', $inputPath, 3);
+ $users = [$user];
+ } elseif ($input->getOption('all')) {
$users = $this->userManager->search('');
} else {
$users = $input->getArgument('user_id');
@@ -321,5 +321,4 @@ class Scan extends Base {
}
return $connection;
}
-
}
diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php
index 358dd993291..0d34bc1e72c 100644
--- a/apps/files/lib/Command/ScanAppData.php
+++ b/apps/files/lib/Command/ScanAppData.php
@@ -38,6 +38,7 @@ use OCP\Files\StorageNotAvailableException;
use OCP\IConfig;
use OCP\IDBConnection;
use Symfony\Component\Console\Helper\Table;
+use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -67,6 +68,8 @@ class ScanAppData extends Base {
$this
->setName('files:scan-app-data')
->setDescription('rescan the AppData folder');
+
+ $this->addArgument('folder', InputArgument::OPTIONAL, 'The appdata subfolder to scan', '');
}
public function checkScanWarning($fullPath, OutputInterface $output) {
@@ -78,7 +81,7 @@ class ScanAppData extends Base {
}
}
- protected function scanFiles(OutputInterface $output) {
+ protected function scanFiles(OutputInterface $output, string $folder) {
try {
$appData = $this->getAppDataFolder();
} catch (NotFoundException $e) {
@@ -86,6 +89,15 @@ class ScanAppData extends Base {
return;
}
+ if ($folder !== '') {
+ try {
+ $appData = $appData->get($folder);
+ } catch (NotFoundException $e) {
+ $output->writeln('Could not find folder: ' . $folder);
+ return;
+ }
+ }
+
$connection = $this->reconnectToDatabase($output);
$scanner = new \OC\Files\Utils\Scanner(null, $connection, \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger());
@@ -139,9 +151,11 @@ class ScanAppData extends Base {
$output->writeln("\nScanning AppData for files");
+ $folder = $input->getArgument('folder');
+
$this->initTools();
- $this->scanFiles($output);
+ $this->scanFiles($output, $folder);
$this->presentStats($output);
}
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index 2675a7dd1bb..b1d90452c23 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -12,6 +12,7 @@ declare(strict_types=1);
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Sujith H <sharidasan@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Tobia De Koninck <LEDfan@users.noreply.github.com>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL-3.0
@@ -114,5 +115,4 @@ class TransferOwnership extends Command {
return 0;
}
-
}