diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-16 11:13:10 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-16 11:13:10 +0200 |
commit | a48bcceb237295386e9e598caf25161d6d305453 (patch) | |
tree | 9ecbf7f212a86e255149d37f90b9bc17291a6761 /core | |
parent | d21845557e9fdbc27817f6ed2d8249d17c14a978 (diff) | |
parent | 05e351416e1c45b88c7e51d39a4e9961e5b8546f (diff) | |
download | nextcloud-server-a48bcceb237295386e9e598caf25161d6d305453.tar.gz nextcloud-server-a48bcceb237295386e9e598caf25161d6d305453.zip |
Merge pull request #8917 from owncloud/repair-routine-base
Add support for repair step classes
Diffstat (limited to 'core')
-rw-r--r-- | core/command/maintenance/repair.php | 20 | ||||
-rw-r--r-- | core/register_command.php | 5 |
2 files changed, 23 insertions, 2 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); } } 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()); + |