@@ -31,14 +31,14 @@ |
||
31 | 31 | use OCP\EventDispatcher\IEventListener; |
32 | 32 | |
33 | 33 | class BeforeTemplateRenderedListener implements IEventListener { |
34 | - public function handle(Event $event): void { |
|
35 | - if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
36 | - return; |
|
37 | - } |
|
34 | + public function handle(Event $event): void { |
|
35 | + if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
36 | + return; |
|
37 | + } |
|
38 | 38 | |
39 | - if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) { |
|
40 | - // Making sure to inject just after core |
|
41 | - \OCP\Util::addScript('core', 'unsupported-browser-redirect'); |
|
42 | - } |
|
43 | - } |
|
39 | + if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) { |
|
40 | + // Making sure to inject just after core |
|
41 | + \OCP\Util::addScript('core', 'unsupported-browser-redirect'); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
@@ -71,274 +71,274 @@ |
||
71 | 71 | * @package OC\Core |
72 | 72 | */ |
73 | 73 | class Application extends App { |
74 | - public function __construct() { |
|
75 | - parent::__construct('core'); |
|
76 | - |
|
77 | - $container = $this->getContainer(); |
|
78 | - |
|
79 | - $container->registerService('defaultMailAddress', function () { |
|
80 | - return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
81 | - }); |
|
82 | - |
|
83 | - $server = $container->getServer(); |
|
84 | - /** @var IEventDispatcher $eventDispatcher */ |
|
85 | - $eventDispatcher = $server->get(IEventDispatcher::class); |
|
86 | - |
|
87 | - $notificationManager = $server->getNotificationManager(); |
|
88 | - $notificationManager->registerNotifierService(CoreNotifier::class); |
|
89 | - $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
90 | - |
|
91 | - $oldEventDispatcher = $server->getEventDispatcher(); |
|
92 | - |
|
93 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
94 | - function (GenericEvent $event) use ($container) { |
|
95 | - /** @var MissingIndexInformation $subject */ |
|
96 | - $subject = $event->getSubject(); |
|
97 | - |
|
98 | - $schema = new SchemaWrapper($container->query(Connection::class)); |
|
99 | - |
|
100 | - if ($schema->hasTable('share')) { |
|
101 | - $table = $schema->getTable('share'); |
|
102 | - |
|
103 | - if (!$table->hasIndex('share_with_index')) { |
|
104 | - $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
105 | - } |
|
106 | - if (!$table->hasIndex('parent_index')) { |
|
107 | - $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
108 | - } |
|
109 | - if (!$table->hasIndex('owner_index')) { |
|
110 | - $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
111 | - } |
|
112 | - if (!$table->hasIndex('initiator_index')) { |
|
113 | - $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - if ($schema->hasTable('filecache')) { |
|
118 | - $table = $schema->getTable('filecache'); |
|
119 | - |
|
120 | - if (!$table->hasIndex('fs_mtime')) { |
|
121 | - $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
122 | - } |
|
123 | - |
|
124 | - if (!$table->hasIndex('fs_size')) { |
|
125 | - $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
126 | - } |
|
127 | - |
|
128 | - if (!$table->hasIndex('fs_id_storage_size')) { |
|
129 | - $subject->addHintForMissingSubject($table->getName(), 'fs_id_storage_size'); |
|
130 | - } |
|
131 | - |
|
132 | - if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { |
|
133 | - $subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix'); |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - if ($schema->hasTable('twofactor_providers')) { |
|
138 | - $table = $schema->getTable('twofactor_providers'); |
|
139 | - |
|
140 | - if (!$table->hasIndex('twofactor_providers_uid')) { |
|
141 | - $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
142 | - } |
|
143 | - } |
|
144 | - |
|
145 | - if ($schema->hasTable('login_flow_v2')) { |
|
146 | - $table = $schema->getTable('login_flow_v2'); |
|
147 | - |
|
148 | - if (!$table->hasIndex('poll_token')) { |
|
149 | - $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
150 | - } |
|
151 | - if (!$table->hasIndex('login_token')) { |
|
152 | - $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
153 | - } |
|
154 | - if (!$table->hasIndex('timestamp')) { |
|
155 | - $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - if ($schema->hasTable('whats_new')) { |
|
160 | - $table = $schema->getTable('whats_new'); |
|
161 | - |
|
162 | - if (!$table->hasIndex('version')) { |
|
163 | - $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
164 | - } |
|
165 | - } |
|
166 | - |
|
167 | - if ($schema->hasTable('cards')) { |
|
168 | - $table = $schema->getTable('cards'); |
|
169 | - |
|
170 | - if (!$table->hasIndex('cards_abid')) { |
|
171 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
172 | - } |
|
173 | - |
|
174 | - if (!$table->hasIndex('cards_abiduri')) { |
|
175 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); |
|
176 | - } |
|
177 | - } |
|
178 | - |
|
179 | - if ($schema->hasTable('cards_properties')) { |
|
180 | - $table = $schema->getTable('cards_properties'); |
|
181 | - |
|
182 | - if (!$table->hasIndex('cards_prop_abid')) { |
|
183 | - $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
184 | - } |
|
185 | - } |
|
186 | - |
|
187 | - if ($schema->hasTable('calendarobjects_props')) { |
|
188 | - $table = $schema->getTable('calendarobjects_props'); |
|
189 | - |
|
190 | - if (!$table->hasIndex('calendarobject_calid_index')) { |
|
191 | - $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - if ($schema->hasTable('schedulingobjects')) { |
|
196 | - $table = $schema->getTable('schedulingobjects'); |
|
197 | - if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
198 | - $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - if ($schema->hasTable('properties')) { |
|
203 | - $table = $schema->getTable('properties'); |
|
204 | - if (!$table->hasIndex('properties_path_index')) { |
|
205 | - $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
206 | - } |
|
207 | - if (!$table->hasIndex('properties_pathonly_index')) { |
|
208 | - $subject->addHintForMissingSubject($table->getName(), 'properties_pathonly_index'); |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - if ($schema->hasTable('jobs')) { |
|
213 | - $table = $schema->getTable('jobs'); |
|
214 | - if (!$table->hasIndex('job_lastcheck_reserved')) { |
|
215 | - $subject->addHintForMissingSubject($table->getName(), 'job_lastcheck_reserved'); |
|
216 | - } |
|
217 | - } |
|
218 | - |
|
219 | - if ($schema->hasTable('direct_edit')) { |
|
220 | - $table = $schema->getTable('direct_edit'); |
|
221 | - if (!$table->hasIndex('direct_edit_timestamp')) { |
|
222 | - $subject->addHintForMissingSubject($table->getName(), 'direct_edit_timestamp'); |
|
223 | - } |
|
224 | - } |
|
225 | - |
|
226 | - if ($schema->hasTable('preferences')) { |
|
227 | - $table = $schema->getTable('preferences'); |
|
228 | - if (!$table->hasIndex('preferences_app_key')) { |
|
229 | - $subject->addHintForMissingSubject($table->getName(), 'preferences_app_key'); |
|
230 | - } |
|
231 | - } |
|
232 | - |
|
233 | - if ($schema->hasTable('mounts')) { |
|
234 | - $table = $schema->getTable('mounts'); |
|
235 | - if (!$table->hasIndex('mounts_class_index')) { |
|
236 | - $subject->addHintForMissingSubject($table->getName(), 'mounts_class_index'); |
|
237 | - } |
|
238 | - } |
|
239 | - } |
|
240 | - ); |
|
241 | - |
|
242 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, |
|
243 | - function (GenericEvent $event) use ($container) { |
|
244 | - /** @var MissingPrimaryKeyInformation $subject */ |
|
245 | - $subject = $event->getSubject(); |
|
246 | - |
|
247 | - $schema = new SchemaWrapper($container->query(Connection::class)); |
|
248 | - |
|
249 | - if ($schema->hasTable('federated_reshares')) { |
|
250 | - $table = $schema->getTable('federated_reshares'); |
|
251 | - |
|
252 | - if (!$table->hasPrimaryKey()) { |
|
253 | - $subject->addHintForMissingSubject($table->getName()); |
|
254 | - } |
|
255 | - } |
|
256 | - |
|
257 | - if ($schema->hasTable('systemtag_object_mapping')) { |
|
258 | - $table = $schema->getTable('systemtag_object_mapping'); |
|
259 | - |
|
260 | - if (!$table->hasPrimaryKey()) { |
|
261 | - $subject->addHintForMissingSubject($table->getName()); |
|
262 | - } |
|
263 | - } |
|
264 | - |
|
265 | - if ($schema->hasTable('comments_read_markers')) { |
|
266 | - $table = $schema->getTable('comments_read_markers'); |
|
267 | - |
|
268 | - if (!$table->hasPrimaryKey()) { |
|
269 | - $subject->addHintForMissingSubject($table->getName()); |
|
270 | - } |
|
271 | - } |
|
272 | - |
|
273 | - if ($schema->hasTable('collres_resources')) { |
|
274 | - $table = $schema->getTable('collres_resources'); |
|
275 | - |
|
276 | - if (!$table->hasPrimaryKey()) { |
|
277 | - $subject->addHintForMissingSubject($table->getName()); |
|
278 | - } |
|
279 | - } |
|
280 | - |
|
281 | - if ($schema->hasTable('collres_accesscache')) { |
|
282 | - $table = $schema->getTable('collres_accesscache'); |
|
283 | - |
|
284 | - if (!$table->hasPrimaryKey()) { |
|
285 | - $subject->addHintForMissingSubject($table->getName()); |
|
286 | - } |
|
287 | - } |
|
288 | - |
|
289 | - if ($schema->hasTable('filecache_extended')) { |
|
290 | - $table = $schema->getTable('filecache_extended'); |
|
291 | - |
|
292 | - if (!$table->hasPrimaryKey()) { |
|
293 | - $subject->addHintForMissingSubject($table->getName()); |
|
294 | - } |
|
295 | - } |
|
296 | - } |
|
297 | - ); |
|
298 | - |
|
299 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
300 | - function (GenericEvent $event) use ($container) { |
|
301 | - /** @var MissingColumnInformation $subject */ |
|
302 | - $subject = $event->getSubject(); |
|
303 | - |
|
304 | - $schema = new SchemaWrapper($container->query(Connection::class)); |
|
305 | - |
|
306 | - if ($schema->hasTable('comments')) { |
|
307 | - $table = $schema->getTable('comments'); |
|
308 | - |
|
309 | - if (!$table->hasColumn('reference_id')) { |
|
310 | - $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
311 | - } |
|
312 | - } |
|
313 | - } |
|
314 | - ); |
|
315 | - |
|
316 | - $eventDispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
317 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
318 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
319 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
320 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
321 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
322 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
323 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
324 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
325 | - $eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
|
326 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
|
327 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class); |
|
328 | - |
|
329 | - // Metadata |
|
330 | - /** @var IConfig $config */ |
|
331 | - $config = $container->get(IConfig::class); |
|
332 | - if ($config->getSystemValueBool('enable_file_metadata', true)) { |
|
333 | - /** @psalm-suppress InvalidArgument */ |
|
334 | - $eventDispatcher->addServiceListener(NodeDeletedEvent::class, FileEventListener::class); |
|
335 | - /** @psalm-suppress InvalidArgument */ |
|
336 | - $eventDispatcher->addServiceListener(NodeRemovedFromCache::class, FileEventListener::class); |
|
337 | - /** @psalm-suppress InvalidArgument */ |
|
338 | - $eventDispatcher->addServiceListener(NodeWrittenEvent::class, FileEventListener::class); |
|
339 | - } |
|
340 | - |
|
341 | - // Tags |
|
342 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, TagManager::class); |
|
343 | - } |
|
74 | + public function __construct() { |
|
75 | + parent::__construct('core'); |
|
76 | + |
|
77 | + $container = $this->getContainer(); |
|
78 | + |
|
79 | + $container->registerService('defaultMailAddress', function () { |
|
80 | + return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
81 | + }); |
|
82 | + |
|
83 | + $server = $container->getServer(); |
|
84 | + /** @var IEventDispatcher $eventDispatcher */ |
|
85 | + $eventDispatcher = $server->get(IEventDispatcher::class); |
|
86 | + |
|
87 | + $notificationManager = $server->getNotificationManager(); |
|
88 | + $notificationManager->registerNotifierService(CoreNotifier::class); |
|
89 | + $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
90 | + |
|
91 | + $oldEventDispatcher = $server->getEventDispatcher(); |
|
92 | + |
|
93 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
94 | + function (GenericEvent $event) use ($container) { |
|
95 | + /** @var MissingIndexInformation $subject */ |
|
96 | + $subject = $event->getSubject(); |
|
97 | + |
|
98 | + $schema = new SchemaWrapper($container->query(Connection::class)); |
|
99 | + |
|
100 | + if ($schema->hasTable('share')) { |
|
101 | + $table = $schema->getTable('share'); |
|
102 | + |
|
103 | + if (!$table->hasIndex('share_with_index')) { |
|
104 | + $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
105 | + } |
|
106 | + if (!$table->hasIndex('parent_index')) { |
|
107 | + $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
108 | + } |
|
109 | + if (!$table->hasIndex('owner_index')) { |
|
110 | + $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
111 | + } |
|
112 | + if (!$table->hasIndex('initiator_index')) { |
|
113 | + $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + if ($schema->hasTable('filecache')) { |
|
118 | + $table = $schema->getTable('filecache'); |
|
119 | + |
|
120 | + if (!$table->hasIndex('fs_mtime')) { |
|
121 | + $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
122 | + } |
|
123 | + |
|
124 | + if (!$table->hasIndex('fs_size')) { |
|
125 | + $subject->addHintForMissingSubject($table->getName(), 'fs_size'); |
|
126 | + } |
|
127 | + |
|
128 | + if (!$table->hasIndex('fs_id_storage_size')) { |
|
129 | + $subject->addHintForMissingSubject($table->getName(), 'fs_id_storage_size'); |
|
130 | + } |
|
131 | + |
|
132 | + if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { |
|
133 | + $subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix'); |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + if ($schema->hasTable('twofactor_providers')) { |
|
138 | + $table = $schema->getTable('twofactor_providers'); |
|
139 | + |
|
140 | + if (!$table->hasIndex('twofactor_providers_uid')) { |
|
141 | + $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
142 | + } |
|
143 | + } |
|
144 | + |
|
145 | + if ($schema->hasTable('login_flow_v2')) { |
|
146 | + $table = $schema->getTable('login_flow_v2'); |
|
147 | + |
|
148 | + if (!$table->hasIndex('poll_token')) { |
|
149 | + $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
150 | + } |
|
151 | + if (!$table->hasIndex('login_token')) { |
|
152 | + $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
153 | + } |
|
154 | + if (!$table->hasIndex('timestamp')) { |
|
155 | + $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + if ($schema->hasTable('whats_new')) { |
|
160 | + $table = $schema->getTable('whats_new'); |
|
161 | + |
|
162 | + if (!$table->hasIndex('version')) { |
|
163 | + $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
164 | + } |
|
165 | + } |
|
166 | + |
|
167 | + if ($schema->hasTable('cards')) { |
|
168 | + $table = $schema->getTable('cards'); |
|
169 | + |
|
170 | + if (!$table->hasIndex('cards_abid')) { |
|
171 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
172 | + } |
|
173 | + |
|
174 | + if (!$table->hasIndex('cards_abiduri')) { |
|
175 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); |
|
176 | + } |
|
177 | + } |
|
178 | + |
|
179 | + if ($schema->hasTable('cards_properties')) { |
|
180 | + $table = $schema->getTable('cards_properties'); |
|
181 | + |
|
182 | + if (!$table->hasIndex('cards_prop_abid')) { |
|
183 | + $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
184 | + } |
|
185 | + } |
|
186 | + |
|
187 | + if ($schema->hasTable('calendarobjects_props')) { |
|
188 | + $table = $schema->getTable('calendarobjects_props'); |
|
189 | + |
|
190 | + if (!$table->hasIndex('calendarobject_calid_index')) { |
|
191 | + $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + if ($schema->hasTable('schedulingobjects')) { |
|
196 | + $table = $schema->getTable('schedulingobjects'); |
|
197 | + if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
198 | + $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + if ($schema->hasTable('properties')) { |
|
203 | + $table = $schema->getTable('properties'); |
|
204 | + if (!$table->hasIndex('properties_path_index')) { |
|
205 | + $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
206 | + } |
|
207 | + if (!$table->hasIndex('properties_pathonly_index')) { |
|
208 | + $subject->addHintForMissingSubject($table->getName(), 'properties_pathonly_index'); |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + if ($schema->hasTable('jobs')) { |
|
213 | + $table = $schema->getTable('jobs'); |
|
214 | + if (!$table->hasIndex('job_lastcheck_reserved')) { |
|
215 | + $subject->addHintForMissingSubject($table->getName(), 'job_lastcheck_reserved'); |
|
216 | + } |
|
217 | + } |
|
218 | + |
|
219 | + if ($schema->hasTable('direct_edit')) { |
|
220 | + $table = $schema->getTable('direct_edit'); |
|
221 | + if (!$table->hasIndex('direct_edit_timestamp')) { |
|
222 | + $subject->addHintForMissingSubject($table->getName(), 'direct_edit_timestamp'); |
|
223 | + } |
|
224 | + } |
|
225 | + |
|
226 | + if ($schema->hasTable('preferences')) { |
|
227 | + $table = $schema->getTable('preferences'); |
|
228 | + if (!$table->hasIndex('preferences_app_key')) { |
|
229 | + $subject->addHintForMissingSubject($table->getName(), 'preferences_app_key'); |
|
230 | + } |
|
231 | + } |
|
232 | + |
|
233 | + if ($schema->hasTable('mounts')) { |
|
234 | + $table = $schema->getTable('mounts'); |
|
235 | + if (!$table->hasIndex('mounts_class_index')) { |
|
236 | + $subject->addHintForMissingSubject($table->getName(), 'mounts_class_index'); |
|
237 | + } |
|
238 | + } |
|
239 | + } |
|
240 | + ); |
|
241 | + |
|
242 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, |
|
243 | + function (GenericEvent $event) use ($container) { |
|
244 | + /** @var MissingPrimaryKeyInformation $subject */ |
|
245 | + $subject = $event->getSubject(); |
|
246 | + |
|
247 | + $schema = new SchemaWrapper($container->query(Connection::class)); |
|
248 | + |
|
249 | + if ($schema->hasTable('federated_reshares')) { |
|
250 | + $table = $schema->getTable('federated_reshares'); |
|
251 | + |
|
252 | + if (!$table->hasPrimaryKey()) { |
|
253 | + $subject->addHintForMissingSubject($table->getName()); |
|
254 | + } |
|
255 | + } |
|
256 | + |
|
257 | + if ($schema->hasTable('systemtag_object_mapping')) { |
|
258 | + $table = $schema->getTable('systemtag_object_mapping'); |
|
259 | + |
|
260 | + if (!$table->hasPrimaryKey()) { |
|
261 | + $subject->addHintForMissingSubject($table->getName()); |
|
262 | + } |
|
263 | + } |
|
264 | + |
|
265 | + if ($schema->hasTable('comments_read_markers')) { |
|
266 | + $table = $schema->getTable('comments_read_markers'); |
|
267 | + |
|
268 | + if (!$table->hasPrimaryKey()) { |
|
269 | + $subject->addHintForMissingSubject($table->getName()); |
|
270 | + } |
|
271 | + } |
|
272 | + |
|
273 | + if ($schema->hasTable('collres_resources')) { |
|
274 | + $table = $schema->getTable('collres_resources'); |
|
275 | + |
|
276 | + if (!$table->hasPrimaryKey()) { |
|
277 | + $subject->addHintForMissingSubject($table->getName()); |
|
278 | + } |
|
279 | + } |
|
280 | + |
|
281 | + if ($schema->hasTable('collres_accesscache')) { |
|
282 | + $table = $schema->getTable('collres_accesscache'); |
|
283 | + |
|
284 | + if (!$table->hasPrimaryKey()) { |
|
285 | + $subject->addHintForMissingSubject($table->getName()); |
|
286 | + } |
|
287 | + } |
|
288 | + |
|
289 | + if ($schema->hasTable('filecache_extended')) { |
|
290 | + $table = $schema->getTable('filecache_extended'); |
|
291 | + |
|
292 | + if (!$table->hasPrimaryKey()) { |
|
293 | + $subject->addHintForMissingSubject($table->getName()); |
|
294 | + } |
|
295 | + } |
|
296 | + } |
|
297 | + ); |
|
298 | + |
|
299 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
300 | + function (GenericEvent $event) use ($container) { |
|
301 | + /** @var MissingColumnInformation $subject */ |
|
302 | + $subject = $event->getSubject(); |
|
303 | + |
|
304 | + $schema = new SchemaWrapper($container->query(Connection::class)); |
|
305 | + |
|
306 | + if ($schema->hasTable('comments')) { |
|
307 | + $table = $schema->getTable('comments'); |
|
308 | + |
|
309 | + if (!$table->hasColumn('reference_id')) { |
|
310 | + $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
311 | + } |
|
312 | + } |
|
313 | + } |
|
314 | + ); |
|
315 | + |
|
316 | + $eventDispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
317 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
318 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
319 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
320 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
321 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
322 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
323 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
324 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
325 | + $eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
|
326 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class); |
|
327 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class); |
|
328 | + |
|
329 | + // Metadata |
|
330 | + /** @var IConfig $config */ |
|
331 | + $config = $container->get(IConfig::class); |
|
332 | + if ($config->getSystemValueBool('enable_file_metadata', true)) { |
|
333 | + /** @psalm-suppress InvalidArgument */ |
|
334 | + $eventDispatcher->addServiceListener(NodeDeletedEvent::class, FileEventListener::class); |
|
335 | + /** @psalm-suppress InvalidArgument */ |
|
336 | + $eventDispatcher->addServiceListener(NodeRemovedFromCache::class, FileEventListener::class); |
|
337 | + /** @psalm-suppress InvalidArgument */ |
|
338 | + $eventDispatcher->addServiceListener(NodeWrittenEvent::class, FileEventListener::class); |
|
339 | + } |
|
340 | + |
|
341 | + // Tags |
|
342 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, TagManager::class); |
|
343 | + } |
|
344 | 344 | } |