Completed
Push — master ( 247b25...4111bd )
by Thomas
26:36 queued 10s
created
apps/dav/lib/Listener/ActivityUpdaterListener.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 				);
71 71
 			} catch (Throwable $e) {
72 72
 				// Any error with activities shouldn't abort the calendar creation, so we just log it
73
-				$this->logger->error('Error generating activities for a new calendar: ' . $e->getMessage(), [
73
+				$this->logger->error('Error generating activities for a new calendar: '.$e->getMessage(), [
74 74
 					'exception' => $e,
75 75
 				]);
76 76
 			}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				);
88 88
 			} catch (Throwable $e) {
89 89
 				// Any error with activities shouldn't abort the calendar update, so we just log it
90
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
90
+				$this->logger->error('Error generating activities for changed calendar: '.$e->getMessage(), [
91 91
 					'exception' => $e,
92 92
 				]);
93 93
 			}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 				);
104 104
 			} catch (Throwable $e) {
105 105
 				// Any error with activities shouldn't abort the calendar update, so we just log it
106
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
106
+				$this->logger->error('Error generating activities for changed calendar: '.$e->getMessage(), [
107 107
 					'exception' => $e,
108 108
 				]);
109 109
 			}
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 				);
120 120
 			} catch (Throwable $e) {
121 121
 				// Any error with activities shouldn't abort the calendar update, so we just log it
122
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
122
+				$this->logger->error('Error generating activities for changed calendar: '.$e->getMessage(), [
123 123
 					'exception' => $e,
124 124
 				]);
125 125
 			}
126 126
 		} elseif ($event instanceof CalendarDeletedEvent) {
127 127
 			try {
128
-				$deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
128
+				$deletedProp = '{'.Plugin::NS_NEXTCLOUD.'}deleted-at';
129 129
 				if (isset($event->getCalendarData()[$deletedProp])) {
130 130
 					$this->logger->debug(
131 131
 						sprintf('Calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				}
143 143
 			} catch (Throwable $e) {
144 144
 				// Any error with activities shouldn't abort the calendar deletion, so we just log it
145
-				$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
145
+				$this->logger->error('Error generating activities for a deleted calendar: '.$e->getMessage(), [
146 146
 					'exception' => $e,
147 147
 				]);
148 148
 			}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				);
161 161
 			} catch (Throwable $e) {
162 162
 				// Any error with activities shouldn't abort the calendar object creation, so we just log it
163
-				$this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
163
+				$this->logger->error('Error generating activity for a new calendar object: '.$e->getMessage(), [
164 164
 					'exception' => $e,
165 165
 				]);
166 166
 			}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				);
179 179
 			} catch (Throwable $e) {
180 180
 				// Any error with activities shouldn't abort the calendar deletion, so we just log it
181
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
181
+				$this->logger->error('Error generating activity for a deleted calendar object: '.$e->getMessage(), [
182 182
 					'exception' => $e,
183 183
 				]);
184 184
 			}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				);
198 198
 			} catch (Throwable $e) {
199 199
 				// Any error with activities shouldn't abort the calendar deletion, so we just log it
200
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
200
+				$this->logger->error('Error generating activity for a deleted calendar object: '.$e->getMessage(), [
201 201
 					'exception' => $e,
202 202
 				]);
203 203
 			}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				);
216 216
 			} catch (Throwable $e) {
217 217
 				// Any error with activities shouldn't abort the calendar object creation, so we just log it
218
-				$this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
218
+				$this->logger->error('Error generating activity for a new calendar object: '.$e->getMessage(), [
219 219
 					'exception' => $e,
220 220
 				]);
221 221
 			}
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
 				);
