diff options
Diffstat (limited to 'core/command/maintenance/repair.php')
-rw-r--r-- | core/command/maintenance/repair.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/core/command/maintenance/repair.php b/core/command/maintenance/repair.php index 310c01fbe2a..9af5996b2e1 100644 --- a/core/command/maintenance/repair.php +++ b/core/command/maintenance/repair.php @@ -20,9 +20,11 @@ class Repair extends Command { /** * @param \OC\Repair $repair + * @param \OC\Config $config */ - public function __construct($repair) { + public function __construct(\OC\Repair $repair, \OC\Config $config) { $this->repair = $repair; + $this->config = $config; parent::__construct(); } @@ -33,9 +35,25 @@ class Repair extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { + // TODO: inject DB connection/factory when possible + $connection = \OC_DB::getConnection(); + $connection->disableQueryStatementCaching(); + + $maintenanceMode = $this->config->getValue('maintenance', false); + $this->config->setValue('maintenance', true); + $this->repair->listen('\OC\Repair', 'step', function ($description) use ($output) { $output->writeln(' - ' . $description); }); + $this->repair->listen('\OC\Repair', 'info', function ($description) use ($output) { + $output->writeln(' - ' . $description); + }); + $this->repair->listen('\OC\Repair', 'error', function ($description) use ($output) { + $output->writeln(' - ERROR: ' . $description); + }); + $this->repair->run(); + + $this->config->setValue('maintenance', $maintenanceMode); } } |