@@ -34,62 +34,62 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | interface IEventDispatcher { |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @template T of \OCP\EventDispatcher\Event |
|
| 39 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 40 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 41 | - * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 42 | - * @psalm-param callable(T):void $listener |
|
| 43 | - * @param int $priority |
|
| 44 | - * |
|
| 45 | - * @since 17.0.0 |
|
| 46 | - */ |
|
| 47 | - public function addListener(string $eventName, callable $listener, int $priority = 0): void; |
|
| 37 | + /** |
|
| 38 | + * @template T of \OCP\EventDispatcher\Event |
|
| 39 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 40 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 41 | + * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 42 | + * @psalm-param callable(T):void $listener |
|
| 43 | + * @param int $priority |
|
| 44 | + * |
|
| 45 | + * @since 17.0.0 |
|
| 46 | + */ |
|
| 47 | + public function addListener(string $eventName, callable $listener, int $priority = 0): void; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @template T of \OCP\EventDispatcher\Event |
|
| 51 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 52 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 53 | - * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 54 | - * @psalm-param callable(T):void $listener |
|
| 55 | - * |
|
| 56 | - * @since 19.0.0 |
|
| 57 | - */ |
|
| 58 | - public function removeListener(string $eventName, callable $listener): void; |
|
| 49 | + /** |
|
| 50 | + * @template T of \OCP\EventDispatcher\Event |
|
| 51 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 52 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 53 | + * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 54 | + * @psalm-param callable(T):void $listener |
|
| 55 | + * |
|
| 56 | + * @since 19.0.0 |
|
| 57 | + */ |
|
| 58 | + public function removeListener(string $eventName, callable $listener): void; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @template T of \OCP\EventDispatcher\Event |
|
| 62 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 63 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 64 | - * @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 65 | - * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container |
|
| 66 | - * @param int $priority |
|
| 67 | - * |
|
| 68 | - * @since 17.0.0 |
|
| 69 | - */ |
|
| 70 | - public function addServiceListener(string $eventName, string $className, int $priority = 0): void; |
|
| 60 | + /** |
|
| 61 | + * @template T of \OCP\EventDispatcher\Event |
|
| 62 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 63 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 64 | + * @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 65 | + * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container |
|
| 66 | + * @param int $priority |
|
| 67 | + * |
|
| 68 | + * @since 17.0.0 |
|
| 69 | + */ |
|
| 70 | + public function addServiceListener(string $eventName, string $className, int $priority = 0): void; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @template T of \OCP\EventDispatcher\Event |
|
| 74 | - * @param string $eventName |
|
| 75 | - * @psalm-param string|class-string<T> $eventName |
|
| 76 | - * @param Event $event |
|
| 77 | - * @psalm-param T $event |
|
| 78 | - * |
|
| 79 | - * @since 17.0.0 |
|
| 80 | - * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
| 81 | - */ |
|
| 82 | - public function dispatch(string $eventName, Event $event): void; |
|
| 72 | + /** |
|
| 73 | + * @template T of \OCP\EventDispatcher\Event |
|
| 74 | + * @param string $eventName |
|
| 75 | + * @psalm-param string|class-string<T> $eventName |
|
| 76 | + * @param Event $event |
|
| 77 | + * @psalm-param T $event |
|
| 78 | + * |
|
| 79 | + * @since 17.0.0 |
|
| 80 | + * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
| 81 | + */ |
|
| 82 | + public function dispatch(string $eventName, Event $event): void; |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Dispatch a typed event |
|
| 86 | - * |
|
| 87 | - * Only use this with subclasses of ``\OCP\EventDispatcher\Event``. |
|
| 88 | - * The object's class will determine the event name. |
|
| 89 | - * |
|
| 90 | - * @param Event $event |
|
| 91 | - * |
|
| 92 | - * @since 18.0.0 |
|
| 93 | - */ |
|
| 94 | - public function dispatchTyped(Event $event): void; |
|
| 84 | + /** |
|
| 85 | + * Dispatch a typed event |
|
| 86 | + * |
|
| 87 | + * Only use this with subclasses of ``\OCP\EventDispatcher\Event``. |
|
| 88 | + * The object's class will determine the event name. |
|
| 89 | + * |
|
| 90 | + * @param Event $event |
|
| 91 | + * |
|
| 92 | + * @since 18.0.0 |
|
| 93 | + */ |
|
| 94 | + public function dispatchTyped(Event $event): void; |
|
| 95 | 95 | } |
@@ -41,31 +41,31 @@ |
||
| 41 | 41 | use Symfony\Component\EventDispatcher\GenericEvent; |
| 42 | 42 | |
| 43 | 43 | class Application extends App implements IBootstrap { |
| 44 | - public const APP_ID = 'lookup_server_connector'; |
|
| 44 | + public const APP_ID = 'lookup_server_connector'; |
|
| 45 | 45 | |
| 46 | - public function __construct() { |
|
| 47 | - parent::__construct(self::APP_ID); |
|
| 48 | - } |
|
| 46 | + public function __construct() { |
|
| 47 | + parent::__construct(self::APP_ID); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function register(IRegistrationContext $context): void { |
|
| 51 | - } |
|
| 50 | + public function register(IRegistrationContext $context): void { |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function boot(IBootContext $context): void { |
|
| 54 | - $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
| 55 | - } |
|
| 53 | + public function boot(IBootContext $context): void { |
|
| 54 | + $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @todo move the OCP events and then move the registration to `register` |
|
| 59 | - */ |
|
| 60 | - private function registerEventListeners(EventDispatcher $dispatcher, |
|
| 61 | - IAppContainer $appContainer): void { |
|
| 62 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 63 | - /** @var IUser $user */ |
|
| 64 | - $user = $event->getSubject(); |
|
| 57 | + /** |
|
| 58 | + * @todo move the OCP events and then move the registration to `register` |
|
| 59 | + */ |
|
| 60 | + private function registerEventListeners(EventDispatcher $dispatcher, |
|
| 61 | + IAppContainer $appContainer): void { |
|
| 62 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 63 | + /** @var IUser $user */ |
|
| 64 | + $user = $event->getSubject(); |
|
| 65 | 65 | |
| 66 | - /** @var UpdateLookupServer $updateLookupServer */ |
|
| 67 | - $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
| 68 | - $updateLookupServer->userUpdated($user); |
|
| 69 | - }); |
|
| 70 | - } |
|
| 66 | + /** @var UpdateLookupServer $updateLookupServer */ |
|
| 67 | + $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
| 68 | + $updateLookupServer->userUpdated($user); |
|
| 69 | + }); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | */ |
| 60 | 60 | private function registerEventListeners(EventDispatcher $dispatcher, |
| 61 | 61 | IAppContainer $appContainer): void { |
| 62 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
| 62 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) use ($appContainer) { |
|
| 63 | 63 | /** @var IUser $user */ |
| 64 | 64 | $user = $event->getSubject(); |
| 65 | 65 | |
@@ -63,179 +63,179 @@ |
||
| 63 | 63 | use Symfony\Component\EventDispatcher\GenericEvent; |
| 64 | 64 | |
| 65 | 65 | class Application extends App { |
| 66 | - public const APP_ID = 'files_sharing'; |
|
| 67 | - |
|
| 68 | - public function __construct(array $urlParams = []) { |
|
| 69 | - parent::__construct(self::APP_ID, $urlParams); |
|
| 70 | - |
|
| 71 | - $container = $this->getContainer(); |
|
| 72 | - |
|
| 73 | - /** @var IServerContainer $server */ |
|
| 74 | - $server = $container->getServer(); |
|
| 75 | - |
|
| 76 | - /** @var IEventDispatcher $dispatcher */ |
|
| 77 | - $dispatcher = $container->query(IEventDispatcher::class); |
|
| 78 | - $oldDispatcher = $container->getServer()->getEventDispatcher(); |
|
| 79 | - $mountProviderCollection = $server->getMountProviderCollection(); |
|
| 80 | - $notifications = $server->getNotificationManager(); |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Core class wrappers |
|
| 84 | - */ |
|
| 85 | - $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) { |
|
| 86 | - $user = $server->getUserSession()->getUser(); |
|
| 87 | - $uid = $user ? $user->getUID() : null; |
|
| 88 | - return new \OCA\Files_Sharing\External\Manager( |
|
| 89 | - $server->getDatabaseConnection(), |
|
| 90 | - \OC\Files\Filesystem::getMountManager(), |
|
| 91 | - \OC\Files\Filesystem::getLoader(), |
|
| 92 | - $server->getHTTPClientService(), |
|
| 93 | - $server->getNotificationManager(), |
|
| 94 | - $server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 95 | - $server->getCloudFederationProviderManager(), |
|
| 96 | - $server->getCloudFederationFactory(), |
|
| 97 | - $server->getGroupManager(), |
|
| 98 | - $server->getUserManager(), |
|
| 99 | - $uid, |
|
| 100 | - $server->query(IEventDispatcher::class) |
|
| 101 | - ); |
|
| 102 | - }); |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Middleware |
|
| 106 | - */ |
|
| 107 | - $container->registerMiddleWare(SharingCheckMiddleware::class); |
|
| 108 | - $container->registerMiddleWare(OCSShareAPIMiddleware::class); |
|
| 109 | - $container->registerMiddleWare(ShareInfoMiddleware::class); |
|
| 110 | - |
|
| 111 | - $container->registerService('ExternalMountProvider', function (ContainerInterface $c) { |
|
| 112 | - return new \OCA\Files_Sharing\External\MountProvider( |
|
| 113 | - $c->get(IDBConnection::class), |
|
| 114 | - function () use ($c) { |
|
| 115 | - return $c->get(Manager::class); |
|
| 116 | - }, |
|
| 117 | - $c->get(ICloudIdManager::class) |
|
| 118 | - ); |
|
| 119 | - }); |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Register capabilities |
|
| 123 | - */ |
|
| 124 | - $container->registerCapability(Capabilities::class); |
|
| 125 | - |
|
| 126 | - $notifications->registerNotifierService(Notifier::class); |
|
| 127 | - |
|
| 128 | - $this->registerMountProviders($mountProviderCollection); |
|
| 129 | - $this->registerEventsScripts($dispatcher, $oldDispatcher); |
|
| 130 | - $this->setupSharingMenus(); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Always add main sharing script |
|
| 134 | - */ |
|
| 135 | - Util::addScript(self::APP_ID, 'dist/main'); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) { |
|
| 139 | - $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class)); |
|
| 140 | - $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider')); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - protected function registerEventsScripts(IEventDispatcher $dispatcher, EventDispatcherInterface $oldDispatcher) { |
|
| 144 | - // sidebar and files scripts |
|
| 145 | - $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class); |
|
| 146 | - $dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class); |
|
| 147 | - $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class); |
|
| 148 | - $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class); |
|
| 149 | - $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () { |
|
| 150 | - \OCP\Util::addScript('files_sharing', 'dist/collaboration'); |
|
| 151 | - }); |
|
| 152 | - $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class); |
|
| 153 | - $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class); |
|
| 154 | - |
|
| 155 | - // notifications api to accept incoming user shares |
|
| 156 | - $oldDispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) { |
|
| 157 | - /** @var Listener $listener */ |
|
| 158 | - $listener = $this->getContainer()->query(Listener::class); |
|
| 159 | - $listener->shareNotification($event); |
|
| 160 | - }); |
|
| 161 | - $oldDispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) { |
|
| 162 | - /** @var Listener $listener */ |
|
| 163 | - $listener = $this->getContainer()->query(Listener::class); |
|
| 164 | - $listener->userAddedToGroup($event); |
|
| 165 | - }); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - protected function setupSharingMenus() { |
|
| 169 | - $config = \OC::$server->getConfig(); |
|
| 170 | - |
|
| 171 | - if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
| 172 | - return; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - // show_Quick_Access stored as string |
|
| 176 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 177 | - $config = \OC::$server->getConfig(); |
|
| 178 | - $l = \OC::$server->getL10N('files_sharing'); |
|
| 179 | - |
|
| 180 | - $sharingSublistArray = []; |
|
| 181 | - |
|
| 182 | - if (\OCP\Util::isSharingDisabledForUser() === false) { |
|
| 183 | - $sharingSublistArray[] = [ |
|
| 184 | - 'id' => 'sharingout', |
|
| 185 | - 'appname' => 'files_sharing', |
|
| 186 | - 'script' => 'list.php', |
|
| 187 | - 'order' => 16, |
|
| 188 | - 'name' => $l->t('Shared with others'), |
|
| 189 | - ]; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - $sharingSublistArray[] = [ |
|
| 193 | - 'id' => 'sharingin', |
|
| 194 | - 'appname' => 'files_sharing', |
|
| 195 | - 'script' => 'list.php', |
|
| 196 | - 'order' => 15, |
|
| 197 | - 'name' => $l->t('Shared with you'), |
|
| 198 | - ]; |
|
| 199 | - |
|
| 200 | - if (\OCP\Util::isSharingDisabledForUser() === false) { |
|
| 201 | - // Check if sharing by link is enabled |
|
| 202 | - if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') { |
|
| 203 | - $sharingSublistArray[] = [ |
|
| 204 | - 'id' => 'sharinglinks', |
|
| 205 | - 'appname' => 'files_sharing', |
|
| 206 | - 'script' => 'list.php', |
|
| 207 | - 'order' => 17, |
|
| 208 | - 'name' => $l->t('Shared by link'), |
|
| 209 | - ]; |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - $sharingSublistArray[] = [ |
|
| 214 | - 'id' => 'deletedshares', |
|
| 215 | - 'appname' => 'files_sharing', |
|
| 216 | - 'script' => 'list.php', |
|
| 217 | - 'order' => 19, |
|
| 218 | - 'name' => $l->t('Deleted shares'), |
|
| 219 | - ]; |
|
| 220 | - |
|
| 221 | - $sharingSublistArray[] = [ |
|
| 222 | - 'id' => 'pendingshares', |
|
| 223 | - 'appname' => 'files_sharing', |
|
| 224 | - 'script' => 'list.php', |
|
| 225 | - 'order' => 19, |
|
| 226 | - 'name' => $l->t('Pending shares'), |
|
| 227 | - ]; |
|
| 228 | - |
|
| 229 | - return [ |
|
| 230 | - 'id' => 'shareoverview', |
|
| 231 | - 'appname' => 'files_sharing', |
|
| 232 | - 'script' => 'list.php', |
|
| 233 | - 'order' => 18, |
|
| 234 | - 'name' => $l->t('Shares'), |
|
| 235 | - 'classes' => 'collapsible', |
|
| 236 | - 'sublist' => $sharingSublistArray, |
|
| 237 | - 'expandedState' => 'show_sharing_menu' |
|
| 238 | - ]; |
|
| 239 | - }); |
|
| 240 | - } |
|
| 66 | + public const APP_ID = 'files_sharing'; |
|
| 67 | + |
|
| 68 | + public function __construct(array $urlParams = []) { |
|
| 69 | + parent::__construct(self::APP_ID, $urlParams); |
|
| 70 | + |
|
| 71 | + $container = $this->getContainer(); |
|
| 72 | + |
|
| 73 | + /** @var IServerContainer $server */ |
|
| 74 | + $server = $container->getServer(); |
|
| 75 | + |
|
| 76 | + /** @var IEventDispatcher $dispatcher */ |
|
| 77 | + $dispatcher = $container->query(IEventDispatcher::class); |
|
| 78 | + $oldDispatcher = $container->getServer()->getEventDispatcher(); |
|
| 79 | + $mountProviderCollection = $server->getMountProviderCollection(); |
|
| 80 | + $notifications = $server->getNotificationManager(); |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Core class wrappers |
|
| 84 | + */ |
|
| 85 | + $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) { |
|
| 86 | + $user = $server->getUserSession()->getUser(); |
|
| 87 | + $uid = $user ? $user->getUID() : null; |
|
| 88 | + return new \OCA\Files_Sharing\External\Manager( |
|
| 89 | + $server->getDatabaseConnection(), |
|
| 90 | + \OC\Files\Filesystem::getMountManager(), |
|
| 91 | + \OC\Files\Filesystem::getLoader(), |
|
| 92 | + $server->getHTTPClientService(), |
|
| 93 | + $server->getNotificationManager(), |
|
| 94 | + $server->query(\OCP\OCS\IDiscoveryService::class), |
|
| 95 | + $server->getCloudFederationProviderManager(), |
|
| 96 | + $server->getCloudFederationFactory(), |
|
| 97 | + $server->getGroupManager(), |
|
| 98 | + $server->getUserManager(), |
|
| 99 | + $uid, |
|
| 100 | + $server->query(IEventDispatcher::class) |
|
| 101 | + ); |
|
| 102 | + }); |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Middleware |
|
| 106 | + */ |
|
| 107 | + $container->registerMiddleWare(SharingCheckMiddleware::class); |
|
| 108 | + $container->registerMiddleWare(OCSShareAPIMiddleware::class); |
|
| 109 | + $container->registerMiddleWare(ShareInfoMiddleware::class); |
|
| 110 | + |
|
| 111 | + $container->registerService('ExternalMountProvider', function (ContainerInterface $c) { |
|
| 112 | + return new \OCA\Files_Sharing\External\MountProvider( |
|
| 113 | + $c->get(IDBConnection::class), |
|
| 114 | + function () use ($c) { |
|
| 115 | + return $c->get(Manager::class); |
|
| 116 | + }, |
|
| 117 | + $c->get(ICloudIdManager::class) |
|
| 118 | + ); |
|
| 119 | + }); |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Register capabilities |
|
| 123 | + */ |
|
| 124 | + $container->registerCapability(Capabilities::class); |
|
| 125 | + |
|
| 126 | + $notifications->registerNotifierService(Notifier::class); |
|
| 127 | + |
|
| 128 | + $this->registerMountProviders($mountProviderCollection); |
|
| 129 | + $this->registerEventsScripts($dispatcher, $oldDispatcher); |
|
| 130 | + $this->setupSharingMenus(); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Always add main sharing script |
|
| 134 | + */ |
|
| 135 | + Util::addScript(self::APP_ID, 'dist/main'); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) { |
|
| 139 | + $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class)); |
|
| 140 | + $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider')); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + protected function registerEventsScripts(IEventDispatcher $dispatcher, EventDispatcherInterface $oldDispatcher) { |
|
| 144 | + // sidebar and files scripts |
|
| 145 | + $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class); |
|
| 146 | + $dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class); |
|
| 147 | + $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class); |
|
| 148 | + $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class); |
|
| 149 | + $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () { |
|
| 150 | + \OCP\Util::addScript('files_sharing', 'dist/collaboration'); |
|
| 151 | + }); |
|
| 152 | + $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class); |
|
| 153 | + $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class); |
|
| 154 | + |
|
| 155 | + // notifications api to accept incoming user shares |
|
| 156 | + $oldDispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) { |
|
| 157 | + /** @var Listener $listener */ |
|
| 158 | + $listener = $this->getContainer()->query(Listener::class); |
|
| 159 | + $listener->shareNotification($event); |
|
| 160 | + }); |
|
| 161 | + $oldDispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) { |
|
| 162 | + /** @var Listener $listener */ |
|
| 163 | + $listener = $this->getContainer()->query(Listener::class); |
|
| 164 | + $listener->userAddedToGroup($event); |
|
| 165 | + }); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + protected function setupSharingMenus() { |
|
| 169 | + $config = \OC::$server->getConfig(); |
|
| 170 | + |
|
| 171 | + if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
| 172 | + return; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + // show_Quick_Access stored as string |
|
| 176 | + \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 177 | + $config = \OC::$server->getConfig(); |
|
| 178 | + $l = \OC::$server->getL10N('files_sharing'); |
|
| 179 | + |
|
| 180 | + $sharingSublistArray = []; |
|
| 181 | + |
|
| 182 | + if (\OCP\Util::isSharingDisabledForUser() === false) { |
|
| 183 | + $sharingSublistArray[] = [ |
|
| 184 | + 'id' => 'sharingout', |
|
| 185 | + 'appname' => 'files_sharing', |
|
| 186 | + 'script' => 'list.php', |
|
| 187 | + 'order' => 16, |
|
| 188 | + 'name' => $l->t('Shared with others'), |
|
| 189 | + ]; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + $sharingSublistArray[] = [ |
|
| 193 | + 'id' => 'sharingin', |
|
| 194 | + 'appname' => 'files_sharing', |
|
| 195 | + 'script' => 'list.php', |
|
| 196 | + 'order' => 15, |
|
| 197 | + 'name' => $l->t('Shared with you'), |
|
| 198 | + ]; |
|
| 199 | + |
|
| 200 | + if (\OCP\Util::isSharingDisabledForUser() === false) { |
|
| 201 | + // Check if sharing by link is enabled |
|
| 202 | + if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') { |
|
| 203 | + $sharingSublistArray[] = [ |
|
| 204 | + 'id' => 'sharinglinks', |
|
| 205 | + 'appname' => 'files_sharing', |
|
| 206 | + 'script' => 'list.php', |
|
| 207 | + 'order' => 17, |
|
| 208 | + 'name' => $l->t('Shared by link'), |
|
| 209 | + ]; |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + $sharingSublistArray[] = [ |
|
| 214 | + 'id' => 'deletedshares', |
|
| 215 | + 'appname' => 'files_sharing', |
|
| 216 | + 'script' => 'list.php', |
|
| 217 | + 'order' => 19, |
|
| 218 | + 'name' => $l->t('Deleted shares'), |
|
| 219 | + ]; |
|
| 220 | + |
|
| 221 | + $sharingSublistArray[] = [ |
|
| 222 | + 'id' => 'pendingshares', |
|
| 223 | + 'appname' => 'files_sharing', |
|
| 224 | + 'script' => 'list.php', |
|
| 225 | + 'order' => 19, |
|
| 226 | + 'name' => $l->t('Pending shares'), |
|
| 227 | + ]; |
|
| 228 | + |
|
| 229 | + return [ |
|
| 230 | + 'id' => 'shareoverview', |
|
| 231 | + 'appname' => 'files_sharing', |
|
| 232 | + 'script' => 'list.php', |
|
| 233 | + 'order' => 18, |
|
| 234 | + 'name' => $l->t('Shares'), |
|
| 235 | + 'classes' => 'collapsible', |
|
| 236 | + 'sublist' => $sharingSublistArray, |
|
| 237 | + 'expandedState' => 'show_sharing_menu' |
|
| 238 | + ]; |
|
| 239 | + }); |
|
| 240 | + } |
|
| 241 | 241 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Core class wrappers |
| 84 | 84 | */ |
| 85 | - $container->registerService(Manager::class, function (SimpleContainer $c) use ($server) { |
|
| 85 | + $container->registerService(Manager::class, function(SimpleContainer $c) use ($server) { |
|
| 86 | 86 | $user = $server->getUserSession()->getUser(); |
| 87 | 87 | $uid = $user ? $user->getUID() : null; |
| 88 | 88 | return new \OCA\Files_Sharing\External\Manager( |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | $container->registerMiddleWare(OCSShareAPIMiddleware::class); |
| 109 | 109 | $container->registerMiddleWare(ShareInfoMiddleware::class); |
| 110 | 110 | |
| 111 | - $container->registerService('ExternalMountProvider', function (ContainerInterface $c) { |
|
| 111 | + $container->registerService('ExternalMountProvider', function(ContainerInterface $c) { |
|
| 112 | 112 | return new \OCA\Files_Sharing\External\MountProvider( |
| 113 | 113 | $c->get(IDBConnection::class), |
| 114 | - function () use ($c) { |
|
| 114 | + function() use ($c) { |
|
| 115 | 115 | return $c->get(Manager::class); |
| 116 | 116 | }, |
| 117 | 117 | $c->get(ICloudIdManager::class) |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | $dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class); |
| 147 | 147 | $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class); |
| 148 | 148 | $dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class); |
| 149 | - $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () { |
|
| 149 | + $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() { |
|
| 150 | 150 | \OCP\Util::addScript('files_sharing', 'dist/collaboration'); |
| 151 | 151 | }); |
| 152 | 152 | $dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class); |
| 153 | 153 | $dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class); |
| 154 | 154 | |
| 155 | 155 | // notifications api to accept incoming user shares |
| 156 | - $oldDispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) { |
|
| 156 | + $oldDispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) { |
|
| 157 | 157 | /** @var Listener $listener */ |
| 158 | 158 | $listener = $this->getContainer()->query(Listener::class); |
| 159 | 159 | $listener->shareNotification($event); |
| 160 | 160 | }); |
| 161 | - $oldDispatcher->addListener(IGroup::class . '::postAddUser', function (GenericEvent $event) { |
|
| 161 | + $oldDispatcher->addListener(IGroup::class.'::postAddUser', function(GenericEvent $event) { |
|
| 162 | 162 | /** @var Listener $listener */ |
| 163 | 163 | $listener = $this->getContainer()->query(Listener::class); |
| 164 | 164 | $listener->userAddedToGroup($event); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // show_Quick_Access stored as string |
| 176 | - \OCA\Files\App::getNavigationManager()->add(function () { |
|
| 176 | + \OCA\Files\App::getNavigationManager()->add(function() { |
|
| 177 | 177 | $config = \OC::$server->getConfig(); |
| 178 | 178 | $l = \OC::$server->getL10N('files_sharing'); |
| 179 | 179 | |
@@ -56,155 +56,155 @@ |
||
| 56 | 56 | * @package OC\Core |
| 57 | 57 | */ |
| 58 | 58 | class Application extends App { |
| 59 | - public function __construct() { |
|
| 60 | - parent::__construct('core'); |
|
| 61 | - |
|
| 62 | - $container = $this->getContainer(); |
|
| 63 | - |
|
| 64 | - $container->registerService('defaultMailAddress', function () { |
|
| 65 | - return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
| 66 | - }); |
|
| 67 | - |
|
| 68 | - $server = $container->getServer(); |
|
| 69 | - /** @var IEventDispatcher $eventDispatcher */ |
|
| 70 | - $eventDispatcher = $server->query(IEventDispatcher::class); |
|
| 71 | - |
|
| 72 | - $notificationManager = $server->getNotificationManager(); |
|
| 73 | - $notificationManager->registerNotifierService(RemoveLinkSharesNotifier::class); |
|
| 74 | - $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
| 75 | - |
|
| 76 | - $oldEventDispatcher = $server->getEventDispatcher(); |
|
| 77 | - |
|
| 78 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
| 79 | - function (GenericEvent $event) use ($container) { |
|
| 80 | - /** @var MissingIndexInformation $subject */ |
|
| 81 | - $subject = $event->getSubject(); |
|
| 82 | - |
|
| 83 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
| 84 | - |
|
| 85 | - if ($schema->hasTable('share')) { |
|
| 86 | - $table = $schema->getTable('share'); |
|
| 87 | - |
|
| 88 | - if (!$table->hasIndex('share_with_index')) { |
|
| 89 | - $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
| 90 | - } |
|
| 91 | - if (!$table->hasIndex('parent_index')) { |
|
| 92 | - $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
| 93 | - } |
|
| 94 | - if (!$table->hasIndex('owner_index')) { |
|
| 95 | - $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
| 96 | - } |
|
| 97 | - if (!$table->hasIndex('initiator_index')) { |
|
| 98 | - $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ($schema->hasTable('filecache')) { |
|
| 103 | - $table = $schema->getTable('filecache'); |
|
| 104 | - |
|
| 105 | - if (!$table->hasIndex('fs_mtime')) { |
|
| 106 | - $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - if (!$table->hasIndex('fs_size')) { |
|
| 110 | - $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - if ($schema->hasTable('twofactor_providers')) { |
|
| 115 | - $table = $schema->getTable('twofactor_providers'); |
|
| 116 | - |
|
| 117 | - if (!$table->hasIndex('twofactor_providers_uid')) { |
|
| 118 | - $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
| 119 | - } |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - if ($schema->hasTable('login_flow_v2')) { |
|
| 123 | - $table = $schema->getTable('login_flow_v2'); |
|
| 124 | - |
|
| 125 | - if (!$table->hasIndex('poll_token')) { |
|
| 126 | - $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
| 127 | - } |
|
| 128 | - if (!$table->hasIndex('login_token')) { |
|
| 129 | - $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
| 130 | - } |
|
| 131 | - if (!$table->hasIndex('timestamp')) { |
|
| 132 | - $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if ($schema->hasTable('whats_new')) { |
|
| 137 | - $table = $schema->getTable('whats_new'); |
|
| 138 | - |
|
| 139 | - if (!$table->hasIndex('version')) { |
|
| 140 | - $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - if ($schema->hasTable('cards')) { |
|
| 145 | - $table = $schema->getTable('cards'); |
|
| 146 | - |
|
| 147 | - if (!$table->hasIndex('cards_abid')) { |
|
| 148 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if ($schema->hasTable('cards_properties')) { |
|
| 153 | - $table = $schema->getTable('cards_properties'); |
|
| 154 | - |
|
| 155 | - if (!$table->hasIndex('cards_prop_abid')) { |
|
| 156 | - $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if ($schema->hasTable('calendarobjects_props')) { |
|
| 161 | - $table = $schema->getTable('calendarobjects_props'); |
|
| 162 | - |
|
| 163 | - if (!$table->hasIndex('calendarobject_calid_index')) { |
|
| 164 | - $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - if ($schema->hasTable('schedulingobjects')) { |
|
| 169 | - $table = $schema->getTable('schedulingobjects'); |
|
| 170 | - if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
| 171 | - $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - if ($schema->hasTable('properties')) { |
|
| 176 | - $table = $schema->getTable('properties'); |
|
| 177 | - if (!$table->hasIndex('properties_path_index')) { |
|
| 178 | - $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
| 179 | - } |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - ); |
|
| 183 | - |
|
| 184 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
| 185 | - function (GenericEvent $event) use ($container) { |
|
| 186 | - /** @var MissingColumnInformation $subject */ |
|
| 187 | - $subject = $event->getSubject(); |
|
| 188 | - |
|
| 189 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
| 190 | - |
|
| 191 | - if ($schema->hasTable('comments')) { |
|
| 192 | - $table = $schema->getTable('comments'); |
|
| 193 | - |
|
| 194 | - if (!$table->hasColumn('reference_id')) { |
|
| 195 | - $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - ); |
|
| 200 | - |
|
| 201 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
| 202 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
| 203 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
| 204 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
| 205 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
| 206 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
| 207 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
| 208 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
| 209 | - } |
|
| 59 | + public function __construct() { |
|
| 60 | + parent::__construct('core'); |
|
| 61 | + |
|
| 62 | + $container = $this->getContainer(); |
|
| 63 | + |
|
| 64 | + $container->registerService('defaultMailAddress', function () { |
|
| 65 | + return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
| 66 | + }); |
|
| 67 | + |
|
| 68 | + $server = $container->getServer(); |
|
| 69 | + /** @var IEventDispatcher $eventDispatcher */ |
|
| 70 | + $eventDispatcher = $server->query(IEventDispatcher::class); |
|
| 71 | + |
|
| 72 | + $notificationManager = $server->getNotificationManager(); |
|
| 73 | + $notificationManager->registerNotifierService(RemoveLinkSharesNotifier::class); |
|
| 74 | + $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
| 75 | + |
|
| 76 | + $oldEventDispatcher = $server->getEventDispatcher(); |
|
| 77 | + |
|
| 78 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
| 79 | + function (GenericEvent $event) use ($container) { |
|
| 80 | + /** @var MissingIndexInformation $subject */ |
|
| 81 | + $subject = $event->getSubject(); |
|
| 82 | + |
|
| 83 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
| 84 | + |
|
| 85 | + if ($schema->hasTable('share')) { |
|
| 86 | + $table = $schema->getTable('share'); |
|
| 87 | + |
|
| 88 | + if (!$table->hasIndex('share_with_index')) { |
|
| 89 | + $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
| 90 | + } |
|
| 91 | + if (!$table->hasIndex('parent_index')) { |
|
| 92 | + $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
| 93 | + } |
|
| 94 | + if (!$table->hasIndex('owner_index')) { |
|
| 95 | + $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
| 96 | + } |
|
| 97 | + if (!$table->hasIndex('initiator_index')) { |
|
| 98 | + $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ($schema->hasTable('filecache')) { |
|
| 103 | + $table = $schema->getTable('filecache'); |
|
| 104 | + |
|
| 105 | + if (!$table->hasIndex('fs_mtime')) { |
|
| 106 | + $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + if (!$table->hasIndex('fs_size')) { |
|
| 110 | + $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + if ($schema->hasTable('twofactor_providers')) { |
|
| 115 | + $table = $schema->getTable('twofactor_providers'); |
|
| 116 | + |
|
| 117 | + if (!$table->hasIndex('twofactor_providers_uid')) { |
|
| 118 | + $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + if ($schema->hasTable('login_flow_v2')) { |
|
| 123 | + $table = $schema->getTable('login_flow_v2'); |
|
| 124 | + |
|
| 125 | + if (!$table->hasIndex('poll_token')) { |
|
| 126 | + $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
| 127 | + } |
|
| 128 | + if (!$table->hasIndex('login_token')) { |
|
| 129 | + $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
| 130 | + } |
|
| 131 | + if (!$table->hasIndex('timestamp')) { |
|
| 132 | + $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if ($schema->hasTable('whats_new')) { |
|
| 137 | + $table = $schema->getTable('whats_new'); |
|
| 138 | + |
|
| 139 | + if (!$table->hasIndex('version')) { |
|
| 140 | + $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + if ($schema->hasTable('cards')) { |
|
| 145 | + $table = $schema->getTable('cards'); |
|
| 146 | + |
|
| 147 | + if (!$table->hasIndex('cards_abid')) { |
|
| 148 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if ($schema->hasTable('cards_properties')) { |
|
| 153 | + $table = $schema->getTable('cards_properties'); |
|
| 154 | + |
|
| 155 | + if (!$table->hasIndex('cards_prop_abid')) { |
|
| 156 | + $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if ($schema->hasTable('calendarobjects_props')) { |
|
| 161 | + $table = $schema->getTable('calendarobjects_props'); |
|
| 162 | + |
|
| 163 | + if (!$table->hasIndex('calendarobject_calid_index')) { |
|
| 164 | + $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + if ($schema->hasTable('schedulingobjects')) { |
|
| 169 | + $table = $schema->getTable('schedulingobjects'); |
|
| 170 | + if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
| 171 | + $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + if ($schema->hasTable('properties')) { |
|
| 176 | + $table = $schema->getTable('properties'); |
|
| 177 | + if (!$table->hasIndex('properties_path_index')) { |
|
| 178 | + $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
| 179 | + } |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | + ); |
|
| 183 | + |
|
| 184 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
| 185 | + function (GenericEvent $event) use ($container) { |
|
| 186 | + /** @var MissingColumnInformation $subject */ |
|
| 187 | + $subject = $event->getSubject(); |
|
| 188 | + |
|
| 189 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
| 190 | + |
|
| 191 | + if ($schema->hasTable('comments')) { |
|
| 192 | + $table = $schema->getTable('comments'); |
|
| 193 | + |
|
| 194 | + if (!$table->hasColumn('reference_id')) { |
|
| 195 | + $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + ); |
|
| 200 | + |
|
| 201 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
| 202 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
| 203 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
| 204 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
| 205 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
| 206 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
| 207 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
| 208 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
| 209 | + } |
|
| 210 | 210 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $container = $this->getContainer(); |
| 63 | 63 | |
| 64 | - $container->registerService('defaultMailAddress', function () { |
|
| 64 | + $container->registerService('defaultMailAddress', function() { |
|
| 65 | 65 | return Util::getDefaultEmailAddress('lostpassword-noreply'); |
| 66 | 66 | }); |
| 67 | 67 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $oldEventDispatcher = $server->getEventDispatcher(); |
| 77 | 77 | |
| 78 | 78 | $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
| 79 | - function (GenericEvent $event) use ($container) { |
|
| 79 | + function(GenericEvent $event) use ($container) { |
|
| 80 | 80 | /** @var MissingIndexInformation $subject */ |
| 81 | 81 | $subject = $event->getSubject(); |
| 82 | 82 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | 184 | $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
| 185 | - function (GenericEvent $event) use ($container) { |
|
| 185 | + function(GenericEvent $event) use ($container) { |
|
| 186 | 186 | /** @var MissingColumnInformation $subject */ |
| 187 | 187 | $subject = $event->getSubject(); |
| 188 | 188 | |