1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace OC\Repair\Owncloud;
- use OCP\BackgroundJob\IJobList;
- use OCP\IConfig;
- use OCP\Migration\IOutput;
- use OCP\Migration\IRepairStep;
- class MoveAvatars implements IRepairStep {
-
- private $jobList;
-
- private $config;
-
- public function __construct(IJobList $jobList,
- IConfig $config) {
- $this->jobList = $jobList;
- $this->config = $config;
- }
-
- public function getName() {
- return 'Add move avatar background job';
- }
- public function run(IOutput $output) {
-
- if ($this->config->getAppValue('core', 'moveavatarsdone') === 'yes') {
- $output->info('Repair step already executed');
- return;
- }
- if (!$this->config->getSystemValueBool('enable_avatars', true)) {
- $output->info('Avatars are disabled');
- } else {
- $output->info('Add background job');
- $this->jobList->add(MoveAvatarsBackgroundJob::class);
-
- $this->config->setAppValue('core', 'moveavatarsdone', 'yes');
- }
- }
- }
|