2016-09-12 07:53:31 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright 2016 Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
namespace OC\Repair\NC11;
|
|
|
|
|
|
|
|
use OC\SystemConfig;
|
2016-09-14 18:15:15 +00:00
|
|
|
use OCP\BackgroundJob\IJobList;
|
2016-09-12 07:53:31 +00:00
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
use OCP\Migration\IRepairStep;
|
|
|
|
|
|
|
|
class MoveAvatars implements IRepairStep {
|
|
|
|
|
2016-09-14 18:15:15 +00:00
|
|
|
/** @var IJobList */
|
|
|
|
private $jobList;
|
2016-09-12 07:53:31 +00:00
|
|
|
|
|
|
|
/** @var SystemConfig */
|
|
|
|
private $systemConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MoveAvatars constructor.
|
|
|
|
*
|
2016-09-14 18:15:15 +00:00
|
|
|
* @param IJobList $jobList
|
2016-09-12 07:53:31 +00:00
|
|
|
* @param SystemConfig $systemConfig
|
|
|
|
*/
|
2016-09-14 18:15:15 +00:00
|
|
|
public function __construct(IJobList $jobList,
|
2016-09-12 07:53:31 +00:00
|
|
|
SystemConfig $systemConfig) {
|
2016-09-14 18:15:15 +00:00
|
|
|
$this->jobList = $jobList;
|
2016-09-12 07:53:31 +00:00
|
|
|
$this->systemConfig = $systemConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName() {
|
2016-09-14 18:15:15 +00:00
|
|
|
return 'Add mover avatar background job';
|
2016-09-12 07:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function run(IOutput $output) {
|
|
|
|
if ($this->systemConfig->getValue('enable_avatars', true) === false) {
|
|
|
|
$output->info('Avatars are disabled');
|
|
|
|
} else {
|
2016-09-14 18:15:15 +00:00
|
|
|
$this->jobList->add(MoveAvatarsBackgroundJob::class);
|
2016-09-12 07:53:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|