diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-10 11:47:27 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-12 17:38:26 +0200 |
commit | ca690c4d02d6c59e3fb9edb0f75ae640d744b612 (patch) | |
tree | 110d83d8c96d0b781155b42a6d9eead576fab6e7 /core | |
parent | 6fcd1af4db2d1bf8d61fa0c627c308e7257294b9 (diff) | |
download | nextcloud-server-ca690c4d02d6c59e3fb9edb0f75ae640d744b612.tar.gz nextcloud-server-ca690c4d02d6c59e3fb9edb0f75ae640d744b612.zip |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/command/maintenance/repair.php | 15 | ||||
-rw-r--r-- | core/register_command.php | 5 |
2 files changed, 14 insertions, 6 deletions
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); } } diff --git a/core/register_command.php b/core/register_command.php index 9ced377bee3..b02988bbdd8 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +$repair = new \OC\Repair(\OC\Repair::getRepairSteps()); + /** @var $application Symfony\Component\Console\Application */ $application->add(new OC\Core\Command\Status); $application->add(new OC\Core\Command\Db\GenerateChangeScript()); @@ -16,7 +18,8 @@ $application->add(new OC\Core\Command\Maintenance\Mode(OC_Config::getObject())); $application->add(new OC\Core\Command\App\Disable()); $application->add(new OC\Core\Command\App\Enable()); $application->add(new OC\Core\Command\App\ListApps()); -$application->add(new OC\Core\Command\Maintenance\Repair(new \OC\Repair())); +$application->add(new OC\Core\Command\Maintenance\Repair($repair, OC_Config::getObject())); $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()); + |