Use proper DI for repair command
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
3eaf23f29f
commit
dd192e5df9
|
@ -27,6 +27,7 @@
|
||||||
namespace OC\Core\Command\Maintenance;
|
namespace OC\Core\Command\Maintenance;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use OCP\App\IAppManager;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\ProgressBar;
|
use Symfony\Component\Console\Helper\ProgressBar;
|
||||||
|
@ -47,15 +48,20 @@ class Repair extends Command {
|
||||||
private $progress;
|
private $progress;
|
||||||
/** @var OutputInterface */
|
/** @var OutputInterface */
|
||||||
private $output;
|
private $output;
|
||||||
|
/** @var IAppManager */
|
||||||
|
private $appManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \OC\Repair $repair
|
* @param \OC\Repair $repair
|
||||||
* @param IConfig $config
|
* @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->repair = $repair;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
|
$this->appManager = $appManager;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +84,7 @@ class Repair extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$appManager = \OC::$server->getAppManager();
|
$apps = $this->appManager->getInstalledApps();
|
||||||
$apps = $appManager->getInstalledApps();
|
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
if (!$appManager->isEnabledForUser($app)) {
|
if (!$appManager->isEnabledForUser($app)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -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\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger()));
|
||||||
$application->add(new OC\Core\Command\Maintenance\Repair(
|
$application->add(new OC\Core\Command\Maintenance\Repair(
|
||||||
new \OC\Repair(\OC\Repair::getRepairSteps(), \OC::$server->getEventDispatcher()), \OC::$server->getConfig(),
|
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\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
|
||||||
$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
|
$application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
|
||||||
|
|
Loading…
Reference in New Issue