@@ -38,119 +38,119 @@ |
||
38 | 38 | use Symfony\Component\EventDispatcher\GenericEvent; |
39 | 39 | |
40 | 40 | class Repair extends Command { |
41 | - /** @var \OC\Repair $repair */ |
|
42 | - protected $repair; |
|
43 | - /** @var IConfig */ |
|
44 | - protected $config; |
|
45 | - /** @var EventDispatcherInterface */ |
|
46 | - private $dispatcher; |
|
47 | - /** @var ProgressBar */ |
|
48 | - private $progress; |
|
49 | - /** @var OutputInterface */ |
|
50 | - private $output; |
|
51 | - /** @var IAppManager */ |
|
52 | - private $appManager; |
|
41 | + /** @var \OC\Repair $repair */ |
|
42 | + protected $repair; |
|
43 | + /** @var IConfig */ |
|
44 | + protected $config; |
|
45 | + /** @var EventDispatcherInterface */ |
|
46 | + private $dispatcher; |
|
47 | + /** @var ProgressBar */ |
|
48 | + private $progress; |
|
49 | + /** @var OutputInterface */ |
|
50 | + private $output; |
|
51 | + /** @var IAppManager */ |
|
52 | + private $appManager; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param \OC\Repair $repair |
|
56 | - * @param IConfig $config |
|
57 | - * @param EventDispatcherInterface $dispatcher |
|
58 | - * @param IAppManager $appManager |
|
59 | - */ |
|
60 | - public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher, IAppManager $appManager) { |
|
61 | - $this->repair = $repair; |
|
62 | - $this->config = $config; |
|
63 | - $this->dispatcher = $dispatcher; |
|
64 | - $this->appManager = $appManager; |
|
65 | - parent::__construct(); |
|
66 | - } |
|
54 | + /** |
|
55 | + * @param \OC\Repair $repair |
|
56 | + * @param IConfig $config |
|
57 | + * @param EventDispatcherInterface $dispatcher |
|
58 | + * @param IAppManager $appManager |
|
59 | + */ |
|
60 | + public function __construct(\OC\Repair $repair, IConfig $config, EventDispatcherInterface $dispatcher, IAppManager $appManager) { |
|
61 | + $this->repair = $repair; |
|
62 | + $this->config = $config; |
|
63 | + $this->dispatcher = $dispatcher; |
|
64 | + $this->appManager = $appManager; |
|
65 | + parent::__construct(); |
|
66 | + } |
|
67 | 67 | |
68 | - protected function configure() { |
|
69 | - $this |
|
70 | - ->setName('maintenance:repair') |
|
71 | - ->setDescription('repair this installation') |
|
72 | - ->addOption( |
|
73 | - 'include-expensive', |
|
74 | - null, |
|
75 | - InputOption::VALUE_NONE, |
|
76 | - 'Use this option when you want to include resource and load expensive tasks'); |
|
77 | - } |
|
68 | + protected function configure() { |
|
69 | + $this |
|
70 | + ->setName('maintenance:repair') |
|
71 | + ->setDescription('repair this installation') |
|
72 | + ->addOption( |
|
73 | + 'include-expensive', |
|
74 | + null, |
|
75 | + InputOption::VALUE_NONE, |
|
76 | + 'Use this option when you want to include resource and load expensive tasks'); |
|
77 | + } |
|
78 | 78 | |
79 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
80 | - $repairSteps = $this->repair::getRepairSteps(); |
|
79 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
80 | + $repairSteps = $this->repair::getRepairSteps(); |
|
81 | 81 | |
82 | - if ($input->getOption('include-expensive')) { |
|
83 | - $repairSteps = array_merge($repairSteps, $this->repair::getExpensiveRepairSteps()); |
|
84 | - } |
|
82 | + if ($input->getOption('include-expensive')) { |
|
83 | + $repairSteps = array_merge($repairSteps, $this->repair::getExpensiveRepairSteps()); |
|
84 | + } |
|
85 | 85 | |
86 | - foreach ($repairSteps as $step) { |
|
87 | - $this->repair->addStep($step); |
|
88 | - } |
|
86 | + foreach ($repairSteps as $step) { |
|
87 | + $this->repair->addStep($step); |
|
88 | + } |
|
89 | 89 | |
90 | - $apps = $this->appManager->getInstalledApps(); |
|
91 | - foreach ($apps as $app) { |
|
92 | - if (!$this->appManager->isEnabledForUser($app)) { |
|
93 | - continue; |
|
94 | - } |
|
95 | - $info = \OC_App::getAppInfo($app); |
|
96 | - if (!is_array($info)) { |
|
97 | - continue; |
|
98 | - } |
|
99 | - $steps = $info['repair-steps']['post-migration']; |
|
100 | - foreach ($steps as $step) { |
|
101 | - try { |
|
102 | - $this->repair->addStep($step); |
|
103 | - } catch (Exception $ex) { |
|
104 | - $output->writeln("<error>Failed to load repair step for $app: {$ex->getMessage()}</error>"); |
|
105 | - } |
|
106 | - } |
|
107 | - } |
|
90 | + $apps = $this->appManager->getInstalledApps(); |
|
91 | + foreach ($apps as $app) { |
|
92 | + if (!$this->appManager->isEnabledForUser($app)) { |
|
93 | + continue; |
|
94 | + } |
|
95 | + $info = \OC_App::getAppInfo($app); |
|
96 | + if (!is_array($info)) { |
|
97 | + continue; |
|
98 | + } |
|
99 | + $steps = $info['repair-steps']['post-migration']; |
|
100 | + foreach ($steps as $step) { |
|
101 | + try { |
|
102 | + $this->repair->addStep($step); |
|
103 | + } catch (Exception $ex) { |
|
104 | + $output->writeln("<error>Failed to load repair step for $app: {$ex->getMessage()}</error>"); |
|
105 | + } |
|
106 | + } |
|
107 | + } |
|
108 | 108 | |
109 | - $maintenanceMode = $this->config->getSystemValue('maintenance', false); |
|
110 | - $this->config->setSystemValue('maintenance', true); |
|
109 | + $maintenanceMode = $this->config->getSystemValue('maintenance', false); |
|
110 | + $this->config->setSystemValue('maintenance', true); |
|
111 | 111 | |
112 | - $this->progress = new ProgressBar($output); |
|
113 | - $this->output = $output; |
|
114 | - $this->dispatcher->addListener('\OC\Repair::startProgress', [$this, 'handleRepairFeedBack']); |
|
115 | - $this->dispatcher->addListener('\OC\Repair::advance', [$this, 'handleRepairFeedBack']); |
|
116 | - $this->dispatcher->addListener('\OC\Repair::finishProgress', [$this, 'handleRepairFeedBack']); |
|
117 | - $this->dispatcher->addListener('\OC\Repair::step', [$this, 'handleRepairFeedBack']); |
|
118 | - $this->dispatcher->addListener('\OC\Repair::info', [$this, 'handleRepairFeedBack']); |
|
119 | - $this->dispatcher->addListener('\OC\Repair::warning', [$this, 'handleRepairFeedBack']); |
|
120 | - $this->dispatcher->addListener('\OC\Repair::error', [$this, 'handleRepairFeedBack']); |
|
112 | + $this->progress = new ProgressBar($output); |
|
113 | + $this->output = $output; |
|
114 | + $this->dispatcher->addListener('\OC\Repair::startProgress', [$this, 'handleRepairFeedBack']); |
|
115 | + $this->dispatcher->addListener('\OC\Repair::advance', [$this, 'handleRepairFeedBack']); |
|
116 | + $this->dispatcher->addListener('\OC\Repair::finishProgress', [$this, 'handleRepairFeedBack']); |
|
117 | + $this->dispatcher->addListener('\OC\Repair::step', [$this, 'handleRepairFeedBack']); |
|
118 | + $this->dispatcher->addListener('\OC\Repair::info', [$this, 'handleRepairFeedBack']); |
|
119 | + $this->dispatcher->addListener('\OC\Repair::warning', [$this, 'handleRepairFeedBack']); |
|
120 | + $this->dispatcher->addListener('\OC\Repair::error', [$this, 'handleRepairFeedBack']); |
|
121 | 121 | |
122 | - $this->repair->run(); |
|
122 | + $this->repair->run(); |
|
123 | 123 | |
124 | - $this->config->setSystemValue('maintenance', $maintenanceMode); |
|
125 | - } |
|
124 | + $this->config->setSystemValue('maintenance', $maintenanceMode); |
|
125 | + } |
|
126 | 126 | |
127 | - public function handleRepairFeedBack($event) { |
|
128 | - if (!$event instanceof GenericEvent) { |
|
129 | - return; |
|
130 | - } |
|
131 | - switch ($event->getSubject()) { |
|
132 | - case '\OC\Repair::startProgress': |
|
133 | - $this->progress->start($event->getArgument(0)); |
|
134 | - break; |
|
135 | - case '\OC\Repair::advance': |
|
136 | - $this->progress->advance($event->getArgument(0)); |
|
137 | - break; |
|
138 | - case '\OC\Repair::finishProgress': |
|
139 | - $this->progress->finish(); |
|
140 | - $this->output->writeln(''); |
|
141 | - break; |
|
142 | - case '\OC\Repair::step': |
|
143 | - $this->output->writeln(' - ' . $event->getArgument(0)); |
|
144 | - break; |
|
145 | - case '\OC\Repair::info': |
|
146 | - $this->output->writeln(' - ' . $event->getArgument(0)); |
|
147 | - break; |
|
148 | - case '\OC\Repair::warning': |
|
149 | - $this->output->writeln(' - WARNING: ' . $event->getArgument(0)); |
|
150 | - break; |
|
151 | - case '\OC\Repair::error': |
|
152 | - $this->output->writeln(' - ERROR: ' . $event->getArgument(0)); |
|
153 | - break; |
|
154 | - } |
|
155 | - } |
|
127 | + public function handleRepairFeedBack($event) { |
|
128 | + if (!$event instanceof GenericEvent) { |
|
129 | + return; |
|
130 | + } |
|
131 | + switch ($event->getSubject()) { |
|
132 | + case '\OC\Repair::startProgress': |
|
133 | + $this->progress->start($event->getArgument(0)); |
|
134 | + break; |
|
135 | + case '\OC\Repair::advance': |
|
136 | + $this->progress->advance($event->getArgument(0)); |
|
137 | + break; |
|
138 | + case '\OC\Repair::finishProgress': |
|
139 | + $this->progress->finish(); |
|
140 | + $this->output->writeln(''); |
|
141 | + break; |
|
142 | + case '\OC\Repair::step': |
|
143 | + $this->output->writeln(' - ' . $event->getArgument(0)); |
|
144 | + break; |
|
145 | + case '\OC\Repair::info': |
|
146 | + $this->output->writeln(' - ' . $event->getArgument(0)); |
|
147 | + break; |
|
148 | + case '\OC\Repair::warning': |
|
149 | + $this->output->writeln(' - WARNING: ' . $event->getArgument(0)); |
|
150 | + break; |
|
151 | + case '\OC\Repair::error': |
|
152 | + $this->output->writeln(' - ERROR: ' . $event->getArgument(0)); |
|
153 | + break; |
|
154 | + } |
|
155 | + } |
|
156 | 156 | } |
@@ -43,129 +43,129 @@ |
||
43 | 43 | $application->add(new OC\Core\Command\App\CheckCode()); |
44 | 44 | $application->add(new OC\Core\Command\L10n\CreateJs()); |
45 | 45 | $application->add(new \OC\Core\Command\Integrity\SignApp( |
46 | - \OC::$server->getIntegrityCodeChecker(), |
|
47 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
48 | - \OC::$server->getURLGenerator() |
|
46 | + \OC::$server->getIntegrityCodeChecker(), |
|
47 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
48 | + \OC::$server->getURLGenerator() |
|
49 | 49 | )); |
50 | 50 | $application->add(new \OC\Core\Command\Integrity\SignCore( |
51 | - \OC::$server->getIntegrityCodeChecker(), |
|
52 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
51 | + \OC::$server->getIntegrityCodeChecker(), |
|
52 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
53 | 53 | )); |
54 | 54 | $application->add(new \OC\Core\Command\Integrity\CheckApp( |
55 | - \OC::$server->getIntegrityCodeChecker() |
|
55 | + \OC::$server->getIntegrityCodeChecker() |
|
56 | 56 | )); |
57 | 57 | $application->add(new \OC\Core\Command\Integrity\CheckCore( |
58 | - \OC::$server->getIntegrityCodeChecker() |
|
58 | + \OC::$server->getIntegrityCodeChecker() |
|
59 | 59 | )); |
60 | 60 | |
61 | 61 | |
62 | 62 | if (\OC::$server->getConfig()->getSystemValue('installed', false)) { |
63 | - $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
64 | - $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager())); |
|
65 | - $application->add(new OC\Core\Command\App\Install()); |
|
66 | - $application->add(new OC\Core\Command\App\GetPath()); |
|
67 | - $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
68 | - $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
69 | - $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
63 | + $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
64 | + $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager())); |
|
65 | + $application->add(new OC\Core\Command\App\Install()); |
|
66 | + $application->add(new OC\Core\Command\App\GetPath()); |
|
67 | + $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
68 | + $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
69 | + $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
70 | 70 | |
71 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
72 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
73 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
74 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
75 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
71 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
72 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
73 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
74 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
75 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
76 | 76 | |
77 | - $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
78 | - $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
79 | - $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
77 | + $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
78 | + $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
79 | + $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
80 | 80 | |
81 | - $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
82 | - $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
83 | - $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
84 | - $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
85 | - $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
86 | - $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
87 | - $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
88 | - $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
81 | + $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
82 | + $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
83 | + $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
84 | + $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
85 | + $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
86 | + $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
87 | + $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
88 | + $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
89 | 89 | |
90 | - $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
91 | - $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
92 | - $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
93 | - $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
94 | - $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
95 | - $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
96 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
97 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
98 | - $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
90 | + $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
91 | + $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
92 | + $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
93 | + $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
94 | + $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
95 | + $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
96 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
97 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
98 | + $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
99 | 99 | |
100 | - $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
101 | - $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
102 | - $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager())); |
|
103 | - $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager())); |
|
104 | - $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
105 | - $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
106 | - $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
107 | - \OC::$server->getEncryptionManager(), |
|
108 | - \OC::$server->getAppManager(), |
|
109 | - \OC::$server->getConfig(), |
|
110 | - new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
111 | - new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
112 | - ); |
|
100 | + $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
101 | + $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
102 | + $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager())); |
|
103 | + $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager())); |
|
104 | + $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
105 | + $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
106 | + $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
107 | + \OC::$server->getEncryptionManager(), |
|
108 | + \OC::$server->getAppManager(), |
|
109 | + \OC::$server->getConfig(), |
|
110 | + new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
111 | + new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
112 | + ); |
|
113 | 113 | |
114 | - $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
115 | - $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
114 | + $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
115 | + $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
116 | 116 | |
117 | - $view = new \OC\Files\View(); |
|
118 | - $util = new \OC\Encryption\Util( |
|
119 | - $view, |
|
120 | - \OC::$server->getUserManager(), |
|
121 | - \OC::$server->getGroupManager(), |
|
122 | - \OC::$server->getConfig() |
|
123 | - ); |
|
124 | - $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
125 | - $view, |
|
126 | - \OC::$server->getUserManager(), |
|
127 | - \OC::$server->getConfig(), |
|
128 | - $util, |
|
129 | - new \Symfony\Component\Console\Helper\QuestionHelper() |
|
130 | - ) |
|
131 | - ); |
|
132 | - $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
117 | + $view = new \OC\Files\View(); |
|
118 | + $util = new \OC\Encryption\Util( |
|
119 | + $view, |
|
120 | + \OC::$server->getUserManager(), |
|
121 | + \OC::$server->getGroupManager(), |
|
122 | + \OC::$server->getConfig() |
|
123 | + ); |
|
124 | + $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
125 | + $view, |
|
126 | + \OC::$server->getUserManager(), |
|
127 | + \OC::$server->getConfig(), |
|
128 | + $util, |
|
129 | + new \Symfony\Component\Console\Helper\QuestionHelper() |
|
130 | + ) |
|
131 | + ); |
|
132 | + $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
133 | 133 | |
134 | - $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
135 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
136 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
137 | - $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
138 | - $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
139 | - $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
134 | + $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
135 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
136 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
137 | + $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
138 | + $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
139 | + $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
140 | 140 | |
141 | - $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
142 | - $application->add(new OC\Core\Command\Maintenance\Repair( |
|
143 | - new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
144 | - \OC::$server->getConfig(), |
|
145 | - \OC::$server->getEventDispatcher(), |
|
146 | - \OC::$server->getAppManager() |
|
147 | - )); |
|
141 | + $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
142 | + $application->add(new OC\Core\Command\Maintenance\Repair( |
|
143 | + new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
144 | + \OC::$server->getConfig(), |
|
145 | + \OC::$server->getEventDispatcher(), |
|
146 | + \OC::$server->getAppManager() |
|
147 | + )); |
|
148 | 148 | |
149 | - $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
150 | - $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
151 | - $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
152 | - $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
153 | - $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
154 | - $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); |
|
155 | - $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
156 | - $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
157 | - $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager())); |
|
158 | - $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
149 | + $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
150 | + $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
151 | + $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
152 | + $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
153 | + $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
154 | + $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager())); |
|
155 | + $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
156 | + $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
157 | + $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager())); |
|
158 | + $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
159 | 159 | |
160 | - $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
161 | - $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
162 | - $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
163 | - $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
164 | - $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
160 | + $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
161 | + $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
162 | + $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
163 | + $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
164 | + $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
165 | 165 | |
166 | - $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); |
|
167 | - $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); |
|
168 | - $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); |
|
166 | + $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core'))); |
|
167 | + $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null))); |
|
168 | + $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null))); |
|
169 | 169 | } else { |
170 | - $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig())); |
|
170 | + $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig())); |
|
171 | 171 | } |
@@ -61,176 +61,176 @@ |
||
61 | 61 | |
62 | 62 | class Repair implements IOutput { |
63 | 63 | |
64 | - /** @var IRepairStep[] */ |
|
65 | - private $repairSteps; |
|
66 | - |
|
67 | - /** @var EventDispatcherInterface */ |
|
68 | - private $dispatcher; |
|
69 | - |
|
70 | - /** @var string */ |
|
71 | - private $currentStep; |
|
72 | - |
|
73 | - /** |
|
74 | - * Creates a new repair step runner |
|
75 | - * |
|
76 | - * @param IRepairStep[] $repairSteps array of RepairStep instances |
|
77 | - * @param EventDispatcherInterface $dispatcher |
|
78 | - */ |
|
79 | - public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { |
|
80 | - $this->repairSteps = $repairSteps; |
|
81 | - $this->dispatcher = $dispatcher; |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * Run a series of repair steps for common problems |
|
86 | - */ |
|
87 | - public function run() { |
|
88 | - if (count($this->repairSteps) === 0) { |
|
89 | - $this->emit('\OC\Repair', 'info', array('No repair steps available')); |
|
90 | - |
|
91 | - return; |
|
92 | - } |
|
93 | - // run each repair step |
|
94 | - foreach ($this->repairSteps as $step) { |
|
95 | - $this->currentStep = $step->getName(); |
|
96 | - $this->emit('\OC\Repair', 'step', [$this->currentStep]); |
|
97 | - $step->run($this); |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Add repair step |
|
103 | - * |
|
104 | - * @param IRepairStep|string $repairStep repair step |
|
105 | - * @throws \Exception |
|
106 | - */ |
|
107 | - public function addStep($repairStep) { |
|
108 | - if (is_string($repairStep)) { |
|
109 | - try { |
|
110 | - $s = \OC::$server->query($repairStep); |
|
111 | - } catch (QueryException $e) { |
|
112 | - if (class_exists($repairStep)) { |
|
113 | - $s = new $repairStep(); |
|
114 | - } else { |
|
115 | - throw new \Exception("Repair step '$repairStep' is unknown"); |
|
116 | - } |
|
117 | - } |
|
118 | - |
|
119 | - if ($s instanceof IRepairStep) { |
|
120 | - $this->repairSteps[] = $s; |
|
121 | - } else { |
|
122 | - throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep"); |
|
123 | - } |
|
124 | - } else { |
|
125 | - $this->repairSteps[] = $repairStep; |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Returns the default repair steps to be run on the |
|
131 | - * command line or after an upgrade. |
|
132 | - * |
|
133 | - * @return IRepairStep[] |
|
134 | - */ |
|
135 | - public static function getRepairSteps() { |
|
136 | - return [ |
|
137 | - new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), |
|
138 | - new RepairMimeTypes(\OC::$server->getConfig()), |
|
139 | - new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), |
|
140 | - new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
141 | - new RemoveRootShares(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager(), \OC::$server->getLazyRootFolder()), |
|
142 | - new MoveUpdaterStepFile(\OC::$server->getConfig()), |
|
143 | - new FixMountStorages(\OC::$server->getDatabaseConnection()), |
|
144 | - new RepairInvalidPaths(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
145 | - new AddLogRotateJob(\OC::$server->getJobList()), |
|
146 | - new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)), |
|
147 | - new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)), |
|
148 | - new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), |
|
149 | - new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), |
|
150 | - new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
151 | - new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger()), |
|
152 | - new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()), |
|
153 | - ]; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Returns expensive repair steps to be run on the |
|
158 | - * command line with a special option. |
|
159 | - * |
|
160 | - * @return IRepairStep[] |
|
161 | - */ |
|
162 | - public static function getExpensiveRepairSteps() { |
|
163 | - return [ |
|
164 | - new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()) |
|
165 | - ]; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Returns the repair steps to be run before an |
|
170 | - * upgrade. |
|
171 | - * |
|
172 | - * @return IRepairStep[] |
|
173 | - */ |
|
174 | - public static function getBeforeUpgradeRepairSteps() { |
|
175 | - $connection = \OC::$server->getDatabaseConnection(); |
|
176 | - $config = \OC::$server->getConfig(); |
|
177 | - $steps = [ |
|
178 | - new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true), |
|
179 | - new SqliteAutoincrement($connection), |
|
180 | - new SaveAccountsTableData($connection, $config), |
|
181 | - new DropAccountTermsTable($connection) |
|
182 | - ]; |
|
183 | - |
|
184 | - return $steps; |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * @param string $scope |
|
189 | - * @param string $method |
|
190 | - * @param array $arguments |
|
191 | - */ |
|
192 | - public function emit($scope, $method, array $arguments = []) { |
|
193 | - if (!is_null($this->dispatcher)) { |
|
194 | - $this->dispatcher->dispatch("$scope::$method", |
|
195 | - new GenericEvent("$scope::$method", $arguments)); |
|
196 | - } |
|
197 | - } |
|
198 | - |
|
199 | - public function info($string) { |
|
200 | - // for now just emit as we did in the past |
|
201 | - $this->emit('\OC\Repair', 'info', array($string)); |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @param string $message |
|
206 | - */ |
|
207 | - public function warning($message) { |
|
208 | - // for now just emit as we did in the past |
|
209 | - $this->emit('\OC\Repair', 'warning', [$message]); |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * @param int $max |
|
214 | - */ |
|
215 | - public function startProgress($max = 0) { |
|
216 | - // for now just emit as we did in the past |
|
217 | - $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); |
|
218 | - } |
|
219 | - |
|
220 | - /** |
|
221 | - * @param int $step |
|
222 | - * @param string $description |
|
223 | - */ |
|
224 | - public function advance($step = 1, $description = '') { |
|
225 | - // for now just emit as we did in the past |
|
226 | - $this->emit('\OC\Repair', 'advance', [$step, $description]); |
|
227 | - } |
|
228 | - |
|
229 | - /** |
|
230 | - * @param int $max |
|
231 | - */ |
|
232 | - public function finishProgress() { |
|
233 | - // for now just emit as we did in the past |
|
234 | - $this->emit('\OC\Repair', 'finishProgress', []); |
|
235 | - } |
|
64 | + /** @var IRepairStep[] */ |
|
65 | + private $repairSteps; |
|
66 | + |
|
67 | + /** @var EventDispatcherInterface */ |
|
68 | + private $dispatcher; |
|
69 | + |
|
70 | + /** @var string */ |
|
71 | + private $currentStep; |
|
72 | + |
|
73 | + /** |
|
74 | + * Creates a new repair step runner |
|
75 | + * |
|
76 | + * @param IRepairStep[] $repairSteps array of RepairStep instances |
|
77 | + * @param EventDispatcherInterface $dispatcher |
|
78 | + */ |
|
79 | + public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { |
|
80 | + $this->repairSteps = $repairSteps; |
|
81 | + $this->dispatcher = $dispatcher; |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * Run a series of repair steps for common problems |
|
86 | + */ |
|
87 | + public function run() { |
|
88 | + if (count($this->repairSteps) === 0) { |
|
89 | + $this->emit('\OC\Repair', 'info', array('No repair steps available')); |
|
90 | + |
|
91 | + return; |
|
92 | + } |
|
93 | + // run each repair step |
|
94 | + foreach ($this->repairSteps as $step) { |
|
95 | + $this->currentStep = $step->getName(); |
|
96 | + $this->emit('\OC\Repair', 'step', [$this->currentStep]); |
|
97 | + $step->run($this); |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Add repair step |
|
103 | + * |
|
104 | + * @param IRepairStep|string $repairStep repair step |
|
105 | + * @throws \Exception |
|
106 | + */ |
|
107 | + public function addStep($repairStep) { |
|
108 | + if (is_string($repairStep)) { |
|
109 | + try { |
|
110 | + $s = \OC::$server->query($repairStep); |
|
111 | + } catch (QueryException $e) { |
|
112 | + if (class_exists($repairStep)) { |
|
113 | + $s = new $repairStep(); |
|
114 | + } else { |
|
115 | + throw new \Exception("Repair step '$repairStep' is unknown"); |
|
116 | + } |
|
117 | + } |
|
118 | + |
|
119 | + if ($s instanceof IRepairStep) { |
|
120 | + $this->repairSteps[] = $s; |
|
121 | + } else { |
|
122 | + throw new \Exception("Repair step '$repairStep' is not of type \\OCP\\Migration\\IRepairStep"); |
|
123 | + } |
|
124 | + } else { |
|
125 | + $this->repairSteps[] = $repairStep; |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Returns the default repair steps to be run on the |
|
131 | + * command line or after an upgrade. |
|
132 | + * |
|
133 | + * @return IRepairStep[] |
|
134 | + */ |
|
135 | + public static function getRepairSteps() { |
|
136 | + return [ |
|
137 | + new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false), |
|
138 | + new RepairMimeTypes(\OC::$server->getConfig()), |
|
139 | + new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()), |
|
140 | + new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), |
|
141 | + new RemoveRootShares(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager(), \OC::$server->getLazyRootFolder()), |
|
142 | + new MoveUpdaterStepFile(\OC::$server->getConfig()), |
|
143 | + new FixMountStorages(\OC::$server->getDatabaseConnection()), |
|
144 | + new RepairInvalidPaths(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
145 | + new AddLogRotateJob(\OC::$server->getJobList()), |
|
146 | + new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(SCSSCacher::class), \OC::$server->query(JSCombiner::class)), |
|
147 | + new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)), |
|
148 | + new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), |
|
149 | + new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), |
|
150 | + new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), |
|
151 | + new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger()), |
|
152 | + new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()), |
|
153 | + ]; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Returns expensive repair steps to be run on the |
|
158 | + * command line with a special option. |
|
159 | + * |
|
160 | + * @return IRepairStep[] |
|
161 | + */ |
|
162 | + public static function getExpensiveRepairSteps() { |
|
163 | + return [ |
|
164 | + new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()) |
|
165 | + ]; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Returns the repair steps to be run before an |
|
170 | + * upgrade. |
|
171 | + * |
|
172 | + * @return IRepairStep[] |
|
173 | + */ |
|
174 | + public static function getBeforeUpgradeRepairSteps() { |
|
175 | + $connection = \OC::$server->getDatabaseConnection(); |
|
176 | + $config = \OC::$server->getConfig(); |
|
177 | + $steps = [ |
|
178 | + new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connection, true), |
|
179 | + new SqliteAutoincrement($connection), |
|
180 | + new SaveAccountsTableData($connection, $config), |
|
181 | + new DropAccountTermsTable($connection) |
|
182 | + ]; |
|
183 | + |
|
184 | + return $steps; |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * @param string $scope |
|
189 | + * @param string $method |
|
190 | + * @param array $arguments |
|
191 | + */ |
|
192 | + public function emit($scope, $method, array $arguments = []) { |
|
193 | + if (!is_null($this->dispatcher)) { |
|
194 | + $this->dispatcher->dispatch("$scope::$method", |
|
195 | + new GenericEvent("$scope::$method", $arguments)); |
|
196 | + } |
|
197 | + } |
|
198 | + |
|
199 | + public function info($string) { |
|
200 | + // for now just emit as we did in the past |
|
201 | + $this->emit('\OC\Repair', 'info', array($string)); |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @param string $message |
|
206 | + */ |
|
207 | + public function warning($message) { |
|
208 | + // for now just emit as we did in the past |
|
209 | + $this->emit('\OC\Repair', 'warning', [$message]); |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * @param int $max |
|
214 | + */ |
|
215 | + public function startProgress($max = 0) { |
|
216 | + // for now just emit as we did in the past |
|
217 | + $this->emit('\OC\Repair', 'startProgress', [$max, $this->currentStep]); |
|
218 | + } |
|
219 | + |
|
220 | + /** |
|
221 | + * @param int $step |
|
222 | + * @param string $description |
|
223 | + */ |
|
224 | + public function advance($step = 1, $description = '') { |
|
225 | + // for now just emit as we did in the past |
|
226 | + $this->emit('\OC\Repair', 'advance', [$step, $description]); |
|
227 | + } |
|
228 | + |
|
229 | + /** |
|
230 | + * @param int $max |
|
231 | + */ |
|
232 | + public function finishProgress() { |
|
233 | + // for now just emit as we did in the past |
|
234 | + $this->emit('\OC\Repair', 'finishProgress', []); |
|
235 | + } |
|
236 | 236 | } |
@@ -38,85 +38,85 @@ |
||
38 | 38 | */ |
39 | 39 | class BackgroundRepair extends TimedJob { |
40 | 40 | |
41 | - /** @var IJobList */ |
|
42 | - private $jobList; |
|
41 | + /** @var IJobList */ |
|
42 | + private $jobList; |
|
43 | 43 | |
44 | - /** @var ILogger */ |
|
45 | - private $logger; |
|
44 | + /** @var ILogger */ |
|
45 | + private $logger; |
|
46 | 46 | |
47 | - /** @var EventDispatcherInterface */ |
|
48 | - private $dispatcher; |
|
47 | + /** @var EventDispatcherInterface */ |
|
48 | + private $dispatcher; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param EventDispatcherInterface $dispatcher |
|
52 | - */ |
|
53 | - public function setDispatcher(EventDispatcherInterface $dispatcher): void { |
|
54 | - $this->dispatcher = $dispatcher; |
|
55 | - } |
|
50 | + /** |
|
51 | + * @param EventDispatcherInterface $dispatcher |
|
52 | + */ |
|
53 | + public function setDispatcher(EventDispatcherInterface $dispatcher): void { |
|
54 | + $this->dispatcher = $dispatcher; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * run the job, then remove it from the job list |
|
59 | - * |
|
60 | - * @param JobList $jobList |
|
61 | - * @param ILogger|null $logger |
|
62 | - */ |
|
63 | - public function execute($jobList, ILogger $logger = null) { |
|
64 | - // add an interval of 15 mins |
|
65 | - $this->setInterval(15*60); |
|
57 | + /** |
|
58 | + * run the job, then remove it from the job list |
|
59 | + * |
|
60 | + * @param JobList $jobList |
|
61 | + * @param ILogger|null $logger |
|
62 | + */ |
|
63 | + public function execute($jobList, ILogger $logger = null) { |
|
64 | + // add an interval of 15 mins |
|
65 | + $this->setInterval(15*60); |
|
66 | 66 | |
67 | - $this->jobList = $jobList; |
|
68 | - $this->logger = $logger; |
|
69 | - parent::execute($jobList, $logger); |
|
70 | - } |
|
67 | + $this->jobList = $jobList; |
|
68 | + $this->logger = $logger; |
|
69 | + parent::execute($jobList, $logger); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param array $argument |
|
74 | - * @throws \Exception |
|
75 | - * @throws \OC\NeedsUpdateException |
|
76 | - */ |
|
77 | - protected function run($argument) { |
|
78 | - if (!isset($argument['app']) || !isset($argument['step'])) { |
|
79 | - // remove the job - we can never execute it |
|
80 | - $this->jobList->remove($this, $this->argument); |
|
81 | - return; |
|
82 | - } |
|
83 | - $app = $argument['app']; |
|
72 | + /** |
|
73 | + * @param array $argument |
|
74 | + * @throws \Exception |
|
75 | + * @throws \OC\NeedsUpdateException |
|
76 | + */ |
|
77 | + protected function run($argument) { |
|
78 | + if (!isset($argument['app']) || !isset($argument['step'])) { |
|
79 | + // remove the job - we can never execute it |
|
80 | + $this->jobList->remove($this, $this->argument); |
|
81 | + return; |
|
82 | + } |
|
83 | + $app = $argument['app']; |
|
84 | 84 | |
85 | - try { |
|
86 | - $this->loadApp($app); |
|
87 | - } catch (NeedsUpdateException $ex) { |
|
88 | - // as long as the app is not yet done with it's offline migration |
|
89 | - // we better not start with the live migration |
|
90 | - return; |
|
91 | - } |
|
85 | + try { |
|
86 | + $this->loadApp($app); |
|
87 | + } catch (NeedsUpdateException $ex) { |
|
88 | + // as long as the app is not yet done with it's offline migration |
|
89 | + // we better not start with the live migration |
|
90 | + return; |
|
91 | + } |
|
92 | 92 | |
93 | - $step = $argument['step']; |
|
94 | - $repair = new Repair([], $this->dispatcher); |
|
95 | - try { |
|
96 | - $repair->addStep($step); |
|
97 | - } catch (\Exception $ex) { |
|
98 | - $this->logger->logException($ex,[ |
|
99 | - 'app' => 'migration' |
|
100 | - ]); |
|
93 | + $step = $argument['step']; |
|
94 | + $repair = new Repair([], $this->dispatcher); |
|
95 | + try { |
|
96 | + $repair->addStep($step); |
|
97 | + } catch (\Exception $ex) { |
|
98 | + $this->logger->logException($ex,[ |
|
99 | + 'app' => 'migration' |
|
100 | + ]); |
|
101 | 101 | |
102 | - // remove the job - we can never execute it |
|
103 | - $this->jobList->remove($this, $this->argument); |
|
104 | - return; |
|
105 | - } |
|
102 | + // remove the job - we can never execute it |
|
103 | + $this->jobList->remove($this, $this->argument); |
|
104 | + return; |
|
105 | + } |
|
106 | 106 | |
107 | - // execute the repair step |
|
108 | - $repair->run(); |
|
107 | + // execute the repair step |
|
108 | + $repair->run(); |
|
109 | 109 | |
110 | - // remove the job once executed successfully |
|
111 | - $this->jobList->remove($this, $this->argument); |
|
112 | - } |
|
110 | + // remove the job once executed successfully |
|
111 | + $this->jobList->remove($this, $this->argument); |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * @codeCoverageIgnore |
|
116 | - * @param $app |
|
117 | - * @throws NeedsUpdateException |
|
118 | - */ |
|
119 | - protected function loadApp($app) { |
|
120 | - OC_App::loadApp($app); |
|
121 | - } |
|
114 | + /** |
|
115 | + * @codeCoverageIgnore |
|
116 | + * @param $app |
|
117 | + * @throws NeedsUpdateException |
|
118 | + */ |
|
119 | + protected function loadApp($app) { |
|
120 | + OC_App::loadApp($app); |
|
121 | + } |
|
122 | 122 | } |