summaryrefslogtreecommitdiffstats
path: root/core/Command/Maintenance
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-19 15:36:11 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-22 09:26:31 +0200
commit3aa77960ef78e397ae3e42d82aae32cac3114752 (patch)
treea0b11fd4e3c92a6bd0cbffa1efc0e2850011a1c9 /core/Command/Maintenance
parentd0030aad6cb108bbf4ca729d0e11f3438145aba9 (diff)
downloadnextcloud-server-3aa77960ef78e397ae3e42d82aae32cac3114752.tar.gz
nextcloud-server-3aa77960ef78e397ae3e42d82aae32cac3114752.zip
Adding pre- and post-migration repair steps
Diffstat (limited to 'core/Command/Maintenance')
-rw-r--r--core/Command/Maintenance/Repair.php28
1 files changed, 22 insertions, 6 deletions
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("<error>Failed to load repair step for $app: {$ex->getMessage()}</error>");
+ }
+ }
+ }
+
$maintenanceMode = $this->config->getSystemValue('maintenance', false);
$this->config->setSystemValue('maintenance', true);