use OCP\Share\Events\ShareCreatedEvent;
use OCP\Util;
use Psr\Container\ContainerInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App {
/** @var IEventDispatcher $dispatcher */
$dispatcher = $container->query(IEventDispatcher::class);
+ $oldDispatcher = $container->getServer()->getEventDispatcher();
$mountProviderCollection = $server->getMountProviderCollection();
$notifications = $server->getNotificationManager();
$notifications->registerNotifierService(Notifier::class);
$this->registerMountProviders($mountProviderCollection);
- $this->registerEventsScripts($dispatcher);
+ $this->registerEventsScripts($dispatcher, $oldDispatcher);
$this->setupSharingMenus();
/**
$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
}
- protected function registerEventsScripts(IEventDispatcher $dispatcher) {
+ protected function registerEventsScripts(IEventDispatcher $dispatcher, EventDispatcherInterface $oldDispatcher) {
// sidebar and files scripts
$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
$dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class);
$dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
// notifications api to accept incoming user shares
- $dispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) {
+ $oldDispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) {
/** @var Listener $listener */
$listener = $this->getContainer()->query(Listener::class);
$listener->shareNotification($event);
});
- $dispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) {
+ $oldDispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) {
/** @var Listener $listener */
$listener = $this->getContainer()->query(Listener::class);
$listener->userAddedToGroup($event);
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\AppFramework\IAppContainer;
use OCP\IUser;
+use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App implements IBootstrap {
/**
* @todo move the OCP events and then move the registration to `register`
*/
- private function registerEventListeners(IEventDispatcher $dispatcher,
+ private function registerEventListeners(EventDispatcher $dispatcher,
IAppContainer $appContainer): void {
$dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) {
/** @var IUser $user */
$notificationManager->registerNotifierService(RemoveLinkSharesNotifier::class);
$notificationManager->registerNotifierService(AuthenticationNotifier::class);
- $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,
+ $oldEventDispatcher = $server->getEventDispatcher();
+
+ $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,
function (GenericEvent $event) use ($container) {
/** @var MissingIndexInformation $subject */
$subject = $event->getSubject();
}
);
- $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT,
+ $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT,
function (GenericEvent $event) use ($container) {
/** @var MissingColumnInformation $subject */
$subject = $event->getSubject();