|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors |
| 5 | + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |
| 6 | + * SPDX-License-Identifier: AGPL-3.0-only |
| 7 | + */ |
| 8 | +namespace OC\Core\AppInfo; |
| 9 | + |
| 10 | +use OC\Authentication\Events\RemoteWipeFinished; |
| 11 | +use OC\Authentication\Events\RemoteWipeStarted; |
| 12 | +use OC\Authentication\Listeners\RemoteWipeActivityListener; |
| 13 | +use OC\Authentication\Listeners\RemoteWipeEmailListener; |
| 14 | +use OC\Authentication\Listeners\RemoteWipeNotificationsListener; |
| 15 | +use OC\Authentication\Listeners\UserDeletedFilesCleanupListener; |
| 16 | +use OC\Authentication\Listeners\UserDeletedStoreCleanupListener; |
| 17 | +use OC\Authentication\Listeners\UserDeletedTokenCleanupListener; |
| 18 | +use OC\Authentication\Listeners\UserDeletedWebAuthnCleanupListener; |
| 19 | +use OC\Authentication\Notifications\Notifier as AuthenticationNotifier; |
| 20 | +use OC\Core\Listener\AddMissingIndicesListener; |
| 21 | +use OC\Core\Listener\AddMissingPrimaryKeyListener; |
| 22 | +use OC\Core\Listener\BeforeTemplateRenderedListener; |
| 23 | +use OC\Core\Notification\CoreNotifier; |
| 24 | +use OC\TagManager; |
| 25 | +use OCP\AppFramework\App; |
| 26 | +use OCP\AppFramework\Bootstrap\IBootContext; |
| 27 | +use OCP\AppFramework\Bootstrap\IBootstrap; |
| 28 | +use OCP\AppFramework\Bootstrap\IRegistrationContext; |
| 29 | +use OCP\AppFramework\Http\Events\BeforeLoginTemplateRenderedEvent; |
| 30 | +use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; |
| 31 | +use OCP\DB\Events\AddMissingIndicesEvent; |
| 32 | +use OCP\DB\Events\AddMissingPrimaryKeyEvent; |
| 33 | +use OCP\User\Events\BeforeUserDeletedEvent; |
| 34 | +use OCP\User\Events\UserDeletedEvent; |
| 35 | +use OCP\Util; |
| 36 | + |
| 37 | +/** |
| 38 | + * Class Application |
| 39 | + * |
| 40 | + * @package OC\Core |
| 41 | + */ |
| 42 | +class Application extends App implements IBootstrap { |
| 43 | + |
| 44 | + public const APP_ID = 'core'; |
| 45 | + |
| 46 | + /** |
| 47 | + * Application constructor. |
| 48 | + */ |
| 49 | + public function __construct(array $urlParams = []) { |
| 50 | + parent::__construct(self::APP_ID, $urlParams); |
| 51 | + } |
| 52 | + |
| 53 | + public function register(IRegistrationContext $context): void { |
| 54 | + $context->registerService('defaultMailAddress', function () { |
| 55 | + return Util::getDefaultEmailAddress('lostpassword-noreply'); |
| 56 | + }); |
| 57 | + |
| 58 | + // register notifier |
| 59 | + $context->registerNotifierService(CoreNotifier::class); |
| 60 | + $context->registerNotifierService(AuthenticationNotifier::class); |
| 61 | + |
| 62 | + // register event listeners |
| 63 | + $context->registerEventListener(AddMissingIndicesEvent::class, AddMissingIndicesListener::class); |
| 64 | + $context->registerEventListener(AddMissingPrimaryKeyEvent::class, AddMissingPrimaryKeyListener::class); |
| 65 | + $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
| 66 | + $context->registerEventListener(BeforeLoginTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
| 67 | + $context->registerEventListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
| 68 | + $context->registerEventListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
| 69 | + $context->registerEventListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
| 70 | + $context->registerEventListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
| 71 | + $context->registerEventListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
| 72 | + $context->registerEventListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
| 73 | + $context->registerEventListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
| 74 | + $context->registerEventListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
| 75 | + $context->registerEventListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
| 76 | + $context->registerEventListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
| 77 | + $context->registerEventListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class); |
| 78 | + |
| 79 | + // Tags |
| 80 | + $context->registerEventListener(UserDeletedEvent::class, TagManager::class); |
| 81 | + } |
| 82 | + |
| 83 | + public function boot(IBootContext $context): void { |
| 84 | + // ... |
| 85 | + } |
| 86 | + |
| 87 | +} |
0 commit comments