2019-05-23 12:10:48 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
|
|
|
|
*
|
|
|
|
* @author Georg Ehrke <oc.list@georgehrke.com>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2019-05-23 12:10:48 +03:00
|
|
|
*
|
|
|
|
* @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
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2019-05-23 12:10:48 +03:00
|
|
|
*
|
|
|
|
*/
|
2019-11-22 22:52:10 +03:00
|
|
|
|
2019-05-23 12:10:48 +03:00
|
|
|
namespace OCA\DAV\BackgroundJob;
|
|
|
|
|
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
|
|
|
use OCP\BackgroundJob\IJobList;
|
|
|
|
use OCP\BackgroundJob\QueuedJob;
|
|
|
|
use OCP\IUser;
|
|
|
|
use OCP\IUserManager;
|
|
|
|
|
|
|
|
class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|
|
|
|
|
|
|
/** @var IUserManager */
|
|
|
|
private $userManager;
|
|
|
|
|
|
|
|
/** @var IJobList */
|
|
|
|
private $jobList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RegisterRegenerateBirthdayCalendars constructor.
|
|
|
|
*
|
|
|
|
* @param ITimeFactory $time
|
|
|
|
* @param IUserManager $userManager
|
|
|
|
* @param IJobList $jobList
|
|
|
|
*/
|
|
|
|
public function __construct(ITimeFactory $time,
|
|
|
|
IUserManager $userManager,
|
|
|
|
IJobList $jobList) {
|
|
|
|
parent::__construct($time);
|
|
|
|
$this->userManager = $userManager;
|
|
|
|
$this->jobList = $jobList;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function run($argument) {
|
2020-04-09 14:53:40 +03:00
|
|
|
$this->userManager->callForSeenUsers(function (IUser $user) {
|
2019-05-23 12:10:48 +03:00
|
|
|
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
|
|
|
'userId' => $user->getUID(),
|
|
|
|
'purgeBeforeGenerating' => true
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
}
|
2019-11-22 22:52:10 +03:00
|
|
|
}
|