Skip to content
Snippets Groups Projects
Commit cafc8cb2 authored by Bart Visscher's avatar Bart Visscher
Browse files

Change Files Scan command to use OC\User\Manager

parent 0aba549e
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,19 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Scan extends Command
{
protected function configure()
{
class Scan extends Command {
/**
* @var \OC\User\Manager $userManager
*/
private $userManager;
public function __construct(\OC\User\Manager $userManager) {
$this->userManager = $userManager;
parent::__construct();
}
protected function configure() {
$this
->setName('files:scan')
->setDescription('rescan filesystem')
......@@ -40,15 +49,17 @@ class Scan extends Command
$scanner->scan('');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
protected function execute(InputInterface $input, OutputInterface $output) {
if ($input->getOption('all')) {
$users = \OC_User::getUsers();
$users = $this->userManager->search('');
} else {
$users = $input->getArgument('user_id');
}
foreach ($users as $user) {
if (is_object($user)) {
$user = $user->getUID();
}
$this->scanFiles($user, $output);
}
}
......
......@@ -27,5 +27,5 @@ if (!OC::$CLI) {
$defaults = new OC_Defaults;
$application = new Application($defaults->getName(), \OC_Util::getVersionString());
$application->add(new OC\Core\Command\Status);
$application->add(new OCA\Files\Command\Scan);
$application->add(new OCA\Files\Command\Scan(OC_User::getManager()));
$application->run();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment