Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-04-22 14:27:33 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2020-04-22 14:27:33 +0300
commite983ae3b0624b99fa3cc455fb180b0f64754ffc1 (patch)
treed3e5bac30b46d214360d633b5b8499a2e3597997 /apps
parentac57bbcf999b5b8831722d04c2a4e54133eb2498 (diff)
Add folder argument to files:scan-app-data
If you need to rescan something but don't feel like rescanning your whole preview stash. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Command/ScanAppData.php18
1 files changed, 16 insertions, 2 deletions
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);
}