234 234
 			} catch (Throwable $e) {
235 235
 				// Any error with activities shouldn't abort the calendar object restoration, so we just log it
236
-				$this->logger->error('Error generating activity for a restored calendar object: ' . $e->getMessage(), [
236
+				$this->logger->error('Error generating activity for a restored calendar object: '.$e->getMessage(), [
237 237
 					'exception' => $e,
238 238
 				]);
239 239
 			}
240 240
 		} elseif ($event instanceof CalendarObjectDeletedEvent) {
241 241
 			try {
242
-				$deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
242
+				$deletedProp = '{'.Plugin::NS_NEXTCLOUD.'}deleted-at';
243 243
 				if (isset($event->getObjectData()[$deletedProp])) {
244 244
 					$this->logger->debug(
245 245
 						sprintf('Calendar object in calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				}
259 259
 			} catch (Throwable $e) {
260 260
 				// Any error with activities shouldn't abort the calendar deletion, so we just log it
261
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
261
+				$this->logger->error('Error generating activity for a deleted calendar object: '.$e->getMessage(), [
262 262
 					'exception' => $e,
263 263
 				]);
264 264
 			}
Please login to merge, or discard this patch.
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -30,216 +30,216 @@
 block discarded – undo
30 30
 /** @template-implements IEventListener<CalendarCreatedEvent|CalendarUpdatedEvent|CalendarMovedToTrashEvent|CalendarRestoredEvent|CalendarDeletedEvent|CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarObjectMovedEvent|CalendarObjectMovedToTrashEvent|CalendarObjectRestoredEvent|CalendarObjectDeletedEvent> */
31 31
 class ActivityUpdaterListener implements IEventListener {
32 32
 
33
-	public function __construct(
34
-		private ActivityBackend $activityBackend,
35
-		private LoggerInterface $logger,
36
-	) {
37
-	}
38
-
39
-	public function handle(Event $event): void {
40
-		if ($event instanceof CalendarCreatedEvent) {
41
-			try {
42
-				$this->activityBackend->onCalendarAdd(
43
-					$event->getCalendarData()
44
-				);
45
-
46
-				$this->logger->debug(
47
-					sprintf('Activity generated for new calendar %d', $event->getCalendarId())
48
-				);
49
-			} catch (Throwable $e) {
50
-				// Any error with activities shouldn't abort the calendar creation, so we just log it
51
-				$this->logger->error('Error generating activities for a new calendar: ' . $e->getMessage(), [
52
-					'exception' => $e,
53
-				]);
54
-			}
55
-		} elseif ($event instanceof CalendarUpdatedEvent) {
56
-			try {
57
-				$this->activityBackend->onCalendarUpdate(
58
-					$event->getCalendarData(),
59
-					$event->getShares(),
60
-					$event->getMutations()
61
-				);
62
-
63
-				$this->logger->debug(
64
-					sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
65
-				);
66
-			} catch (Throwable $e) {
67
-				// Any error with activities shouldn't abort the calendar update, so we just log it
68
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
69
-					'exception' => $e,
70
-				]);
71
-			}
72
-		} elseif ($event instanceof CalendarMovedToTrashEvent) {
73
-			try {
74
-				$this->activityBackend->onCalendarMovedToTrash(
75
-					$event->getCalendarData(),
76
-					$event->getShares()
77
-				);
78
-
79
-				$this->logger->debug(
80
-					sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
81
-				);
82
-			} catch (Throwable $e) {
83
-				// Any error with activities shouldn't abort the calendar update, so we just log it
84
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
85
-					'exception' => $e,
86
-				]);
87
-			}
88
-		} elseif ($event instanceof CalendarRestoredEvent) {
89
-			try {
90
-				$this->activityBackend->onCalendarRestored(
91
-					$event->getCalendarData(),
92
-					$event->getShares()
93
-				);
94
-
95
-				$this->logger->debug(
96
-					sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
97
-				);
98
-			} catch (Throwable $e) {
99
-				// Any error with activities shouldn't abort the calendar update, so we just log it
100
-				$this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
101
-					'exception' => $e,
102
-				]);
103
-			}
104
-		} elseif ($event instanceof CalendarDeletedEvent) {
105
-			try {
106
-				$deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
107
-				if (isset($event->getCalendarData()[$deletedProp])) {
108
-					$this->logger->debug(
109
-						sprintf('Calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
110
-					);
111
-				} else {
112
-					$this->activityBackend->onCalendarDelete(
113
-						$event->getCalendarData(),
114
-						$event->getShares()
115
-					);
116
-
117
-					$this->logger->debug(
118
-						sprintf('Activity generated for deleted calendar %d', $event->getCalendarId())
119
-					);
120
-				}
121
-			} catch (Throwable $e) {
122
-				// Any error with activities shouldn't abort the calendar deletion, so we just log it
123
-				$this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
124
-					'exception' => $e,
125
-				]);
126
-			}
127
-		} elseif ($event instanceof CalendarObjectCreatedEvent) {
128
-			try {
129
-				$this->activityBackend->onTouchCalendarObject(
130
-					\OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_ADD,
131
-					$event->getCalendarData(),
132
-					$event->getShares(),
133
-					$event->getObjectData()
134
-				);
135
-
136
-				$this->logger->debug(
137
-					sprintf('Activity generated for new calendar object in calendar %d', $event->getCalendarId())
138
-				);
139
-			} catch (Throwable $e) {
140
-				// Any error with activities shouldn't abort the calendar object creation, so we just log it
141
-				$this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
142
-					'exception' => $e,
143
-				]);
144
-			}
145
-		} elseif ($event instanceof CalendarObjectUpdatedEvent) {
146
-			try {
147
-				$this->activityBackend->onTouchCalendarObject(
148
-					\OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_UPDATE,
149
-					$event->getCalendarData(),
150
-					$event->getShares(),
151
-					$event->getObjectData()
152
-				);
153
-
154
-				$this->logger->debug(
155
-					sprintf('Activity generated for updated calendar object in calendar %d', $event->getCalendarId())
156
-				);
157
-			} catch (Throwable $e) {
158
-				// Any error with activities shouldn't abort the calendar deletion, so we just log it
159
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
160
-					'exception' => $e,
161
-				]);
162
-			}
163
-		} elseif ($event instanceof CalendarObjectMovedEvent) {
164
-			try {
165
-				$this->activityBackend->onMovedCalendarObject(
166
-					$event->getSourceCalendarData(),
167
-					$event->getTargetCalendarData(),
168
-					$event->getSourceShares(),
169
-					$event->getTargetShares(),
170
-					$event->getObjectData()
171
-				);
172
-
173
-				$this->logger->debug(
174
-					sprintf('Activity generated for moved calendar object from calendar %d to calendar %d', $event->getSourceCalendarId(), $event->getTargetCalendarId())
175
-				);
176
-			} catch (Throwable $e) {
177
-				// Any error with activities shouldn't abort the calendar deletion, so we just log it
178
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
179
-					'exception' => $e,
180
-				]);
181
-			}
182
-		} elseif ($event instanceof CalendarObjectMovedToTrashEvent) {
183
-			try {
184
-				$this->activityBackend->onTouchCalendarObject(
185
-					\OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_MOVE_TO_TRASH,
186
-					$event->getCalendarData(),
187
-					$event->getShares(),
188
-					$event->getObjectData()
189
-				);
190
-
191
-				$this->logger->debug(
192
-					sprintf('Activity generated for a calendar object of calendar %d that is moved to trash', $event->getCalendarId())
193
-				);
194
-			} catch (Throwable $e) {
195
-				// Any error with activities shouldn't abort the calendar object creation, so we just log it
196
-				$this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
197
-					'exception' => $e,
198
-				]);
199
-			}
200
-		} elseif ($event instanceof CalendarObjectRestoredEvent) {
201
-			try {
202
-				$this->activityBackend->onTouchCalendarObject(
203
-					\OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_RESTORE,
204
-					$event->getCalendarData(),
205
-					$event->getShares(),
206
-					$event->getObjectData()
207
-				);
208
-
209
-				$this->logger->debug(
210
-					sprintf('Activity generated for a restore calendar object of calendar %d', $event->getCalendarId())
211
-				);
212
-			} catch (Throwable $e) {
213
-				// Any error with activities shouldn't abort the calendar object restoration, so we just log it
214
-				$this->logger->error('Error generating activity for a restored calendar object: ' . $e->getMessage(), [
215
-					'exception' => $e,
216
-				]);
217
-			}
218
-		} elseif ($event instanceof CalendarObjectDeletedEvent) {
219
-			try {
220
-				$deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
221
-				if (isset($event->getObjectData()[$deletedProp])) {
222
-					$this->logger->debug(
223
-						sprintf('Calendar object in calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
224
-					);
225
-				} else {
226
-					$this->activityBackend->onTouchCalendarObject(
227
-						\OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_DELETE,
228
-						$event->getCalendarData(),
229
-						$event->getShares(),
230
-						$event->getObjectData()
231
-					);
232
-
233
-					$this->logger->debug(
234
-						sprintf('Activity generated for deleted calendar object in calendar %d', $event->getCalendarId())
235
-					);
236
-				}
237
-			} catch (Throwable $e) {
238
-				// Any error with activities shouldn't abort the calendar deletion, so we just log it
239
-				$this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
240
-					'exception' => $e,
241
-				]);
242
-			}
243
-		}
244
-	}
33
+    public function __construct(
34
+        private ActivityBackend $activityBackend,
35
+        private LoggerInterface $logger,
36
+    ) {
37
+    }
38
+
39
+    public function handle(Event $event): void {
40
+        if ($event instanceof CalendarCreatedEvent) {
41
+            try {
42
+                $this->activityBackend->onCalendarAdd(
43
+                    $event->getCalendarData()
44
+                );
45
+
46
+                $this->logger->debug(
47
+                    sprintf('Activity generated for new calendar %d', $event->getCalendarId())
48
+                );
49
+            } catch (Throwable $e) {
50
+                // Any error with activities shouldn't abort the calendar creation, so we just log it
51
+                $this->logger->error('Error generating activities for a new calendar: ' . $e->getMessage(), [
52
+                    'exception' => $e,
53
+                ]);
54
+            }
55
+        } elseif ($event instanceof CalendarUpdatedEvent) {
56
+            try {
57
+                $this->activityBackend->onCalendarUpdate(
58
+                    $event->getCalendarData(),
59
+                    $event->getShares(),
60
+                    $event->getMutations()
61
+                );
62
+
63
+                $this->logger->debug(
64
+                    sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
65
+                );
66
+            } catch (Throwable $e) {
67
+                // Any error with activities shouldn't abort the calendar update, so we just log it
68
+                $this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
69
+                    'exception' => $e,
70
+                ]);
71
+            }
72
+        } elseif ($event instanceof CalendarMovedToTrashEvent) {
73
+            try {
74
+                $this->activityBackend->onCalendarMovedToTrash(
75
+                    $event->getCalendarData(),
76
+                    $event->getShares()
77
+                );
78
+
79
+                $this->logger->debug(
80
+                    sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
81
+                );
82
+            } catch (Throwable $e) {
83
+                // Any error with activities shouldn't abort the calendar update, so we just log it
84
+                $this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
85
+                    'exception' => $e,
86
+                ]);
87
+            }
88
+        } elseif ($event instanceof CalendarRestoredEvent) {
89
+            try {
90
+                $this->activityBackend->onCalendarRestored(
91
+                    $event->getCalendarData(),
92
+                    $event->getShares()
93
+                );
94
+
95
+                $this->logger->debug(
96
+                    sprintf('Activity generated for changed calendar %d', $event->getCalendarId())
97
+                );
98
+            } catch (Throwable $e) {
99
+                // Any error with activities shouldn't abort the calendar update, so we just log it
100
+                $this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [
101
+                    'exception' => $e,
102
+                ]);
103
+            }
104
+        } elseif ($event instanceof CalendarDeletedEvent) {
105
+            try {
106
+                $deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
107
+                if (isset($event->getCalendarData()[$deletedProp])) {
108
+                    $this->logger->debug(
109
+                        sprintf('Calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
110
+                    );
111
+                } else {
112
+                    $this->activityBackend->onCalendarDelete(
113
+                        $event->getCalendarData(),
114
+                        $event->getShares()
115
+                    );
116
+
117
+                    $this->logger->debug(
118
+                        sprintf('Activity generated for deleted calendar %d', $event->getCalendarId())
119
+                    );
120
+                }
121
+            } catch (Throwable $e) {
122
+                // Any error with activities shouldn't abort the calendar deletion, so we just log it
123
+                $this->logger->error('Error generating activities for a deleted calendar: ' . $e->getMessage(), [
124
+                    'exception' => $e,
125
+                ]);
126
+            }
127
+        } elseif ($event instanceof CalendarObjectCreatedEvent) {
128
+            try {
129
+                $this->activityBackend->onTouchCalendarObject(
130
+                    \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_ADD,
131
+                    $event->getCalendarData(),
132
+                    $event->getShares(),
133
+                    $event->getObjectData()
134
+                );
135
+
136
+                $this->logger->debug(
137
+                    sprintf('Activity generated for new calendar object in calendar %d', $event->getCalendarId())
138
+                );
139
+            } catch (Throwable $e) {
140
+                // Any error with activities shouldn't abort the calendar object creation, so we just log it
141
+                $this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
142
+                    'exception' => $e,
143
+                ]);
144
+            }
145
+        } elseif ($event instanceof CalendarObjectUpdatedEvent) {
146
+            try {
147
+                $this->activityBackend->onTouchCalendarObject(
148
+                    \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_UPDATE,
149
+                    $event->getCalendarData(),
150
+                    $event->getShares(),
151
+                    $event->getObjectData()
152
+                );
153
+
154
+                $this->logger->debug(
155
+                    sprintf('Activity generated for updated calendar object in calendar %d', $event->getCalendarId())
156
+                );
157
+            } catch (Throwable $e) {
158
+                // Any error with activities shouldn't abort the calendar deletion, so we just log it
159
+                $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
160
+                    'exception' => $e,
161
+                ]);
162
+            }
163
+        } elseif ($event instanceof CalendarObjectMovedEvent) {
164
+            try {
165
+                $this->activityBackend->onMovedCalendarObject(
166
+                    $event->getSourceCalendarData(),
167
+                    $event->getTargetCalendarData(),
168
+                    $event->getSourceShares(),
169
+                    $event->getTargetShares(),
170
+                    $event->getObjectData()
171
+                );
172
+
173
+                $this->logger->debug(
174
+                    sprintf('Activity generated for moved calendar object from calendar %d to calendar %d', $event->getSourceCalendarId(), $event->getTargetCalendarId())
175
+                );
176
+            } catch (Throwable $e) {
177
+                // Any error with activities shouldn't abort the calendar deletion, so we just log it
178
+                $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
179
+                    'exception' => $e,
180
+                ]);
181
+            }
182
+        } elseif ($event instanceof CalendarObjectMovedToTrashEvent) {
183
+            try {
184
+                $this->activityBackend->onTouchCalendarObject(
185
+                    \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_MOVE_TO_TRASH,
186
+                    $event->getCalendarData(),
187
+                    $event->getShares(),
188
+                    $event->getObjectData()
189
+                );
190
+
191
+                $this->logger->debug(
192
+                    sprintf('Activity generated for a calendar object of calendar %d that is moved to trash', $event->getCalendarId())
193
+                );
194
+            } catch (Throwable $e) {
195
+                // Any error with activities shouldn't abort the calendar object creation, so we just log it
196
+                $this->logger->error('Error generating activity for a new calendar object: ' . $e->getMessage(), [
197
+                    'exception' => $e,
198
+                ]);
199
+            }
200
+        } elseif ($event instanceof CalendarObjectRestoredEvent) {
201
+            try {
202
+                $this->activityBackend->onTouchCalendarObject(
203
+                    \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_RESTORE,
204
+                    $event->getCalendarData(),
205
+                    $event->getShares(),
206
+                    $event->getObjectData()
207
+                );
208
+
209
+                $this->logger->debug(
210
+                    sprintf('Activity generated for a restore calendar object of calendar %d', $event->getCalendarId())
211
+                );
212
+            } catch (Throwable $e) {
213
+                // Any error with activities shouldn't abort the calendar object restoration, so we just log it
214
+                $this->logger->error('Error generating activity for a restored calendar object: ' . $e->getMessage(), [
215
+                    'exception' => $e,
216
+                ]);
217
+            }
218
+        } elseif ($event instanceof CalendarObjectDeletedEvent) {
219
+            try {
220
+                $deletedProp = '{' . Plugin::NS_NEXTCLOUD . '}deleted-at';
221
+                if (isset($event->getObjectData()[$deletedProp])) {
222
+                    $this->logger->debug(
223
+                        sprintf('Calendar object in calendar %d was already in trashbin, skipping deletion activity', $event->getCalendarId())
224
+                    );
225
+                } else {
226
+                    $this->activityBackend->onTouchCalendarObject(
227
+                        \OCA\DAV\CalDAV\Activity\Provider\Event::SUBJECT_OBJECT_DELETE,
228
+                        $event->getCalendarData(),
229
+                        $event->getShares(),
230
+                        $event->getObjectData()
231
+                    );
232
+
233
+                    $this->logger->debug(
234
+                        sprintf('Activity generated for deleted calendar object in calendar %d', $event->getCalendarId())
235
+                    );
236
+                }
237
+            } catch (Throwable $e) {
238
+                // Any error with activities shouldn't abort the calendar deletion, so we just log it
239
+                $this->logger->error('Error generating activity for a deleted calendar object: ' . $e->getMessage(), [
240
+                    'exception' => $e,
241
+                ]);
242
+            }
243
+        }
244
+    }
245 245
 }
Please login to merge, or discard this patch.
apps/dav/lib/Listener/SubscriptionListener.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 			$subscriptionId = $event->getSubscriptionId();
58 58
 			$subscriptionData = $event->getSubscriptionData();
59 59
 
60
-			$this->logger->debug('Refreshing webcal data for subscription ' . $subscriptionId);
60
+			$this->logger->debug('Refreshing webcal data for subscription '.$subscriptionId);
61 61
 			$this->refreshWebcalService->refreshSubscription(
62
-				(string)$subscriptionData['principaluri'],
63
-				(string)$subscriptionData['uri']
62
+				(string) $subscriptionData['principaluri'],
63
+				(string) $subscriptionData['uri']
64 64
 			);
65 65
 
66
-			$this->logger->debug('Scheduling webcal data refreshment for subscription ' . $subscriptionId);
66
+			$this->logger->debug('Scheduling webcal data refreshment for subscription '.$subscriptionId);
67 67
 			$this->jobList->add(RefreshWebcalJob::class, [
68 68
 				'principaluri' => $subscriptionData['principaluri'],
69 69
 				'uri' => $subscriptionData['uri']
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 			$subscriptionId = $event->getSubscriptionId();
73 73
 			$subscriptionData = $event->getSubscriptionData();
74 74
 
75
-			$this->logger->debug('Removing refresh webcal job for subscription ' . $subscriptionId);
75
+			$this->logger->debug('Removing refresh webcal job for subscription '.$subscriptionId);
76 76
 			$this->jobList->remove(RefreshWebcalJob::class, [
77 77
 				'principaluri' => $subscriptionData['principaluri'],
78 78
 				'uri' => $subscriptionData['uri']
79 79
 			]);
80 80
 
81
-			$this->logger->debug('Cleaning all reminders for subscription ' . $subscriptionId);
81
+			$this->logger->debug('Cleaning all reminders for subscription '.$subscriptionId);
82 82
 			$this->reminderBackend->cleanRemindersForCalendar($subscriptionId);
83 83
 		}
84 84
 	}
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,45 +20,45 @@
 block discarded – undo
