Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-09-02 20:18:12 +0400
committerBart Visscher <bartv@thisnet.nl>2013-09-02 20:18:12 +0400
commitcafc8cb22347f0c861bbc333354e2766779e065d (patch)
treece88fadaa35023a582d1bd42146f72d2b2a869d1
parent0aba549e7f11e1035fa7a2e880803b47cbadd919 (diff)
Change Files Scan command to use OC\User\Manager
-rw-r--r--apps/files/command/scan.php25
-rw-r--r--console.php2
2 files changed, 19 insertions, 8 deletions
diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php
index fce4f6875d7..c5631d19561 100644
--- a/apps/files/command/scan.php
+++ b/apps/files/command/scan.php
@@ -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);
}
}
diff --git a/console.php b/console.php
index 9639f60b7ac..11df7eb0dc9 100644
--- a/console.php
+++ b/console.php
@@ -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();