diff options
Diffstat (limited to 'apps/dav/lib/Controller/BirthdayCalendarController.php')
-rw-r--r-- | apps/dav/lib/Controller/BirthdayCalendarController.php | 77 |
1 files changed, 18 insertions, 59 deletions
diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index 4305d6daaef..f6bfb229a9c 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -1,31 +1,16 @@ <?php + /** - * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Georg Ehrke <oc.list@georgehrke.com> - * - * @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/>. - * + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\DAV\Controller; use OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob; use OCA\DAV\CalDAV\CalDavBackend; +use OCA\DAV\Settings\CalDAVSettings; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\AuthorizedAdminSetting; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; use OCP\BackgroundJob\IJobList; @@ -38,31 +23,6 @@ use OCP\IUserManager; class BirthdayCalendarController extends Controller { /** - * @var IDBConnection - */ - protected $db; - - /** - * @var IConfig - */ - protected $config; - - /** - * @var IUserManager - */ - protected $userManager; - - /** - * @var CalDavBackend - */ - protected $caldavBackend; - - /** - * @var IJobList - */ - protected $jobList; - - /** * BirthdayCalendar constructor. * * @param string $appName @@ -71,30 +31,29 @@ class BirthdayCalendarController extends Controller { * @param IConfig $config * @param IJobList $jobList * @param IUserManager $userManager - * @param CalDavBackend $calDavBackend + * @param CalDavBackend $caldavBackend */ - public function __construct($appName, IRequest $request, - IDBConnection $db, IConfig $config, - IJobList $jobList, - IUserManager $userManager, - CalDavBackend $calDavBackend) { + public function __construct( + $appName, + IRequest $request, + protected IDBConnection $db, + protected IConfig $config, + protected IJobList $jobList, + protected IUserManager $userManager, + protected CalDavBackend $caldavBackend, + ) { parent::__construct($appName, $request); - $this->db = $db; - $this->config = $config; - $this->userManager = $userManager; - $this->jobList = $jobList; - $this->caldavBackend = $calDavBackend; } /** * @return Response - * @AuthorizedAdminSetting(settings=OCA\DAV\Settings\CalDAVSettings) */ + #[AuthorizedAdminSetting(settings: CalDAVSettings::class)] public function enable() { $this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes'); // add background job for each user - $this->userManager->callForSeenUsers(function (IUser $user) { + $this->userManager->callForSeenUsers(function (IUser $user): void { $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ 'userId' => $user->getUID(), ]); @@ -105,8 +64,8 @@ class BirthdayCalendarController extends Controller { /** * @return Response - * @AuthorizedAdminSetting(settings=OCA\DAV\Settings\CalDAVSettings) */ + #[AuthorizedAdminSetting(settings: CalDAVSettings::class)] public function disable() { $this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'no'); |