diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-10-24 17:50:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 17:50:03 +0200 |
commit | 77697288dee57f033d6ae48903571888e672d262 (patch) | |
tree | 5828fe9acd6323c0ed00acc258ad2780f9b06a61 | |
parent | b1f77aca4effec99387481a831910d4870ae2ffc (diff) | |
parent | dd192e5df94f92bb756b8712c9ec1a57755b7c1b (diff) | |
download | nextcloud-server-77697288dee57f033d6ae48903571888e672d262.tar.gz nextcloud-server-77697288dee57f033d6ae48903571888e672d262.zip |
Merge pull request #6930 from nextcloud/use-proper-di-for-repair-step
Use proper DI for repair command
-rw-r--r-- | core/Command/Maintenance/Repair.php | 11 | ||||
-rw-r--r-- | core/register_command.php | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 0d95b0ea3e2..9401dafd26b 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -27,6 +27,7 @@ namespace OC\Core\Command\Maintenance; use Exception; +use OCP\App\IAppManager; use OCP\IConfig; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; @@ -47,15 +48,20 @@ class Repair extends Command { private $progress; /** @var OutputInterface */ private $output; + /** @var IAppManager */ + private $appManager; /** * @param \OC\Repair $repair * @param IConfig $config + * @param EventDispatcherInterface $dispatcher + * @param IAppManager $appManager */ - public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher) { + public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher, IAppManager $appManager) { $this->repair = $repair; $this->config = $config; $this->dispatcher = $dispatcher; + $this->appManager = $appManager; parent::__construct(); } @@ -78,8 +84,7 @@ class Repair extends Command { } } - $appManager = \OC::$server->getAppManager(); - $apps = $appManager->getInstalledApps(); + $apps = $this->appManager->getInstalledApps(); foreach ($apps as $app) { if (!$appManager->isEnabledForUser($app)) { continue; diff --git a/core/register_command.php b/core/register_command.php index 3cba0565993..1b91d2005b9 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -136,7 +136,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger())); $application->add(new OC\Core\Command\Maintenance\Repair( new \OC\Repair(\OC\Repair::getRepairSteps(), \OC::$server->getEventDispatcher()), \OC::$server->getConfig(), - \OC::$server->getEventDispatcher())); + \OC::$server->getEventDispatcher(), \OC::$server->getAppManager())); $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |