@@ -40,169 +40,169 @@ |
||
| 40 | 40 | * @deprecated 20.0.0 use \OCP\EventDispatcher\IEventDispatcher |
| 41 | 41 | */ |
| 42 | 42 | class SymfonyAdapter implements EventDispatcherInterface { |
| 43 | - /** @var EventDispatcher */ |
|
| 44 | - private $eventDispatcher; |
|
| 45 | - private LoggerInterface $logger; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @deprecated 20.0.0 |
|
| 49 | - */ |
|
| 50 | - public function __construct(EventDispatcher $eventDispatcher, LoggerInterface $logger) { |
|
| 51 | - $this->eventDispatcher = $eventDispatcher; |
|
| 52 | - $this->logger = $logger; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - private static function detectEventAndName($a, $b) { |
|
| 56 | - if (is_object($a) && (is_string($b) || $b === null)) { |
|
| 57 | - // a is the event, the other one is the optional name |
|
| 58 | - return [$a, $b]; |
|
| 59 | - } |
|
| 60 | - if (is_object($b) && (is_string($a) || $a === null)) { |
|
| 61 | - // b is the event, the other one is the optional name |
|
| 62 | - return [$b, $a]; |
|
| 63 | - } |
|
| 64 | - if (is_string($a) && $b === null) { |
|
| 65 | - // a is a payload-less event |
|
| 66 | - return [null, $a]; |
|
| 67 | - } |
|
| 68 | - if (is_string($b) && $a === null) { |
|
| 69 | - // b is a payload-less event |
|
| 70 | - return [null, $b]; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // Anything else we can't detect |
|
| 74 | - return [$a, $b]; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Dispatches an event to all registered listeners. |
|
| 79 | - * |
|
| 80 | - * @param string $eventName The name of the event to dispatch. The name of |
|
| 81 | - * the event is the name of the method that is |
|
| 82 | - * invoked on listeners. |
|
| 83 | - * @param Event|null $event The event to pass to the event handlers/listeners |
|
| 84 | - * If not supplied, an empty Event instance is created |
|
| 85 | - * |
|
| 86 | - * @return object the emitted event |
|
| 87 | - * @deprecated 20.0.0 |
|
| 88 | - */ |
|
| 89 | - public function dispatch($eventName, $event = null): object { |
|
| 90 | - [$event, $eventName] = self::detectEventAndName($event, $eventName); |
|
| 91 | - |
|
| 92 | - // type hinting is not possible, due to usage of GenericEvent |
|
| 93 | - if ($event instanceof Event && $eventName === null) { |
|
| 94 | - $this->eventDispatcher->dispatchTyped($event); |
|
| 95 | - return $event; |
|
| 96 | - } |
|
| 97 | - if ($event instanceof Event) { |
|
| 98 | - $this->eventDispatcher->dispatch($eventName, $event); |
|
| 99 | - return $event; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ($event instanceof GenericEvent && get_class($event) === GenericEvent::class) { |
|
| 103 | - $newEvent = new GenericEventWrapper($this->logger, $eventName, $event); |
|
| 104 | - } else { |
|
| 105 | - $newEvent = $event; |
|
| 106 | - |
|
| 107 | - // Legacy event |
|
| 108 | - $this->logger->debug( |
|
| 109 | - 'Deprecated event type for {name}: {class}', |
|
| 110 | - ['name' => $eventName, 'class' => is_object($event) ? get_class($event) : 'null'] |
|
| 111 | - ); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - // Event with no payload (object) need special handling |
|
| 115 | - if ($newEvent === null) { |
|
| 116 | - $newEvent = new Event(); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - // Flip the argument order for Symfony to prevent a trigger_error |
|
| 120 | - return $this->eventDispatcher->getSymfonyDispatcher()->dispatch($newEvent, $eventName); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Adds an event listener that listens on the specified events. |
|
| 125 | - * |
|
| 126 | - * @param string $eventName The event to listen on |
|
| 127 | - * @param callable $listener The listener |
|
| 128 | - * @param int $priority The higher this value, the earlier an event |
|
| 129 | - * listener will be triggered in the chain (defaults to 0) |
|
| 130 | - * @deprecated 20.0.0 |
|
| 131 | - */ |
|
| 132 | - public function addListener($eventName, $listener, $priority = 0) { |
|
| 133 | - if (is_callable($listener)) { |
|
| 134 | - $this->eventDispatcher->addListener($eventName, $listener, $priority); |
|
| 135 | - } else { |
|
| 136 | - // Legacy listener |
|
| 137 | - $this->eventDispatcher->getSymfonyDispatcher()->addListener($eventName, $listener, $priority); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Adds an event subscriber. |
|
| 143 | - * |
|
| 144 | - * The subscriber is asked for all the events it is |
|
| 145 | - * interested in and added as a listener for these events. |
|
| 146 | - * @deprecated 20.0.0 |
|
| 147 | - */ |
|
| 148 | - public function addSubscriber(EventSubscriberInterface $subscriber) { |
|
| 149 | - $this->eventDispatcher->getSymfonyDispatcher()->addSubscriber($subscriber); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Removes an event listener from the specified events. |
|
| 154 | - * |
|
| 155 | - * @param string $eventName The event to remove a listener from |
|
| 156 | - * @param callable $listener The listener to remove |
|
| 157 | - * @deprecated 20.0.0 |
|
| 158 | - */ |
|
| 159 | - public function removeListener($eventName, $listener) { |
|
| 160 | - $this->eventDispatcher->getSymfonyDispatcher()->removeListener($eventName, $listener); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @deprecated 20.0.0 |
|
| 165 | - */ |
|
| 166 | - public function removeSubscriber(EventSubscriberInterface $subscriber) { |
|
| 167 | - $this->eventDispatcher->getSymfonyDispatcher()->removeSubscriber($subscriber); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Gets the listeners of a specific event or all listeners sorted by descending priority. |
|
| 172 | - * |
|
| 173 | - * @param string|null $eventName The name of the event |
|
| 174 | - * |
|
| 175 | - * @return array The event listeners for the specified event, or all event listeners by event name |
|
| 176 | - * @deprecated 20.0.0 |
|
| 177 | - */ |
|
| 178 | - public function getListeners($eventName = null) { |
|
| 179 | - return $this->eventDispatcher->getSymfonyDispatcher()->getListeners($eventName); |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * Gets the listener priority for a specific event. |
|
| 184 | - * |
|
| 185 | - * Returns null if the event or the listener does not exist. |
|
| 186 | - * |
|
| 187 | - * @param string $eventName The name of the event |
|
| 188 | - * @param callable $listener The listener |
|
| 189 | - * |
|
| 190 | - * @return int|null The event listener priority |
|
| 191 | - * @deprecated 20.0.0 |
|
| 192 | - */ |
|
| 193 | - public function getListenerPriority($eventName, $listener) { |
|
| 194 | - return $this->eventDispatcher->getSymfonyDispatcher()->getListenerPriority($eventName, $listener); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Checks whether an event has any registered listeners. |
|
| 199 | - * |
|
| 200 | - * @param string|null $eventName The name of the event |
|
| 201 | - * |
|
| 202 | - * @return bool true if the specified event has any listeners, false otherwise |
|
| 203 | - * @deprecated 20.0.0 |
|
| 204 | - */ |
|
| 205 | - public function hasListeners($eventName = null) { |
|
| 206 | - return $this->eventDispatcher->getSymfonyDispatcher()->hasListeners($eventName); |
|
| 207 | - } |
|
| 43 | + /** @var EventDispatcher */ |
|
| 44 | + private $eventDispatcher; |
|
| 45 | + private LoggerInterface $logger; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @deprecated 20.0.0 |
|
| 49 | + */ |
|
| 50 | + public function __construct(EventDispatcher $eventDispatcher, LoggerInterface $logger) { |
|
| 51 | + $this->eventDispatcher = $eventDispatcher; |
|
| 52 | + $this->logger = $logger; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + private static function detectEventAndName($a, $b) { |
|
| 56 | + if (is_object($a) && (is_string($b) || $b === null)) { |
|
| 57 | + // a is the event, the other one is the optional name |
|
| 58 | + return [$a, $b]; |
|
| 59 | + } |
|
| 60 | + if (is_object($b) && (is_string($a) || $a === null)) { |
|
| 61 | + // b is the event, the other one is the optional name |
|
| 62 | + return [$b, $a]; |
|
| 63 | + } |
|
| 64 | + if (is_string($a) && $b === null) { |
|
| 65 | + // a is a payload-less event |
|
| 66 | + return [null, $a]; |
|
| 67 | + } |
|
| 68 | + if (is_string($b) && $a === null) { |
|
| 69 | + // b is a payload-less event |
|
| 70 | + return [null, $b]; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // Anything else we can't detect |
|
| 74 | + return [$a, $b]; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Dispatches an event to all registered listeners. |
|
| 79 | + * |
|
| 80 | + * @param string $eventName The name of the event to dispatch. The name of |
|
| 81 | + * the event is the name of the method that is |
|
| 82 | + * invoked on listeners. |
|
| 83 | + * @param Event|null $event The event to pass to the event handlers/listeners |
|
| 84 | + * If not supplied, an empty Event instance is created |
|
| 85 | + * |
|
| 86 | + * @return object the emitted event |
|
| 87 | + * @deprecated 20.0.0 |
|
| 88 | + */ |
|
| 89 | + public function dispatch($eventName, $event = null): object { |
|
| 90 | + [$event, $eventName] = self::detectEventAndName($event, $eventName); |
|
| 91 | + |
|
| 92 | + // type hinting is not possible, due to usage of GenericEvent |
|
| 93 | + if ($event instanceof Event && $eventName === null) { |
|
| 94 | + $this->eventDispatcher->dispatchTyped($event); |
|
| 95 | + return $event; |
|
| 96 | + } |
|
| 97 | + if ($event instanceof Event) { |
|
| 98 | + $this->eventDispatcher->dispatch($eventName, $event); |
|
| 99 | + return $event; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ($event instanceof GenericEvent && get_class($event) === GenericEvent::class) { |
|
| 103 | + $newEvent = new GenericEventWrapper($this->logger, $eventName, $event); |
|
| 104 | + } else { |
|
| 105 | + $newEvent = $event; |
|
| 106 | + |
|
| 107 | + // Legacy event |
|
| 108 | + $this->logger->debug( |
|
| 109 | + 'Deprecated event type for {name}: {class}', |
|
| 110 | + ['name' => $eventName, 'class' => is_object($event) ? get_class($event) : 'null'] |
|
| 111 | + ); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + // Event with no payload (object) need special handling |
|
| 115 | + if ($newEvent === null) { |
|
| 116 | + $newEvent = new Event(); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + // Flip the argument order for Symfony to prevent a trigger_error |
|
| 120 | + return $this->eventDispatcher->getSymfonyDispatcher()->dispatch($newEvent, $eventName); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Adds an event listener that listens on the specified events. |
|
| 125 | + * |
|
| 126 | + * @param string $eventName The event to listen on |
|
| 127 | + * @param callable $listener The listener |
|
| 128 | + * @param int $priority The higher this value, the earlier an event |
|
| 129 | + * listener will be triggered in the chain (defaults to 0) |
|
| 130 | + * @deprecated 20.0.0 |
|
| 131 | + */ |
|
| 132 | + public function addListener($eventName, $listener, $priority = 0) { |
|
| 133 | + if (is_callable($listener)) { |
|
| 134 | + $this->eventDispatcher->addListener($eventName, $listener, $priority); |
|
| 135 | + } else { |
|
| 136 | + // Legacy listener |
|
| 137 | + $this->eventDispatcher->getSymfonyDispatcher()->addListener($eventName, $listener, $priority); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Adds an event subscriber. |
|
| 143 | + * |
|
| 144 | + * The subscriber is asked for all the events it is |
|
| 145 | + * interested in and added as a listener for these events. |
|
| 146 | + * @deprecated 20.0.0 |
|
| 147 | + */ |
|
| 148 | + public function addSubscriber(EventSubscriberInterface $subscriber) { |
|
| 149 | + $this->eventDispatcher->getSymfonyDispatcher()->addSubscriber($subscriber); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Removes an event listener from the specified events. |
|
| 154 | + * |
|
| 155 | + * @param string $eventName The event to remove a listener from |
|
| 156 | + * @param callable $listener The listener to remove |
|
| 157 | + * @deprecated 20.0.0 |
|
| 158 | + */ |
|
| 159 | + public function removeListener($eventName, $listener) { |
|
| 160 | + $this->eventDispatcher->getSymfonyDispatcher()->removeListener($eventName, $listener); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @deprecated 20.0.0 |
|
| 165 | + */ |
|
| 166 | + public function removeSubscriber(EventSubscriberInterface $subscriber) { |
|
| 167 | + $this->eventDispatcher->getSymfonyDispatcher()->removeSubscriber($subscriber); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Gets the listeners of a specific event or all listeners sorted by descending priority. |
|
| 172 | + * |
|
| 173 | + * @param string|null $eventName The name of the event |
|
| 174 | + * |
|
| 175 | + * @return array The event listeners for the specified event, or all event listeners by event name |
|
| 176 | + * @deprecated 20.0.0 |
|
| 177 | + */ |
|
| 178 | + public function getListeners($eventName = null) { |
|
| 179 | + return $this->eventDispatcher->getSymfonyDispatcher()->getListeners($eventName); |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * Gets the listener priority for a specific event. |
|
| 184 | + * |
|
| 185 | + * Returns null if the event or the listener does not exist. |
|
| 186 | + * |
|
| 187 | + * @param string $eventName The name of the event |
|
| 188 | + * @param callable $listener The listener |
|
| 189 | + * |
|
| 190 | + * @return int|null The event listener priority |
|
| 191 | + * @deprecated 20.0.0 |
|
| 192 | + */ |
|
| 193 | + public function getListenerPriority($eventName, $listener) { |
|
| 194 | + return $this->eventDispatcher->getSymfonyDispatcher()->getListenerPriority($eventName, $listener); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Checks whether an event has any registered listeners. |
|
| 199 | + * |
|
| 200 | + * @param string|null $eventName The name of the event |
|
| 201 | + * |
|
| 202 | + * @return bool true if the specified event has any listeners, false otherwise |
|
| 203 | + * @deprecated 20.0.0 |
|
| 204 | + */ |
|
| 205 | + public function hasListeners($eventName = null) { |
|
| 206 | + return $this->eventDispatcher->getSymfonyDispatcher()->hasListeners($eventName); |
|
| 207 | + } |
|
| 208 | 208 | } |
@@ -40,31 +40,31 @@ |
||
| 40 | 40 | use Symfony\Component\EventDispatcher\GenericEvent; |
| 41 | 41 | |
| 42 | 42 | class Application extends App implements IBootstrap { |
| 43 | - public const APP_ID = 'lookup_server_connector'; |
|
| 43 | + public const APP_ID = 'lookup_server_connector'; |
|
| 44 | 44 | |
| 45 | - public function __construct() { |
|
| 46 | - parent::__construct(self::APP_ID); |
|
| 47 | - } |
|
| 45 | + public function __construct() { |
|
| 46 | + parent::__construct(self::APP_ID); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function register(IRegistrationContext $context): void { |
|
| 50 | - } |
|
| 49 | + public function register(IRegistrationContext $context): void { |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function boot(IBootContext $context): void { |
|
| 53 | - $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
| 54 | - } |
|
| 52 | + public function boot(IBootContext $context): void { |
|
| 53 | + $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @todo move the OCP events and then move the registration to `register` |
|
| 58 | - */ |
|
| 59 | - private function registerEventListeners(EventDispatcherInterface $dispatcher, |
|
| 60 | - ContainerInterface $appContainer): void { |
|
| 61 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 62 | - /** @var IUser $user */ |
|
| 63 | - $user = $event->getSubject(); |
|
| 56 | + /** |
|
| 57 | + * @todo move the OCP events and then move the registration to `register` |
|
| 58 | + */ |
|
| 59 | + private function registerEventListeners(EventDispatcherInterface $dispatcher, |
|
| 60 | + ContainerInterface $appContainer): void { |
|
| 61 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 62 | + /** @var IUser $user */ |
|
| 63 | + $user = $event->getSubject(); |
|
| 64 | 64 | |
| 65 | - /** @var UpdateLookupServer $updateLookupServer */ |
|
| 66 | - $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
| 67 | - $updateLookupServer->userUpdated($user); |
|
| 68 | - }); |
|
| 69 | - } |
|
| 65 | + /** @var UpdateLookupServer $updateLookupServer */ |
|
| 66 | + $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
| 67 | + $updateLookupServer->userUpdated($user); |
|
| 68 | + }); |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | private function registerEventListeners(EventDispatcherInterface $dispatcher, |
| 60 | 60 | ContainerInterface $appContainer): void { |
| 61 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 61 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) use ($appContainer) { |
|
| 62 | 62 | /** @var IUser $user */ |
| 63 | 63 | $user = $event->getSubject(); |
| 64 | 64 | |
@@ -36,56 +36,56 @@ |
||
| 36 | 36 | use OCP\SystemTag\MapperEvent; |
| 37 | 37 | |
| 38 | 38 | class Application extends App implements IBootstrap { |
| 39 | - public const APP_ID = 'systemtags'; |
|
| 39 | + public const APP_ID = 'systemtags'; |
|
| 40 | 40 | |
| 41 | - public function __construct() { |
|
| 42 | - parent::__construct(self::APP_ID); |
|
| 43 | - } |
|
| 41 | + public function __construct() { |
|
| 42 | + parent::__construct(self::APP_ID); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function register(IRegistrationContext $context): void { |
|
| 46 | - $context->registerSearchProvider(TagSearchProvider::class); |
|
| 47 | - } |
|
| 45 | + public function register(IRegistrationContext $context): void { |
|
| 46 | + $context->registerSearchProvider(TagSearchProvider::class); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function boot(IBootContext $context): void { |
|
| 50 | - $context->injectFn(function (IEventDispatcher $dispatcher) use ($context) { |
|
| 51 | - /* |
|
| 49 | + public function boot(IBootContext $context): void { |
|
| 50 | + $context->injectFn(function (IEventDispatcher $dispatcher) use ($context) { |
|
| 51 | + /* |
|
| 52 | 52 | * @todo move the OCP events and then move the registration to `register` |
| 53 | 53 | */ |
| 54 | - $dispatcher->addListener( |
|
| 55 | - 'OCA\Files::loadAdditionalScripts', |
|
| 56 | - function () { |
|
| 57 | - \OCP\Util::addScript('core', 'systemtags'); |
|
| 58 | - \OCP\Util::addScript(self::APP_ID, 'systemtags'); |
|
| 59 | - } |
|
| 60 | - ); |
|
| 54 | + $dispatcher->addListener( |
|
| 55 | + 'OCA\Files::loadAdditionalScripts', |
|
| 56 | + function () { |
|
| 57 | + \OCP\Util::addScript('core', 'systemtags'); |
|
| 58 | + \OCP\Util::addScript(self::APP_ID, 'systemtags'); |
|
| 59 | + } |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - $managerListener = function (ManagerEvent $event) use ($context) { |
|
| 63 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 64 | - $listener = $context->getServerContainer()->query(Listener::class); |
|
| 65 | - $listener->event($event); |
|
| 66 | - }; |
|
| 67 | - $dispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
|
| 68 | - $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
|
| 69 | - $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
|
| 62 | + $managerListener = function (ManagerEvent $event) use ($context) { |
|
| 63 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 64 | + $listener = $context->getServerContainer()->query(Listener::class); |
|
| 65 | + $listener->event($event); |
|
| 66 | + }; |
|
| 67 | + $dispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
|
| 68 | + $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
|
| 69 | + $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
|
| 70 | 70 | |
| 71 | - $mapperListener = function (MapperEvent $event) use ($context) { |
|
| 72 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 73 | - $listener = $context->getServerContainer()->query(Listener::class); |
|
| 74 | - $listener->mapperEvent($event); |
|
| 75 | - }; |
|
| 76 | - $dispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
|
| 77 | - $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
|
| 78 | - }); |
|
| 71 | + $mapperListener = function (MapperEvent $event) use ($context) { |
|
| 72 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 73 | + $listener = $context->getServerContainer()->query(Listener::class); |
|
| 74 | + $listener->mapperEvent($event); |
|
| 75 | + }; |
|
| 76 | + $dispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
|
| 77 | + $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
|
| 78 | + }); |
|
| 79 | 79 | |
| 80 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 81 | - $l = \OC::$server->getL10N(self::APP_ID); |
|
| 82 | - return [ |
|
| 83 | - 'id' => 'systemtagsfilter', |
|
| 84 | - 'appname' => self::APP_ID, |
|
| 85 | - 'script' => 'list.php', |
|
| 86 | - 'order' => 25, |
|
| 87 | - 'name' => $l->t('Tags'), |
|
| 88 | - ]; |
|
| 89 | - }); |
|
| 90 | - } |
|
| 80 | + \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 81 | + $l = \OC::$server->getL10N(self::APP_ID); |
|
| 82 | + return [ |
|
| 83 | + 'id' => 'systemtagsfilter', |
|
| 84 | + 'appname' => self::APP_ID, |
|
| 85 | + 'script' => 'list.php', |
|
| 86 | + 'order' => 25, |
|
| 87 | + 'name' => $l->t('Tags'), |
|
| 88 | + ]; |
|
| 89 | + }); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -47,19 +47,19 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function boot(IBootContext $context): void { |
| 50 | - $context->injectFn(function (IEventDispatcher $dispatcher) use ($context) { |
|
| 50 | + $context->injectFn(function(IEventDispatcher $dispatcher) use ($context) { |
|
| 51 | 51 | /* |
| 52 | 52 | * @todo move the OCP events and then move the registration to `register` |
| 53 | 53 | */ |
| 54 | 54 | $dispatcher->addListener( |
| 55 | 55 | 'OCA\Files::loadAdditionalScripts', |
| 56 | - function () { |
|
| 56 | + function() { |
|
| 57 | 57 | \OCP\Util::addScript('core', 'systemtags'); |
| 58 | 58 | \OCP\Util::addScript(self::APP_ID, 'systemtags'); |
| 59 | 59 | } |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - $managerListener = function (ManagerEvent $event) use ($context) { |
|
| 62 | + $managerListener = function(ManagerEvent $event) use ($context) { |
|
| 63 | 63 | /** @var \OCA\SystemTags\Activity\Listener $listener */ |
| 64 | 64 | $listener = $context->getServerContainer()->query(Listener::class); |
| 65 | 65 | $listener->event($event); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); |
| 69 | 69 | $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
| 70 | 70 | |
| 71 | - $mapperListener = function (MapperEvent $event) use ($context) { |
|
| 71 | + $mapperListener = function(MapperEvent $event) use ($context) { |
|
| 72 | 72 | /** @var \OCA\SystemTags\Activity\Listener $listener */ |
| 73 | 73 | $listener = $context->getServerContainer()->query(Listener::class); |
| 74 | 74 | $listener->mapperEvent($event); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 80 | + \OCA\Files\App::getNavigationManager()->add(function() { |
|
| 81 | 81 | $l = \OC::$server->getL10N(self::APP_ID); |
| 82 | 82 | return [ |
| 83 | 83 | 'id' => 'systemtagsfilter', |