From 3aa77960ef78e397ae3e42d82aae32cac3114752 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 19 Apr 2016 15:36:11 +0200 Subject: Adding pre- and post-migration repair steps --- core/Command/Maintenance/Repair.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'core/Command/Maintenance') diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index 95e2b872227..2da76143390 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -24,15 +24,14 @@ namespace OC\Core\Command\Maintenance; +use Exception; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Repair extends Command { - /** - * @var \OC\Repair $repair - */ + /** @var \OC\Repair $repair */ protected $repair; /** @var \OCP\IConfig */ protected $config; @@ -55,9 +54,7 @@ class Repair extends Command { 'include-expensive', null, InputOption::VALUE_NONE, - 'Use this option when you want to include resource and load expensive tasks' - ) - ; + 'Use this option when you want to include resource and load expensive tasks'); } protected function execute(InputInterface $input, OutputInterface $output) { @@ -68,6 +65,25 @@ class Repair extends Command { } } + $apps = \OC::$server->getAppManager()->getInstalledApps(); + foreach ($apps as $app) { + if (!\OC_App::isEnabled($app)) { + continue; + } + $info = \OC_App::getAppInfo($app); + if (!is_array($info)) { + continue; + } + $steps = $info['repair-steps']['post-migration']; + foreach ($steps as $step) { + try { + $this->repair->addStep($step); + } catch (Exception $ex) { + $output->writeln("Failed to load repair step for $app: {$ex->getMessage()}"); + } + } + } + $maintenanceMode = $this->config->getSystemValue('maintenance', false); $this->config->setSystemValue('maintenance', true); -- cgit v1.2.3