Merge pull request #17659 from owncloud/files-scan-user-path

Lock scanner to the given user
This commit is contained in:
Vincent Petry 2015-07-15 16:17:24 +02:00
commit a5016cfee8

View file

@ -92,10 +92,10 @@ class Scan extends Command {
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$path = $input->getOption('path'); $inputPath = $input->getOption('path');
if ($path) { if ($inputPath) {
$path = '/'.trim($path, '/'); $inputPath = '/' . trim($inputPath, '/');
list (, $user, ) = explode('/', $path, 3); list (, $user,) = explode('/', $inputPath, 3);
$users = array($user); $users = array($user);
} else if ($input->getOption('all')) { } else if ($input->getOption('all')) {
$users = $this->userManager->search(''); $users = $this->userManager->search('');
@ -114,6 +114,7 @@ class Scan extends Command {
if (is_object($user)) { if (is_object($user)) {
$user = $user->getUID(); $user = $user->getUID();
} }
$path = $inputPath ? $inputPath : '/' . $user;
if ($this->userManager->userExists($user)) { if ($this->userManager->userExists($user)) {
$this->scanFiles($user, $path, $quiet, $output); $this->scanFiles($user, $path, $quiet, $output);
} else { } else {