[Pkg-owncloud-commits] [owncloud] 107/199: Receive \OC\User\Manager as a constructor dependency.

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 52e7bf96306a048c43d77d5c3db42f89187f45ce
Author: Andreas Fischer <bantu at owncloud.com>
Date:   Wed May 28 22:42:33 2014 +0200

    Receive \OC\User\Manager as a constructor dependency.
---
 core/command/resetpassword.php | 12 ++++++++++--
 core/register_command.php      |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/core/command/resetpassword.php b/core/command/resetpassword.php
index b518404..ab87765 100644
--- a/core/command/resetpassword.php
+++ b/core/command/resetpassword.php
@@ -14,6 +14,15 @@ use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Output\OutputInterface;
 
 class ResetPassword extends Command {
+
+	/** @var \OC\User\Manager */
+	protected $userManager;
+
+	public function __construct(\OC\User\Manager $userManager) {
+		$this->userManager = $userManager;
+		parent::__construct();
+	}
+
 	protected function configure() {
 		$this
 			->setName('resetpassword')
@@ -29,8 +38,7 @@ class ResetPassword extends Command {
 	protected function execute(InputInterface $input, OutputInterface $output) {
 		$username = $input->getArgument('user');
 
-		$userManager = \OC::$server->getUserManager();
-		$user = $userManager->get($username);
+		$user = $this->userManager->get($username);
 		if (is_null($user)) {
 			$output->writeln("<error>There is no user called " . $username . "</error>");
 			return 1;
diff --git a/core/register_command.php b/core/register_command.php
index 44d7dbc..e9b6250 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -10,7 +10,7 @@
 $application->add(new OC\Core\Command\Status);
 $application->add(new OC\Core\Command\Db\GenerateChangeScript());
 $application->add(new OC\Core\Command\Upgrade());
-$application->add(new OC\Core\Command\ResetPassword());
+$application->add(new OC\Core\Command\ResetPassword(\OC::$server->getUserManager()));
 $application->add(new OC\Core\Command\Maintenance\SingleUser());
 $application->add(new OC\Core\Command\App\Disable());
 $application->add(new OC\Core\Command\App\Enable());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list