20 20
 
21 21
 /** @template-implements IEventListener<SubscriptionCreatedEvent|SubscriptionDeletedEvent> */
22 22
 class SubscriptionListener implements IEventListener {
23
-	public function __construct(
24
-		private IJobList $jobList,
25
-		private RefreshWebcalService $refreshWebcalService,
26
-		private ReminderBackend $reminderBackend,
27
-		private LoggerInterface $logger,
28
-	) {
29
-	}
23
+    public function __construct(
24
+        private IJobList $jobList,
25
+        private RefreshWebcalService $refreshWebcalService,
26
+        private ReminderBackend $reminderBackend,
27
+        private LoggerInterface $logger,
28
+    ) {
29
+    }
30 30
 
31
-	/**
32
-	 * In case the user has set their default calendar to the deleted one
33
-	 */
34
-	public function handle(Event $event): void {
35
-		if ($event instanceof SubscriptionCreatedEvent) {
36
-			$subscriptionId = $event->getSubscriptionId();
37
-			$subscriptionData = $event->getSubscriptionData();
31
+    /**
32
+     * In case the user has set their default calendar to the deleted one
33
+     */
34
+    public function handle(Event $event): void {
35
+        if ($event instanceof SubscriptionCreatedEvent) {
36
+            $subscriptionId = $event->getSubscriptionId();
37
+            $subscriptionData = $event->getSubscriptionData();
38 38
 
39
-			$this->logger->debug('Refreshing webcal data for subscription ' . $subscriptionId);
40
-			$this->refreshWebcalService->refreshSubscription(
41
-				(string)$subscriptionData['principaluri'],
42
-				(string)$subscriptionData['uri']
43
-			);
39
+            $this->logger->debug('Refreshing webcal data for subscription ' . $subscriptionId);
40
+            $this->refreshWebcalService->refreshSubscription(
41
+                (string)$subscriptionData['principaluri'],
42
+                (string)$subscriptionData['uri']
43
+            );
44 44
 
45
-			$this->logger->debug('Scheduling webcal data refreshment for subscription ' . $subscriptionId);
46
-			$this->jobList->add(RefreshWebcalJob::class, [
47
-				'principaluri' => $subscriptionData['principaluri'],
48
-				'uri' => $subscriptionData['uri']
49
-			]);
50
-		} elseif ($event instanceof SubscriptionDeletedEvent) {
51
-			$subscriptionId = $event->getSubscriptionId();
52
-			$subscriptionData = $event->getSubscriptionData();
45
+            $this->logger->debug('Scheduling webcal data refreshment for subscription ' . $subscriptionId);
46
+            $this->jobList->add(RefreshWebcalJob::class, [
47
+                'principaluri' => $subscriptionData['principaluri'],
48
+                'uri' => $subscriptionData['uri']
49
+            ]);
50
+        } elseif ($event instanceof SubscriptionDeletedEvent) {
51
+            $subscriptionId = $event->getSubscriptionId();
52
+            $subscriptionData = $event->getSubscriptionData();
53 53
 
54
-			$this->logger->debug('Removing refresh webcal job for subscription ' . $subscriptionId);
55
-			$this->jobList->remove(RefreshWebcalJob::class, [
56
-				'principaluri' => $subscriptionData['principaluri'],
57
-				'uri' => $subscriptionData['uri']
58
-			]);
54
+            $this->logger->debug('Removing refresh webcal job for subscription ' . $subscriptionId);
55
+            $this->jobList->remove(RefreshWebcalJob::class, [
56
+                'principaluri' => $subscriptionData['principaluri'],
57
+                'uri' => $subscriptionData['uri']
58
+            ]);
59 59
 
60
-			$this->logger->debug('Cleaning all reminders for subscription ' . $subscriptionId);
61
-			$this->reminderBackend->cleanRemindersForCalendar($subscriptionId);
62
-		}
63
-	}
60
+            $this->logger->debug('Cleaning all reminders for subscription ' . $subscriptionId);
61
+            $this->reminderBackend->cleanRemindersForCalendar($subscriptionId);
62
+        }
63
+    }
64 64
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/CopyEtagHeaderPlugin.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -35,56 +35,56 @@
 block discarded – undo
35 35
  * or mangle Etag headers.
36 36
  */
37 37
 class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin {
38
-	private ?Server $server = null;
38
+    private ?Server $server = null;
39 39
 
40
-	/**
41
-	 * This initializes the plugin.
42
-	 *
43
-	 * @param \Sabre\DAV\Server $server Sabre server
44
-	 *
45
-	 * @return void
46
-	 */
47
-	public function initialize(\Sabre\DAV\Server $server) {
48
-		$this->server = $server;
40
+    /**
41
+     * This initializes the plugin.
42
+     *
43
+     * @param \Sabre\DAV\Server $server Sabre server
44
+     *
45
+     * @return void
46
+     */
47
+    public function initialize(\Sabre\DAV\Server $server) {
48
+        $this->server = $server;
49 49
 
50
-		$server->on('afterMethod:*', [$this, 'afterMethod']);
51
-		$server->on('afterMove', [$this, 'afterMove']);
52
-	}
50
+        $server->on('afterMethod:*', [$this, 'afterMethod']);
51
+        $server->on('afterMove', [$this, 'afterMove']);
52
+    }
53 53
 
54
-	/**
55
-	 * After method, copy the "Etag" header to "OC-Etag" header.
56
-	 *
57
-	 * @param RequestInterface $request request
58
-	 * @param ResponseInterface $response response
59
-	 */
60
-	public function afterMethod(RequestInterface $request, ResponseInterface $response) {
61
-		$eTag = $response->getHeader('Etag');
62
-		if (!empty($eTag)) {
63
-			$response->setHeader('OC-ETag', $eTag);
64
-		}
65
-	}
54
+    /**
55
+     * After method, copy the "Etag" header to "OC-Etag" header.
56
+     *
57
+     * @param RequestInterface $request request
58
+     * @param ResponseInterface $response response
59
+     */
60
+    public function afterMethod(RequestInterface $request, ResponseInterface $response) {
61
+        $eTag = $response->getHeader('Etag');
62
+        if (!empty($eTag)) {
63
+            $response->setHeader('OC-ETag', $eTag);
64
+        }
65
+    }
66 66
 
67
-	/**
68
-	 * Called after a node is moved.
69
-	 *
70
-	 * This allows the backend to move all the associated properties.
71
-	 *
72
-	 * @param string $source
73
-	 * @param string $destination
74
-	 * @return void
75
-	 */
76
-	public function afterMove($source, $destination) {
77
-		try {
78
-			$node = $this->server->tree->getNodeForPath($destination);
79
-		} catch (NotFound $e) {
80
-			// Don't care
81
-			return;
82
-		}
67
+    /**
68
+     * Called after a node is moved.
69
+     *
70
+     * This allows the backend to move all the associated properties.
71
+     *
72
+     * @param string $source
73
+     * @param string $destination
74
+     * @return void
75
+     */
76
+    public function afterMove($source, $destination) {
77
+        try {
78
+            $node = $this->server->tree->getNodeForPath($destination);
79
+        } catch (NotFound $e) {
80
+            // Don't care
81
+            return;
82
+        }
83 83
 
84
-		if ($node instanceof File) {
85
-			$eTag = $node->getETag();
86
-			$this->server->httpResponse->setHeader('OC-ETag', $eTag);
87
-			$this->server->httpResponse->setHeader('ETag', $eTag);
88
-		}
89
-	}
84
+        if ($node instanceof File) {
85
+            $eTag = $node->getETag();
86
+            $this->server->httpResponse->setHeader('OC-ETag', $eTag);
87
+            $this->server->httpResponse->setHeader('ETag', $eTag);
88
+        }
89
+    }
90 90
 }
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/IShareable.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -31,41 +31,41 @@
 block discarded – undo
31 31
  */
32 32
 interface IShareable extends INode {
33 33
 
34
-	/**
35
-	 * Updates the list of shares.
36
-	 *
37
-	 * The first array is a list of people that are to be added to the
38
-	 * resource.
39
-	 *
40
-	 * Every element in the add array has the following properties:
41
-	 *   * href - A url. Usually a mailto: address
42
-	 *   * commonName - Usually a first and last name, or false
43
-	 *   * readOnly - A boolean value
44
-	 *
45
-	 * Every element in the remove array is just the address string.
46
-	 *
47
-	 * @param list<array{href: string, commonName: string, readOnly: bool}> $add
48
-	 * @param list<string> $remove
49
-	 */
50
-	public function updateShares(array $add, array $remove): void;
34
+    /**
35
+     * Updates the list of shares.
36
+     *
37
+     * The first array is a list of people that are to be added to the
38
+     * resource.
39
+     *
40
+     * Every element in the add array has the following properties:
41
+     *   * href - A url. Usually a mailto: address
42
+     *   * commonName - Usually a first and last name, or false
43
+     *   * readOnly - A boolean value
44
+     *
45
+     * Every element in the remove array is just the address string.
46
+     *
47
+     * @param list<array{href: string, commonName: string, readOnly: bool}> $add
48
+     * @param list<string> $remove
49
+     */
50
+    public function updateShares(array $add, array $remove): void;
51 51
 
52
-	/**
53
-	 * Returns the list of people whom this resource is shared with.
54
-	 *
55
-	 * Every element in this array should have the following properties:
56
-	 *   * href - Often a mailto: address
57
-	 *   * commonName - Optional, for example a first + last name
58
-	 *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
59
-	 *   * readOnly - boolean
60
-	 *
61
-	 * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
62
-	 */
63
-	public function getShares(): array;
52
+    /**
53
+     * Returns the list of people whom this resource is shared with.
54
+     *
55
+     * Every element in this array should have the following properties:
56
+     *   * href - Often a mailto: address
57
+     *   * commonName - Optional, for example a first + last name
58
+     *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
59
+     *   * readOnly - boolean
60
+     *
61
+     * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
62
+     */
63
+    public function getShares(): array;
64 64
 
65
-	public function getResourceId(): int;
65
+    public function getResourceId(): int;
66 66
 
67
-	/**
68
-	 * @return ?string
69
-	 */
70
-	public function getOwner();
67
+    /**
68
+     * @return ?string
69
+     */
70
+    public function getOwner();
71 71
 }
Please login to merge, or discard this patch.
apps/settings/templates/settings/admin/server.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 /** @var array $_ */
26 26
 
27 27
 script('settings', [
28
-	'vue-settings-admin-basic-settings',
28
+    'vue-settings-admin-basic-settings',
29 29
 ]);
30 30
 ?>
31 31
 
Please login to merge, or discard this patch.
core/Migrations/Version25000Date20220515204012.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@
 block discarded – undo
28 28
 use OCP\Migration\SimpleMigrationStep;
29 29
 
30 30
 class Version25000Date20220515204012 extends SimpleMigrationStep {
31
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
32
-		/** @var ISchemaWrapper $schema */
33
-		$schema = $schemaClosure();
31
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
32
+        /** @var ISchemaWrapper $schema */
33
+        $schema = $schemaClosure();
34 34
 
35
-		if ($schema->hasTable('share')) {
36
-			$shareTable = $schema->getTable('share');
35
+        if ($schema->hasTable('share')) {
36
+            $shareTable = $schema->getTable('share');
37 37
 
38
-			if (!$shareTable->hasColumn('attributes')) {
39
-				$shareTable->addColumn(
40
-					'attributes',
41
-					Types::JSON,
42
-					[
43
-						'default' => null,
44
-						'notnull' => false
45
-					]
46
-				);
47
-			}
48
-		}
38
+            if (!$shareTable->hasColumn('attributes')) {
39
+                $shareTable->addColumn(
40
+                    'attributes',
41
+                    Types::JSON,
42
+                    [
43
+                        'default' => null,
44
+                        'notnull' => false
45
+                    ]
46
+                );
47
+            }
48
+        }
49 49
 
50
-		return $schema;
51
-	}
50
+        return $schema;
51
+    }
52 52
 }
