@@ -34,39 +34,39 @@ |
||
34 | 34 | |
35 | 35 | class UserDeletedTokenCleanupListener implements IEventListener { |
36 | 36 | |
37 | - /** @var Manager */ |
|
38 | - private $manager; |
|
37 | + /** @var Manager */ |
|
38 | + private $manager; |
|
39 | 39 | |
40 | - /** @var ILogger */ |
|
41 | - private $logger; |
|
40 | + /** @var ILogger */ |
|
41 | + private $logger; |
|
42 | 42 | |
43 | - public function __construct(Manager $manager, |
|
44 | - ILogger $logger) { |
|
45 | - $this->manager = $manager; |
|
46 | - $this->logger = $logger; |
|
47 | - } |
|
43 | + public function __construct(Manager $manager, |
|
44 | + ILogger $logger) { |
|
45 | + $this->manager = $manager; |
|
46 | + $this->logger = $logger; |
|
47 | + } |
|
48 | 48 | |
49 | - public function handle(Event $event): void { |
|
50 | - if (!($event instanceof UserDeletedEvent)) { |
|
51 | - // Unrelated |
|
52 | - return; |
|
53 | - } |
|
49 | + public function handle(Event $event): void { |
|
50 | + if (!($event instanceof UserDeletedEvent)) { |
|
51 | + // Unrelated |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Catch any exception during this process as any failure here shouldn't block the |
|
57 | - * user deletion. |
|
58 | - */ |
|
59 | - try { |
|
60 | - $uid = $event->getUser()->getUID(); |
|
61 | - $tokens = $this->manager->getTokenByUser($uid); |
|
62 | - foreach ($tokens as $token) { |
|
63 | - $this->manager->invalidateTokenById($uid, $token->getId()); |
|
64 | - } |
|
65 | - } catch (Throwable $e) { |
|
66 | - $this->logger->logException($e, [ |
|
67 | - 'message' => 'Could not clean up auth tokens after user deletion: ' . $e->getMessage(), |
|
68 | - 'error' => ILogger::ERROR, |
|
69 | - ]); |
|
70 | - } |
|
71 | - } |
|
55 | + /** |
|
56 | + * Catch any exception during this process as any failure here shouldn't block the |
|
57 | + * user deletion. |
|
58 | + */ |
|
59 | + try { |
|
60 | + $uid = $event->getUser()->getUID(); |
|
61 | + $tokens = $this->manager->getTokenByUser($uid); |
|
62 | + foreach ($tokens as $token) { |
|
63 | + $this->manager->invalidateTokenById($uid, $token->getId()); |
|
64 | + } |
|
65 | + } catch (Throwable $e) { |
|
66 | + $this->logger->logException($e, [ |
|
67 | + 'message' => 'Could not clean up auth tokens after user deletion: ' . $e->getMessage(), |
|
68 | + 'error' => ILogger::ERROR, |
|
69 | + ]); |
|
70 | + } |
|
71 | + } |
|
72 | 72 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | } |
65 | 65 | } catch (Throwable $e) { |
66 | 66 | $this->logger->logException($e, [ |
67 | - 'message' => 'Could not clean up auth tokens after user deletion: ' . $e->getMessage(), |
|
67 | + 'message' => 'Could not clean up auth tokens after user deletion: '.$e->getMessage(), |
|
68 | 68 | 'error' => ILogger::ERROR, |
69 | 69 | ]); |
70 | 70 | } |
@@ -55,149 +55,149 @@ |
||
55 | 55 | * @package OC\Core |
56 | 56 | */ |
57 | 57 | class Application extends App { |
58 | - public function __construct() { |
|
59 | - parent::__construct('core'); |
|
60 | - |
|
61 | - $container = $this->getContainer(); |
|
62 | - |
|
63 | - $container->registerService('defaultMailAddress', function () { |
|
64 | - return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
65 | - }); |
|
66 | - |
|
67 | - $server = $container->getServer(); |
|
68 | - /** @var IEventDispatcher $eventDispatcher */ |
|
69 | - $eventDispatcher = $server->query(IEventDispatcher::class); |
|
70 | - |
|
71 | - $notificationManager = $server->getNotificationManager(); |
|
72 | - $notificationManager->registerNotifierService(RemoveLinkSharesNotifier::class); |
|
73 | - $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
74 | - |
|
75 | - $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
76 | - function (GenericEvent $event) use ($container) { |
|
77 | - /** @var MissingIndexInformation $subject */ |
|
78 | - $subject = $event->getSubject(); |
|
79 | - |
|
80 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
81 | - |
|
82 | - if ($schema->hasTable('share')) { |
|
83 | - $table = $schema->getTable('share'); |
|
84 | - |
|
85 | - if (!$table->hasIndex('share_with_index')) { |
|
86 | - $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
87 | - } |
|
88 | - if (!$table->hasIndex('parent_index')) { |
|
89 | - $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
90 | - } |
|
91 | - if (!$table->hasIndex('owner_index')) { |
|
92 | - $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
93 | - } |
|
94 | - if (!$table->hasIndex('initiator_index')) { |
|
95 | - $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
96 | - } |
|
97 | - } |
|
98 | - |
|
99 | - if ($schema->hasTable('filecache')) { |
|
100 | - $table = $schema->getTable('filecache'); |
|
101 | - |
|
102 | - if (!$table->hasIndex('fs_mtime')) { |
|
103 | - $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - if ($schema->hasTable('twofactor_providers')) { |
|
108 | - $table = $schema->getTable('twofactor_providers'); |
|
109 | - |
|
110 | - if (!$table->hasIndex('twofactor_providers_uid')) { |
|
111 | - $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - if ($schema->hasTable('login_flow_v2')) { |
|
116 | - $table = $schema->getTable('login_flow_v2'); |
|
117 | - |
|
118 | - if (!$table->hasIndex('poll_token')) { |
|
119 | - $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
120 | - } |
|
121 | - if (!$table->hasIndex('login_token')) { |
|
122 | - $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
123 | - } |
|
124 | - if (!$table->hasIndex('timestamp')) { |
|
125 | - $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - if ($schema->hasTable('whats_new')) { |
|
130 | - $table = $schema->getTable('whats_new'); |
|
131 | - |
|
132 | - if (!$table->hasIndex('version')) { |
|
133 | - $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - if ($schema->hasTable('cards')) { |
|
138 | - $table = $schema->getTable('cards'); |
|
139 | - |
|
140 | - if (!$table->hasIndex('cards_abid')) { |
|
141 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
142 | - } |
|
143 | - } |
|
144 | - |
|
145 | - if ($schema->hasTable('cards_properties')) { |
|
146 | - $table = $schema->getTable('cards_properties'); |
|
147 | - |
|
148 | - if (!$table->hasIndex('cards_prop_abid')) { |
|
149 | - $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - if ($schema->hasTable('calendarobjects_props')) { |
|
154 | - $table = $schema->getTable('calendarobjects_props'); |
|
155 | - |
|
156 | - if (!$table->hasIndex('calendarobject_calid_index')) { |
|
157 | - $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
158 | - } |
|
159 | - } |
|
160 | - |
|
161 | - if ($schema->hasTable('schedulingobjects')) { |
|
162 | - $table = $schema->getTable('schedulingobjects'); |
|
163 | - if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
164 | - $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - if ($schema->hasTable('properties')) { |
|
169 | - $table = $schema->getTable('properties'); |
|
170 | - if (!$table->hasIndex('properties_path_index')) { |
|
171 | - $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
172 | - } |
|
173 | - } |
|
174 | - } |
|
175 | - ); |
|
176 | - |
|
177 | - $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
178 | - function (GenericEvent $event) use ($container) { |
|
179 | - /** @var MissingColumnInformation $subject */ |
|
180 | - $subject = $event->getSubject(); |
|
181 | - |
|
182 | - $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
183 | - |
|
184 | - if ($schema->hasTable('comments')) { |
|
185 | - $table = $schema->getTable('comments'); |
|
186 | - |
|
187 | - if (!$table->hasColumn('reference_id')) { |
|
188 | - $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
192 | - ); |
|
193 | - |
|
194 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
195 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
196 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
197 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
198 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
199 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
200 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
201 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
202 | - } |
|
58 | + public function __construct() { |
|
59 | + parent::__construct('core'); |
|
60 | + |
|
61 | + $container = $this->getContainer(); |
|
62 | + |
|
63 | + $container->registerService('defaultMailAddress', function () { |
|
64 | + return Util::getDefaultEmailAddress('lostpassword-noreply'); |
|
65 | + }); |
|
66 | + |
|
67 | + $server = $container->getServer(); |
|
68 | + /** @var IEventDispatcher $eventDispatcher */ |
|
69 | + $eventDispatcher = $server->query(IEventDispatcher::class); |
|
70 | + |
|
71 | + $notificationManager = $server->getNotificationManager(); |
|
72 | + $notificationManager->registerNotifierService(RemoveLinkSharesNotifier::class); |
|
73 | + $notificationManager->registerNotifierService(AuthenticationNotifier::class); |
|
74 | + |
|
75 | + $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, |
|
76 | + function (GenericEvent $event) use ($container) { |
|
77 | + /** @var MissingIndexInformation $subject */ |
|
78 | + $subject = $event->getSubject(); |
|
79 | + |
|
80 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
81 | + |
|
82 | + if ($schema->hasTable('share')) { |
|
83 | + $table = $schema->getTable('share'); |
|
84 | + |
|
85 | + if (!$table->hasIndex('share_with_index')) { |
|
86 | + $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); |
|
87 | + } |
|
88 | + if (!$table->hasIndex('parent_index')) { |
|
89 | + $subject->addHintForMissingSubject($table->getName(), 'parent_index'); |
|
90 | + } |
|
91 | + if (!$table->hasIndex('owner_index')) { |
|
92 | + $subject->addHintForMissingSubject($table->getName(), 'owner_index'); |
|
93 | + } |
|
94 | + if (!$table->hasIndex('initiator_index')) { |
|
95 | + $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); |
|
96 | + } |
|
97 | + } |
|
98 | + |
|
99 | + if ($schema->hasTable('filecache')) { |
|
100 | + $table = $schema->getTable('filecache'); |
|
101 | + |
|
102 | + if (!$table->hasIndex('fs_mtime')) { |
|
103 | + $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + if ($schema->hasTable('twofactor_providers')) { |
|
108 | + $table = $schema->getTable('twofactor_providers'); |
|
109 | + |
|
110 | + if (!$table->hasIndex('twofactor_providers_uid')) { |
|
111 | + $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + if ($schema->hasTable('login_flow_v2')) { |
|
116 | + $table = $schema->getTable('login_flow_v2'); |
|
117 | + |
|
118 | + if (!$table->hasIndex('poll_token')) { |
|
119 | + $subject->addHintForMissingSubject($table->getName(), 'poll_token'); |
|
120 | + } |
|
121 | + if (!$table->hasIndex('login_token')) { |
|
122 | + $subject->addHintForMissingSubject($table->getName(), 'login_token'); |
|
123 | + } |
|
124 | + if (!$table->hasIndex('timestamp')) { |
|
125 | + $subject->addHintForMissingSubject($table->getName(), 'timestamp'); |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + if ($schema->hasTable('whats_new')) { |
|
130 | + $table = $schema->getTable('whats_new'); |
|
131 | + |
|
132 | + if (!$table->hasIndex('version')) { |
|
133 | + $subject->addHintForMissingSubject($table->getName(), 'version'); |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + if ($schema->hasTable('cards')) { |
|
138 | + $table = $schema->getTable('cards'); |
|
139 | + |
|
140 | + if (!$table->hasIndex('cards_abid')) { |
|
141 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); |
|
142 | + } |
|
143 | + } |
|
144 | + |
|
145 | + if ($schema->hasTable('cards_properties')) { |
|
146 | + $table = $schema->getTable('cards_properties'); |
|
147 | + |
|
148 | + if (!$table->hasIndex('cards_prop_abid')) { |
|
149 | + $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + if ($schema->hasTable('calendarobjects_props')) { |
|
154 | + $table = $schema->getTable('calendarobjects_props'); |
|
155 | + |
|
156 | + if (!$table->hasIndex('calendarobject_calid_index')) { |
|
157 | + $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); |
|
158 | + } |
|
159 | + } |
|
160 | + |
|
161 | + if ($schema->hasTable('schedulingobjects')) { |
|
162 | + $table = $schema->getTable('schedulingobjects'); |
|
163 | + if (!$table->hasIndex('schedulobj_principuri_index')) { |
|
164 | + $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + if ($schema->hasTable('properties')) { |
|
169 | + $table = $schema->getTable('properties'); |
|
170 | + if (!$table->hasIndex('properties_path_index')) { |
|
171 | + $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); |
|
172 | + } |
|
173 | + } |
|
174 | + } |
|
175 | + ); |
|
176 | + |
|
177 | + $eventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, |
|
178 | + function (GenericEvent $event) use ($container) { |
|
179 | + /** @var MissingColumnInformation $subject */ |
|
180 | + $subject = $event->getSubject(); |
|
181 | + |
|
182 | + $schema = new SchemaWrapper($container->query(IDBConnection::class)); |
|
183 | + |
|
184 | + if ($schema->hasTable('comments')) { |
|
185 | + $table = $schema->getTable('comments'); |
|
186 | + |
|
187 | + if (!$table->hasColumn('reference_id')) { |
|
188 | + $subject->addHintForMissingColumn($table->getName(), 'reference_id'); |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | + ); |
|
193 | + |
|
194 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); |
|
195 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); |
|
196 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); |
|
197 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); |
|
198 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); |
|
199 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); |
|
200 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); |
|
201 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); |
|
202 | + } |
|
203 | 203 | } |