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;
$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) {
}
}
- protected function scanFiles(OutputInterface $output) {
+ protected function scanFiles(OutputInterface $output, string $folder) {
try {
$appData = $this->getAppDataFolder();
} catch (NotFoundException $e) {
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());
$output->writeln("\nScanning AppData for files");
+ $folder = $input->getArgument('folder');
+
$this->initTools();
- $this->scanFiles($output);
+ $this->scanFiles($output, $folder);
$this->presentStats($output);
}