Please login to merge, or discard this patch.
core/Migrations/Version24000Date20220202150027.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
  * Auto-generated migration step: Please modify to your needs!
15 15
  */
16 16
 class Version24000Date20220202150027 extends SimpleMigrationStep {
17
-	/**
18
-	 * @param IOutput $output
19
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
-	 * @param array $options
21
-	 * @return null|ISchemaWrapper
22
-	 */
23
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
24
-		/** @var ISchemaWrapper $schema */
25
-		$schema = $schemaClosure();
17
+    /**
18
+     * @param IOutput $output
19
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
+     * @param array $options
21
+     * @return null|ISchemaWrapper
22
+     */
23
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
24
+        /** @var ISchemaWrapper $schema */
25
+        $schema = $schemaClosure();
26 26
 
27
-		$table = $schema->getTable('mounts');
28
-		if (!$table->hasColumn('mount_provider_class')) {
29
-			$table->addColumn('mount_provider_class', Types::STRING, [
30
-				'notnull' => false,
31
-				'length' => 128,
32
-			]);
33
-			$table->addIndex(['mount_provider_class'], 'mounts_class_index');
34
-			return $schema;
35
-		}
36
-		return null;
37
-	}
27
+        $table = $schema->getTable('mounts');
28
+        if (!$table->hasColumn('mount_provider_class')) {
29
+            $table->addColumn('mount_provider_class', Types::STRING, [
30
+                'notnull' => false,
31
+                'length' => 128,
32
+            ]);
33
+            $table->addIndex(['mount_provider_class'], 'mounts_class_index');
34
+            return $schema;
35
+        }
36
+        return null;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
core/templates/publicshareauth.php 1 patch
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,9 +10,12 @@  discard block
 block discarded – undo
