From ca690c4d02d6c59e3fb9edb0f75ae640d744b612 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 10 Jun 2014 11:47:27 +0200 Subject: Added RepairStep interface and default repair step lists The updater is using "before update" repair steps and "regular" repair steps. The "regular" repair steps are also used by the CLI tool. Currently no steps exist but can be added later in the static methods in the \OC\Repair class. Added unit test to test messaging, error and exception cases. --- core/command/maintenance/repair.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'core/command/maintenance') diff --git a/core/command/maintenance/repair.php b/core/command/maintenance/repair.php index 43ae6479eb0..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,12 @@ class Repair extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - \OC_DB::enableCaching(false); - $maintenanceMode = \OC_Config::getValue('maintenance', false); - \OC_Config::setValue('maintenance', true); + // 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); @@ -49,6 +54,6 @@ class Repair extends Command { $this->repair->run(); - \OC_Config::setValue('maintenance', $maintenanceMode); + $this->config->setValue('maintenance', $maintenanceMode); } } -- cgit v1.2.3