Skip to content

Commit

Permalink
Merge pull request #3612 from nextcloud/feat/30-shallow
Browse files Browse the repository at this point in the history
[stable30] allow to shallow scan
  • Loading branch information
susnux authored Feb 14, 2025
2 parents 123ae48 + 9ffa771 commit 8f27264
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Folders can be configured from *Group folders* in the admin settings.
After a folder is created, the admin can give access to the folder to one or more groups, control their write/sharing permissions and assign a quota for the folder.
]]></description>
<version>18.0.10</version>
<version>18.1.0-dev.0</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<namespace>GroupFolders</namespace>
Expand Down
21 changes: 20 additions & 1 deletion lib/Command/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ protected function configure() {
null,
InputOption::VALUE_NONE,
'Scan all the group folders.'
)
->addOption(
'path',
'p',
InputOption::VALUE_REQUIRED,
'Limit rescan to this path, eg. --path="/shared/media/Music".'
)->addOption(
'shallow',
null,
InputOption::VALUE_NONE,
'Do not scan folders recursively.'
);
parent::configure();
}
Expand Down Expand Up @@ -59,6 +70,14 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$folders = [$folder['id'] => $folder];
}

$inputPath = $input->getOption('path');
if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/');
} else {
$inputPath = '';
}
$recursive = !$input->getOption('shallow');

$duration = 0;
$stats = [];
foreach ($folders as $folder) {
Expand Down Expand Up @@ -95,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$start = microtime(true);

$scanner->setUseTransactions(false);
$scanner->scan('');
$scanner->scan($inputPath, $recursive);

$end = microtime(true);
$statsRow[3] = date('H:i:s', (int)($end - $start));
Expand Down
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@
"webdav": "^5.5.0",
"whatwg-fetch": "^3.6.20"
},
"version": "18.0.0-beta.1"
"version": "18.1.0-dev.0"
}

0 comments on commit 8f27264

Please sign in to comment.