10 10
 	<!-- password prompt form. It should be hidden when we show the email prompt form -->
11 11
 	<?php if (!isset($_['identityOk'])): ?>
12 12
 		<form method="post" id="password-input-form">
13
-	<?php else: ?>
13
+	<?php else {
14
+    : ?>
14 15
 		<form method="post" id="password-input-form" style="display:none;">
15
-	<?php endif; ?>
16
+	<?php endif;
17
+}
18
+?>
16 19
 		<fieldset class="warning">
17 20
 			<?php if (!isset($_['wrongpw'])): ?>
18 21
 				<div class="warning-info"><?php p($l->t('This share is password-protected')); ?></div>
@@ -38,9 +41,12 @@  discard block
 block discarded – undo
38 41
 	<!-- email prompt form. It should initially be hidden -->
39 42
 	<?php if (isset($_['identityOk'])): ?>
40 43
 		<form method="post" id="email-input-form">
41
-	<?php else: ?>
44
+	<?php else {
45
+    : ?>
42 46
 		<form method="post" id="email-input-form" style="display:none;">
43
-	<?php endif; ?>
47
+	<?php endif;
48
+}
49
+?>
44 50
 		<fieldset class="warning">
45 51
 			<div class="warning-info" id="email-prompt"><?php p($l->t('Please type in your email address to request a temporary password')); ?></div>
