From ae9c9a46b8f11a0f548dfbbc23d3c215910130aa Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 7 Jan 2015 12:21:28 +0100 Subject: inject and use user manager to delete command instead of using old static oc_user way --- core/command/user/delete.php | 13 ++++++++++++- core/register_command.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/command/user/delete.php b/core/command/user/delete.php index f64b40e4921..d5ec3ee0bde 100644 --- a/core/command/user/delete.php +++ b/core/command/user/delete.php @@ -14,6 +14,17 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; class Delete extends Command { + /** @var \OC\User\Manager */ + protected $userManager; + + /** + * @param \OC\User\Manager $userManager + */ + public function __construct(\OC\User\Manager $userManager) { + $this->userManager = $userManager; + parent::__construct(); + } + protected function configure() { $this ->setName('user:delete') @@ -26,7 +37,7 @@ class Delete extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - $wasSuccessful = \OC_User::deleteUser($input->getArgument('uid')); + $wasSuccessful = $this->userManager->get($input->getArgument('uid'))->delete(); if($wasSuccessful === true) { $output->writeln('The specified user was deleted'); return; diff --git a/core/register_command.php b/core/register_command.php index 690e9879c47..5aa55be3e2c 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -22,6 +22,6 @@ $application->add(new OC\Core\Command\Maintenance\Repair($repair, \OC::$server-> $application->add(new OC\Core\Command\User\Report()); $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); $application->add(new OC\Core\Command\User\LastSeen()); -$application->add(new OC\Core\Command\User\Delete()); +$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); $application->add(new OC\Core\Command\L10n\CreateJs()); -- cgit v1.2.3