aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/command
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-12-10 11:04:17 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-12-10 11:04:17 +0100
commit0f17486c1d6d974e25ea75597bd2ca6f50e5e538 (patch)
treebe8185ab017f4f456baa0e04c99684923b38b3b0 /apps/files/command
parent3cdaa4094fe7a8fa6db4885dd9a426053e845a53 (diff)
downloadnextcloud-server-0f17486c1d6d974e25ea75597bd2ca6f50e5e538.tar.gz
nextcloud-server-0f17486c1d6d974e25ea75597bd2ca6f50e5e538.zip
make path absolute
Diffstat (limited to 'apps/files/command')
-rw-r--r--apps/files/command/scan.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php
index 6e4b3ee4bc3..7cf401c7b59 100644
--- a/apps/files/command/scan.php
+++ b/apps/files/command/scan.php
@@ -41,8 +41,7 @@ class Scan extends Command {
'path',
'p',
InputArgument::OPTIONAL,
- 'limit rescan to this path, eg. --path="files/Music"',
- ''
+ 'limit rescan to this path, eg. --path="/alice/files/Music", the user_id is determined by the path and the user_id parameter and --all are ignored'
)
->addOption(
'quiet',
@@ -62,10 +61,10 @@ class Scan extends Command {
$scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection());
if (!$quiet) {
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
- $output->writeln("Scanning <info>$path</info>");
+ $output->writeln("Scanning file <info>$path</info>");
});
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
- $output->writeln("Scanning <info>$path</info>");
+ $output->writeln("Scanning folder <info>$path</info>");
});
}
try {
@@ -77,16 +76,21 @@ class Scan extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- if ($input->getOption('all')) {
+ $path = $input->getOption('path');
+ if ($path !== false) {
+ $path = '/'.trim($path, '/');
+ list (, $user, ) = explode('/', $path, 3);
+ $users = array($user);
+ } else if ($input->getOption('all')) {
$users = $this->userManager->search('');
} else {
$users = $input->getArgument('user_id');
}
- $path = trim($input->getOption('path'), '/');
$quiet = $input->getOption('quiet');
+
if (count($users) === 0) {
- $output->writeln("<error>Please specify the user id to scan or \"--all\" to scan for all users</error>");
+ $output->writeln("<error>Please specify the user id to scan, \"--all\" to scan for all users or \"--path=...\"</error>");
return;
}