46 52
 			 <p>
@@ -53,8 +59,11 @@  discard block
 block discarded – undo
53 59
 			<?php if (isset($_['identityOk'])): ?>
54 60
 				<?php if ($_['identityOk']): ?>
55 61
 					<div class="warning-info" id="identification-success"><?php p($l->t('Password sent!')); ?></div>
56
-				<?php else: ?>
57
-					<div class="warning" id="identification-failure"><?php p($l->t('You are not authorized to request a password for this share')); ?></div>
62
+				<?php else {
63
+    : ?>
64
+					<div class="warning" id="identification-failure"><?php p($l->t('You are not authorized to request a password for this share'));
65
+}
66
+?></div>
58 67
 				<?php endif; ?>
59 68
 			<?php endif; ?>
60 69
 		</fieldset>
@@ -73,9 +82,12 @@  discard block
 block discarded – undo
73 82
 				id="request-password-back-button"
74 83
 	<?php if (isset($_['identityOk'])): ?>
75 84
 				style="display:block;">
76
-	<?php else: ?>
85
+	<?php else {
86
+    : ?>
77 87
 				style="display:none;">
78
-	<?php endif; ?>
88
+	<?php endif;
89
+}
90
+?>
79 91
 				<?php p($l->t('Back')); ?></a>
80 92
 		</fieldset>
81 93
 	</form>
Please login to merge, or discard this patch.
core/templates/loginflow/grant.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
 	<h2><?php p($l->t('Account access')) ?></h2>
32 32
 	<p class="info">
33 33
 		<?php p($l->t('Currently logged in as %1$s (%2$s).', [
34
-			$_['userDisplayName'],
35
-			$_['userId'],
36
-		])) ?>
34
+            $_['userDisplayName'],
35
+            $_['userId'],
36
+        ])) ?>
37 37
 	</p>
38 38
 	<p class="info">
39 39
 		<?php print_unescaped($l->t('You are about to grant %1$s access to your %2$s account.', [
40
-			'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
41
-			\OCP\Util::sanitizeHTML($_['instanceName'])
42
-		])) ?>
40
+            '<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
41
+            \OCP\Util::sanitizeHTML($_['instanceName'])
42
+        ])) ?>
43 43
 	</p>
44 44
 
45 45
 	<br/>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	</p>
38 38
 	<p class="info">
39 39
 		<?php print_unescaped($l->t('You are about to grant %1$s access to your %2$s account.', [
40
-			'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
40
+			'<strong>'.\OCP\Util::sanitizeHTML($_['client']).'</strong>',
41 41
 			\OCP\Util::sanitizeHTML($_['instanceName'])
42 42
 		])) ?>
43 43
 	</p>
Please login to merge, or discard this patch.