Passed
Push — master ( b67ac4...89cf1c )
by Joas
15:14 queued 12s
created
apps/dav/lib/BackgroundJob/EventReminderJob.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -25,40 +25,40 @@
 block discarded – undo
25 25
 
26 26
 class EventReminderJob extends TimedJob {
27 27
 
28
-	/** @var ReminderService */
29
-	private $reminderService;
28
+    /** @var ReminderService */
29
+    private $reminderService;
30 30
 
31
-	/** @var IConfig */
32
-	private $config;
31
+    /** @var IConfig */
32
+    private $config;
33 33
 
34
-	/**
35
-	 * EventReminderJob constructor.
36
-	 *
37
-	 * @param ReminderService $reminderService
38
-	 * @param IConfig $config
39
-	 */
40
-	public function __construct(ReminderService $reminderService, IConfig $config) {
41
-		$this->reminderService = $reminderService;
42
-		$this->config = $config;
43
-		/** Run every 5 minutes */
44
-		$this->setInterval(5);
45
-	}
34
+    /**
35
+     * EventReminderJob constructor.
36
+     *
37
+     * @param ReminderService $reminderService
38
+     * @param IConfig $config
39
+     */
40
+    public function __construct(ReminderService $reminderService, IConfig $config) {
41
+        $this->reminderService = $reminderService;
42
+        $this->config = $config;
43
+        /** Run every 5 minutes */
44
+        $this->setInterval(5);
45
+    }
46 46
 
47
-	/**
48
-	 * @param $arg
49
-	 * @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
50
-	 * @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
51
-	 * @throws \OC\User\NoUserException
52
-	 */
53
-	public function run($arg):void {
54
-		if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
55
-			return;
56
-		}
47
+    /**
48
+     * @param $arg
49
+     * @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
50
+     * @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
51
+     * @throws \OC\User\NoUserException
52
+     */
53
+    public function run($arg):void {
54
+        if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
55
+            return;
56
+        }
57 57
 
58
-		if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'backgroundjob') {
59
-			return;
60
-		}
58
+        if ($this->config->getAppValue('dav', 'sendEventRemindersMode', 'backgroundjob') !== 'backgroundjob') {
59
+            return;
60
+        }
61 61
 
62
-		$this->reminderService->processReminders();
63
-	}
62
+        $this->reminderService->processReminders();
63
+    }
64 64
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -31,51 +31,51 @@
 block discarded – undo
31 31
  */
32 32
 class NotificationProviderManager {
33 33
 
34
-	/** @var INotificationProvider[] */
35
-	private $providers = [];
34
+    /** @var INotificationProvider[] */
35
+    private $providers = [];
36 36
 
37
-	/**
38
-	 * Checks whether a provider for a given ACTION exists
39
-	 *
40
-	 * @param string $type
41
-	 * @return bool
42
-	 */
43
-	public function hasProvider(string $type):bool {
44
-		return (\in_array($type, ReminderService::REMINDER_TYPES, true)
45
-			&& isset($this->providers[$type]));
46
-	}
37
+    /**
38
+     * Checks whether a provider for a given ACTION exists
39
+     *
40
+     * @param string $type
41
+     * @return bool
42
+     */
43
+    public function hasProvider(string $type):bool {
44
+        return (\in_array($type, ReminderService::REMINDER_TYPES, true)
45
+            && isset($this->providers[$type]));
46
+    }
47 47
 
48
-	/**
49
-	 * Get provider for a given ACTION
50
-	 *
51
-	 * @param string $type
52
-	 * @return INotificationProvider
53
-	 * @throws NotificationProvider\ProviderNotAvailableException
54
-	 * @throws NotificationTypeDoesNotExistException
55
-	 */
56
-	public function getProvider(string $type):INotificationProvider {
57
-		if (in_array($type, ReminderService::REMINDER_TYPES, true)) {
58
-			if (isset($this->providers[$type])) {
59
-				return $this->providers[$type];
60
-			}
61
-			throw new NotificationProvider\ProviderNotAvailableException($type);
62
-		}
63
-		throw new NotificationTypeDoesNotExistException($type);
64
-	}
48
+    /**
49
+     * Get provider for a given ACTION
50
+     *
51
+     * @param string $type
52
+     * @return INotificationProvider
53
+     * @throws NotificationProvider\ProviderNotAvailableException
54
+     * @throws NotificationTypeDoesNotExistException
55
+     */
56
+    public function getProvider(string $type):INotificationProvider {
57
+        if (in_array($type, ReminderService::REMINDER_TYPES, true)) {
58
+            if (isset($this->providers[$type])) {
59
+                return $this->providers[$type];
60
+            }
61
+            throw new NotificationProvider\ProviderNotAvailableException($type);
62
+        }
63
+        throw new NotificationTypeDoesNotExistException($type);
64
+    }
65 65
 
66
-	/**
67
-	 * Registers a new provider
68
-	 *
69
-	 * @param string $providerClassName
70
-	 * @throws \OCP\AppFramework\QueryException
71
-	 */
72
-	public function registerProvider(string $providerClassName):void {
73
-		$provider = \OC::$server->query($providerClassName);
66
+    /**
67
+     * Registers a new provider
68
+     *
69
+     * @param string $providerClassName
70
+     * @throws \OCP\AppFramework\QueryException
71
+     */
72
+    public function registerProvider(string $providerClassName):void {
73
+        $provider = \OC::$server->query($providerClassName);
74 74
 
75
-		if (!$provider instanceof INotificationProvider) {
76
-			throw new \InvalidArgumentException('Invalid notification provider registered');
77
-		}
75
+        if (!$provider instanceof INotificationProvider) {
76
+            throw new \InvalidArgumentException('Invalid notification provider registered');
77
+        }
78 78
 
79
-		$this->providers[$provider::NOTIFICATION_TYPE] = $provider;
80
-	}
79
+        $this->providers[$provider::NOTIFICATION_TYPE] = $provider;
80
+    }
81 81
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@
 block discarded – undo
26 26
 
27 27
 class NotificationTypeDoesNotExistException extends \Exception {
28 28
 
29
-	/**
30
-	 * NotificationTypeDoesNotExistException constructor.
31
-	 *
32
-	 * @since 16.0.0
33
-	 *
34
-	 * @param string $type ReminderType
35
-	 */
36
-	public function __construct(string $type) {
37
-		parent::__construct("Type $type is not an accepted type of notification");
38
-	}
29
+    /**
30
+     * NotificationTypeDoesNotExistException constructor.
31
+     *
32
+     * @since 16.0.0
33
+     *
34
+     * @param string $type ReminderType
35
+     */
36
+    public function __construct(string $type) {
37
+        parent::__construct("Type $type is not an accepted type of notification");
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@
 block discarded – undo
25 25
 
26 26
 class ProviderNotAvailableException extends \Exception {
27 27
 
28
-	/**
29
-	 * ProviderNotAvailableException constructor.
30
-	 *
31
-	 * @since 16.0.0
32
-	 *
33
-	 * @param string $type ReminderType
34
-	 */
35
-	public function __construct(string $type) {
36
-		parent::__construct("No notification provider for type $type available");
37
-	}
28
+    /**
29
+     * ProviderNotAvailableException constructor.
30
+     *
31
+     * @since 16.0.0
32
+     *
33
+     * @param string $type ReminderType
34
+     */
35
+    public function __construct(string $type) {
36
+        parent::__construct("No notification provider for type $type available");
37
+    }
38 38
 
39 39
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Reminder/NotificationProvider/AudioProvider.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,6 +32,6 @@
 block discarded – undo
32 32
  */
33 33
 class AudioProvider extends PushProvider {
34 34
 
35
-	/** @var string */
36
-	public const NOTIFICATION_TYPE = 'AUDIO';
35
+    /** @var string */
36
+    public const NOTIFICATION_TYPE = 'AUDIO';
37 37
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Reminder/Backend.php 1 patch
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -35,185 +35,185 @@
 block discarded – undo
35 35
  */
36 36
 class Backend {
37 37
 
38
-	/** @var IDBConnection */
39
-	protected $db;
40
-
41
-	/** @var ITimeFactory */
42
-	private $timeFactory;
43
-
44
-	/**
45
-	 * Backend constructor.
46
-	 *
47
-	 * @param IDBConnection $db
48
-	 * @param ITimeFactory $timeFactory
49
-	 */
50
-	public function __construct(IDBConnection $db,
51
-								ITimeFactory $timeFactory) {
52
-		$this->db = $db;
53
-		$this->timeFactory = $timeFactory;
54
-	}
55
-
56
-	/**
57
-	 * Get all reminders with a notification date before now
58
-	 *
59
-	 * @return array
60
-	 * @throws \Exception
61
-	 */
62
-	public function getRemindersToProcess():array {
63
-		$query = $this->db->getQueryBuilder();
64
-		$query->select(['cr.*', 'co.calendardata', 'c.displayname', 'c.principaluri'])
65
-			->from('calendar_reminders', 'cr')
66
-			->where($query->expr()->lte('cr.notification_date', $query->createNamedParameter($this->timeFactory->getTime())))
67
-			->leftJoin('cr', 'calendarobjects', 'co', $query->expr()->eq('cr.object_id', 'co.id'))
68
-			->leftJoin('cr', 'calendars', 'c', $query->expr()->eq('cr.calendar_id', 'c.id'));
69
-		$stmt = $query->execute();
70
-
71
-		return array_map(
72
-			[$this, 'fixRowTyping'],
73
-			$stmt->fetchAll()
74
-		);
75
-	}
76
-
77
-	/**
78
-	 * Get all scheduled reminders for an event
79
-	 *
80
-	 * @param int $objectId
81
-	 * @return array
82
-	 */
83
-	public function getAllScheduledRemindersForEvent(int $objectId):array {
84
-		$query = $this->db->getQueryBuilder();
85
-		$query->select('*')
86
-			->from('calendar_reminders')
87
-			->where($query->expr()->eq('object_id', $query->createNamedParameter($objectId)));
88
-		$stmt = $query->execute();
89
-
90
-		return array_map(
91
-			[$this, 'fixRowTyping'],
92
-			$stmt->fetchAll()
93
-		);
94
-	}
95
-
96
-	/**
97
-	 * Insert a new reminder into the database
98
-	 *
99
-	 * @param int $calendarId
100
-	 * @param int $objectId
101
-	 * @param string $uid
102
-	 * @param bool $isRecurring
103
-	 * @param int $recurrenceId
104
-	 * @param bool $isRecurrenceException
105
-	 * @param string $eventHash
106
-	 * @param string $alarmHash
107
-	 * @param string $type
108
-	 * @param bool $isRelative
109
-	 * @param int $notificationDate
110
-	 * @param bool $isRepeatBased
111
-	 * @return int The insert id
112
-	 */
113
-	public function insertReminder(int $calendarId,
114
-								   int $objectId,
115
-								   string $uid,
116
-								   bool $isRecurring,
117
-								   int $recurrenceId,
118
-								   bool $isRecurrenceException,
119
-								   string $eventHash,
120
-								   string $alarmHash,
121
-								   string $type,
122
-								   bool $isRelative,
123
-								   int $notificationDate,
124
-								   bool $isRepeatBased):int {
125
-		$query = $this->db->getQueryBuilder();
126
-		$query->insert('calendar_reminders')
127
-			->values([
128
-				'calendar_id' => $query->createNamedParameter($calendarId),
129
-				'object_id' => $query->createNamedParameter($objectId),
130
-				'uid' => $query->createNamedParameter($uid),
131
-				'is_recurring' => $query->createNamedParameter($isRecurring ? 1 : 0),
132
-				'recurrence_id' => $query->createNamedParameter($recurrenceId),
133
-				'is_recurrence_exception' => $query->createNamedParameter($isRecurrenceException ? 1 : 0),
134
-				'event_hash' => $query->createNamedParameter($eventHash),
135
-				'alarm_hash' => $query->createNamedParameter($alarmHash),
136
-				'type' => $query->createNamedParameter($type),
137
-				'is_relative' => $query->createNamedParameter($isRelative ? 1 : 0),
138
-				'notification_date' => $query->createNamedParameter($notificationDate),
139
-				'is_repeat_based' => $query->createNamedParameter($isRepeatBased ? 1 : 0),
140
-			])
141
-			->execute();
142
-
143
-		return $query->getLastInsertId();
144
-	}
145
-
146
-	/**
147
-	 * Sets a new notificationDate on an existing reminder
148
-	 *
149
-	 * @param int $reminderId
150
-	 * @param int $newNotificationDate
151
-	 */
152
-	public function updateReminder(int $reminderId,
153
-								   int $newNotificationDate):void {
154
-		$query = $this->db->getQueryBuilder();
155
-		$query->update('calendar_reminders')
156
-			->set('notification_date', $query->createNamedParameter($newNotificationDate))
157
-			->where($query->expr()->eq('id', $query->createNamedParameter($reminderId)))
158
-			->execute();
159
-	}
160
-
161
-	/**
162
-	 * Remove a reminder by it's id
163
-	 *
164
-	 * @param integer $reminderId
165
-	 * @return void
166
-	 */
167
-	public function removeReminder(int $reminderId):void {
168
-		$query = $this->db->getQueryBuilder();
169
-
170
-		$query->delete('calendar_reminders')
171
-			->where($query->expr()->eq('id', $query->createNamedParameter($reminderId)))
172
-			->execute();
173
-	}
174
-
175
-	/**
176
-	 * Cleans reminders in database
177
-	 *
178
-	 * @param int $objectId
179
-	 */
180
-	public function cleanRemindersForEvent(int $objectId):void {
181
-		$query = $this->db->getQueryBuilder();
182
-
183
-		$query->delete('calendar_reminders')
184
-			->where($query->expr()->eq('object_id', $query->createNamedParameter($objectId)))
185
-			->execute();
186
-	}
187
-
188
-	/**
189
-	 * Remove all reminders for a calendar
190
-	 *
191
-	 * @param int $calendarId
192
-	 * @return void
193
-	 */
194
-	public function cleanRemindersForCalendar(int $calendarId):void {
195
-		$query = $this->db->getQueryBuilder();
196
-
197
-		$query->delete('calendar_reminders')
198
-			->where($query->expr()->eq('calendar_id', $query->createNamedParameter($calendarId)))
199
-			->execute();
200
-	}
201
-
202
-	/**
203
-	 * @param array $row
204
-	 * @return array
205
-	 */
206
-	private function fixRowTyping(array $row): array {
207
-		$row['id'] = (int) $row['id'];
208
-		$row['calendar_id'] = (int) $row['calendar_id'];
209
-		$row['object_id'] = (int) $row['object_id'];
210
-		$row['is_recurring'] = (bool) $row['is_recurring'];
211
-		$row['recurrence_id'] = (int) $row['recurrence_id'];
212
-		$row['is_recurrence_exception'] = (bool) $row['is_recurrence_exception'];
213
-		$row['is_relative'] = (bool) $row['is_relative'];
214
-		$row['notification_date'] = (int) $row['notification_date'];
215
-		$row['is_repeat_based'] = (bool) $row['is_repeat_based'];
216
-
217
-		return $row;
218
-	}
38
+    /** @var IDBConnection */
39
+    protected $db;
40
+
41
+    /** @var ITimeFactory */
42
+    private $timeFactory;
43
+
44
+    /**
45
+     * Backend constructor.
46
+     *
47
+     * @param IDBConnection $db
48
+     * @param ITimeFactory $timeFactory
49
+     */
50
+    public function __construct(IDBConnection $db,
51
+                                ITimeFactory $timeFactory) {
52
+        $this->db = $db;
53
+        $this->timeFactory = $timeFactory;
54
+    }
55
+
56
+    /**
57
+     * Get all reminders with a notification date before now
58
+     *
59
+     * @return array
60
+     * @throws \Exception
61
+     */
62
+    public function getRemindersToProcess():array {
63
+        $query = $this->db->getQueryBuilder();
64
+        $query->select(['cr.*', 'co.calendardata', 'c.displayname', 'c.principaluri'])
65
+            ->from('calendar_reminders', 'cr')
66
+            ->where($query->expr()->lte('cr.notification_date', $query->createNamedParameter($this->timeFactory->getTime())))
67
+            ->leftJoin('cr', 'calendarobjects', 'co', $query->expr()->eq('cr.object_id', 'co.id'))
68
+            ->leftJoin('cr', 'calendars', 'c', $query->expr()->eq('cr.calendar_id', 'c.id'));
69
+        $stmt = $query->execute();
70
+
71
+        return array_map(
72
+            [$this, 'fixRowTyping'],
73
+            $stmt->fetchAll()
74
+        );
75
+    }
76
+
77
+    /**
78
+     * Get all scheduled reminders for an event
79
+     *
80
+     * @param int $objectId
81
+     * @return array
82
+     */
83
+    public function getAllScheduledRemindersForEvent(int $objectId):array {
84
+        $query = $this->db->getQueryBuilder();
85
+        $query->select('*')
86
+            ->from('calendar_reminders')
87
+            ->where($query->expr()->eq('object_id', $query->createNamedParameter($objectId)));
88
+        $stmt = $query->execute();
89
+
90
+        return array_map(
91
+            [$this, 'fixRowTyping'],
92
+            $stmt->fetchAll()
93
+        );
94
+    }
95
+
96
+    /**
97
+     * Insert a new reminder into the database
98
+     *
99
+     * @param int $calendarId
100
+     * @param int $objectId
101
+     * @param string $uid
102
+     * @param bool $isRecurring
103
+     * @param int $recurrenceId
104
+     * @param bool $isRecurrenceException
105
+     * @param string $eventHash
106
+     * @param string $alarmHash
107
+     * @param string $type
108
+     * @param bool $isRelative
109
+     * @param int $notificationDate
110
+     * @param bool $isRepeatBased
111
+     * @return int The insert id
112
+     */
113
+    public function insertReminder(int $calendarId,
114
+                                    int $objectId,
115
+                                    string $uid,
116
+                                    bool $isRecurring,
117
+                                    int $recurrenceId,
118
+                                    bool $isRecurrenceException,
119
+                                    string $eventHash,
120
+                                    string $alarmHash,
121
+                                    string $type,
122
+                                    bool $isRelative,
123
+                                    int $notificationDate,
124
+                                    bool $isRepeatBased):int {
125
+        $query = $this->db->getQueryBuilder();
126
+        $query->insert('calendar_reminders')
127
+            ->values([
128
+                'calendar_id' => $query->createNamedParameter($calendarId),
129
+                'object_id' => $query->createNamedParameter($objectId),
130
+                'uid' => $query->createNamedParameter($uid),
131
+                'is_recurring' => $query->createNamedParameter($isRecurring ? 1 : 0),
132
+                'recurrence_id' => $query->createNamedParameter($recurrenceId),
133
+                'is_recurrence_exception' => $query->createNamedParameter($isRecurrenceException ? 1 : 0),
134
+                'event_hash' => $query->createNamedParameter($eventHash),
135
+                'alarm_hash' => $query->createNamedParameter($alarmHash),
136
+                'type' => $query->createNamedParameter($type),
137
+                'is_relative' => $query->createNamedParameter($isRelative ? 1 : 0),
138
+                'notification_date' => $query->createNamedParameter($notificationDate),
139
+                'is_repeat_based' => $query->createNamedParameter($isRepeatBased ? 1 : 0),
140
+            ])
141
+            ->execute();
142
+
143
+        return $query->getLastInsertId();
144
+    }
145
+
146
+    /**
147
+     * Sets a new notificationDate on an existing reminder
148
+     *
149
+     * @param int $reminderId
150
+     * @param int $newNotificationDate
151
+     */
152
+    public function updateReminder(int $reminderId,
153
+                                    int $newNotificationDate):void {
154
+        $query = $this->db->getQueryBuilder();
155
+        $query->update('calendar_reminders')
156
+            ->set('notification_date', $query->createNamedParameter($newNotificationDate))
157
+            ->where($query->expr()->eq('id', $query->createNamedParameter($reminderId)))
158
+            ->execute();
159
+    }
160
+
161
+    /**
162
+     * Remove a reminder by it's id
163
+     *
164
+     * @param integer $reminderId
165
+     * @return void
166
+     */
167
+    public function removeReminder(int $reminderId):void {
168
+        $query = $this->db->getQueryBuilder();
169
+
170
+        $query->delete('calendar_reminders')
171
+            ->where($query->expr()->eq('id', $query->createNamedParameter($reminderId)))
172
+            ->execute();
173
+    }
174
+
175
+    /**
176
+     * Cleans reminders in database
177
+     *
178
+     * @param int $objectId
179
+     */
180
+    public function cleanRemindersForEvent(int $objectId):void {
181
+        $query = $this->db->getQueryBuilder();
182
+
183
+        $query->delete('calendar_reminders')
184
+            ->where($query->expr()->eq('object_id', $query->createNamedParameter($objectId)))
185
+            ->execute();
186
+    }
187
+
188
+    /**
189
+     * Remove all reminders for a calendar
190
+     *
191
+     * @param int $calendarId
192
+     * @return void
193
+     */
194
+    public function cleanRemindersForCalendar(int $calendarId):void {
195
+        $query = $this->db->getQueryBuilder();
196
+
197
+        $query->delete('calendar_reminders')
198
+            ->where($query->expr()->eq('calendar_id', $query->createNamedParameter($calendarId)))
199
+            ->execute();
200
+    }
201
+
202
+    /**
203
+     * @param array $row
204
+     * @return array
205
+     */
206
+    private function fixRowTyping(array $row): array {
207
+        $row['id'] = (int) $row['id'];
208
+        $row['calendar_id'] = (int) $row['calendar_id'];
209
+        $row['object_id'] = (int) $row['object_id'];
210
+        $row['is_recurring'] = (bool) $row['is_recurring'];
211
+        $row['recurrence_id'] = (int) $row['recurrence_id'];
212
+        $row['is_recurrence_exception'] = (bool) $row['is_recurrence_exception'];
213
+        $row['is_relative'] = (bool) $row['is_relative'];
214
+        $row['notification_date'] = (int) $row['notification_date'];
215
+        $row['is_repeat_based'] = (bool) $row['is_repeat_based'];
216
+
217
+        return $row;
218
+    }
219 219
 }
Please login to merge, or discard this patch.
lib/private/Repair/NC16/ClearCollectionsAccessCache.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@
 block discarded – undo
30 30
 
31 31
 class ClearCollectionsAccessCache implements IRepairStep {
32 32
 
33
-	/** @var IConfig */
34
-	private $config;
35
-
36
-	/** @var IManager|Manager */
37
-	private $manager;
38
-
39
-	public function __construct(IConfig $config, IManager $manager) {
40
-		$this->config = $config;
41
-		$this->manager = $manager;
42
-	}
43
-
44
-	public function getName(): string {
45
-		return 'Clear access cache of projects';
46
-	}
47
-
48
-	private function shouldRun(): bool {
49
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
50
-		return version_compare($versionFromBeforeUpdate, '17.0.0.3', '<=');
51
-	}
52
-
53
-	public function run(IOutput $output): void {
54
-		if ($this->shouldRun()) {
55
-			$this->manager->invalidateAccessCacheForAllCollections();
56
-		}
57
-	}
33
+    /** @var IConfig */
34
+    private $config;
35
+
36
+    /** @var IManager|Manager */
37
+    private $manager;
38
+
39
+    public function __construct(IConfig $config, IManager $manager) {
40
+        $this->config = $config;
41
+        $this->manager = $manager;
42
+    }
43
+
44
+    public function getName(): string {
45
+        return 'Clear access cache of projects';
46
+    }
47
+
48
+    private function shouldRun(): bool {
49
+        $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
50
+        return version_compare($versionFromBeforeUpdate, '17.0.0.3', '<=');
51
+    }
52
+
53
+    public function run(IOutput $output): void {
54
+        if ($this->shouldRun()) {
55
+            $this->manager->invalidateAccessCacheForAllCollections();
56
+        }
57
+    }
58 58
 }
Please login to merge, or discard this patch.
lib/private/Security/RateLimiting/Limiter.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -31,73 +31,73 @@
 block discarded – undo
31 31
 use OCP\IUser;
32 32
 
33 33
 class Limiter {
34
-	/** @var IBackend */
35
-	private $backend;
36
-	/** @var ITimeFactory */
37
-	private $timeFactory;
34
+    /** @var IBackend */
35
+    private $backend;
36
+    /** @var ITimeFactory */
37
+    private $timeFactory;
38 38
 
39
-	/**
40
-	 * @param ITimeFactory $timeFactory
41
-	 * @param IBackend $backend
42
-	 */
43
-	public function __construct(ITimeFactory $timeFactory,
44
-								IBackend $backend) {
45
-		$this->backend = $backend;
46
-		$this->timeFactory = $timeFactory;
47
-	}
39
+    /**
40
+     * @param ITimeFactory $timeFactory
41
+     * @param IBackend $backend
42
+     */
43
+    public function __construct(ITimeFactory $timeFactory,
44
+                                IBackend $backend) {
45
+        $this->backend = $backend;
46
+        $this->timeFactory = $timeFactory;
47
+    }
48 48
 
49
-	/**
50
-	 * @param string $methodIdentifier
51
-	 * @param string $userIdentifier
52
-	 * @param int $period
53
-	 * @param int $limit
54
-	 * @throws RateLimitExceededException
55
-	 */
56
-	private function register(string $methodIdentifier,
57
-							  string $userIdentifier,
58
-							  int $period,
59
-							  int $limit): void {
60
-		$existingAttempts = $this->backend->getAttempts($methodIdentifier, $userIdentifier, $period);
61
-		if ($existingAttempts >= $limit) {
62
-			throw new RateLimitExceededException();
63
-		}
49
+    /**
50
+     * @param string $methodIdentifier
51
+     * @param string $userIdentifier
52
+     * @param int $period
53
+     * @param int $limit
54
+     * @throws RateLimitExceededException
55
+     */
56
+    private function register(string $methodIdentifier,
57
+                                string $userIdentifier,
58
+                                int $period,
59
+                                int $limit): void {
60
+        $existingAttempts = $this->backend->getAttempts($methodIdentifier, $userIdentifier, $period);
61
+        if ($existingAttempts >= $limit) {
62
+            throw new RateLimitExceededException();
63
+        }
64 64
 
65
-		$this->backend->registerAttempt($methodIdentifier, $userIdentifier, $this->timeFactory->getTime());
66
-	}
65
+        $this->backend->registerAttempt($methodIdentifier, $userIdentifier, $this->timeFactory->getTime());
66
+    }
67 67
 
68
-	/**
69
-	 * Registers attempt for an anonymous request
70
-	 *
71
-	 * @param string $identifier
72
-	 * @param int $anonLimit
73
-	 * @param int $anonPeriod
74
-	 * @param string $ip
75
-	 * @throws RateLimitExceededException
76
-	 */
77
-	public function registerAnonRequest(string $identifier,
78
-										int $anonLimit,
79
-										int $anonPeriod,
80
-										string $ip): void {
81
-		$ipSubnet = (new IpAddress($ip))->getSubnet();
68
+    /**
69
+     * Registers attempt for an anonymous request
70
+     *
71
+     * @param string $identifier
72
+     * @param int $anonLimit
73
+     * @param int $anonPeriod
74
+     * @param string $ip
75
+     * @throws RateLimitExceededException
76
+     */
77
+    public function registerAnonRequest(string $identifier,
78
+                                        int $anonLimit,
79
+                                        int $anonPeriod,
80
+                                        string $ip): void {
81
+        $ipSubnet = (new IpAddress($ip))->getSubnet();
82 82
 
83
-		$anonHashIdentifier = hash('sha512', 'anon::' . $identifier . $ipSubnet);
84
-		$this->register($identifier, $anonHashIdentifier, $anonPeriod, $anonLimit);
85
-	}
83
+        $anonHashIdentifier = hash('sha512', 'anon::' . $identifier . $ipSubnet);
84
+        $this->register($identifier, $anonHashIdentifier, $anonPeriod, $anonLimit);
85
+    }
86 86
 
87
-	/**
88
-	 * Registers attempt for an authenticated request
89
-	 *
90
-	 * @param string $identifier
91
-	 * @param int $userLimit
92
-	 * @param int $userPeriod
93
-	 * @param IUser $user
94
-	 * @throws RateLimitExceededException
95
-	 */
96
-	public function registerUserRequest(string $identifier,
97
-										int $userLimit,
98
-										int $userPeriod,
99
-										IUser $user): void {
100
-		$userHashIdentifier = hash('sha512', 'user::' . $identifier . $user->getUID());
101
-		$this->register($identifier, $userHashIdentifier, $userPeriod, $userLimit);
102
-	}
87
+    /**
88
+     * Registers attempt for an authenticated request
89
+     *
90
+     * @param string $identifier
91
+     * @param int $userLimit
92
+     * @param int $userPeriod
93
+     * @param IUser $user
94
+     * @throws RateLimitExceededException
95
+     */
96
+    public function registerUserRequest(string $identifier,
97
+                                        int $userLimit,
98
+                                        int $userPeriod,
99
+                                        IUser $user): void {
100
+        $userHashIdentifier = hash('sha512', 'user::' . $identifier . $user->getUID());
101
+        $this->register($identifier, $userHashIdentifier, $userPeriod, $userLimit);
102
+    }
103 103
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Utility/IControllerMethodReflector.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -35,39 +35,39 @@
 block discarded – undo
35 35
  */
36 36
 interface IControllerMethodReflector {
37 37
 
38
-	/**
39
-	 * @param object $object an object or classname
40
-	 * @param string $method the method which we want to inspect
41
-	 * @return void
42
-	 * @since 8.0.0
43
-	 * @deprecated 17.0.0 Reflect should not be called multiple times and only be used internally. This will be removed in Nextcloud 18
44
-	 */
45
-	public function reflect($object, string $method);
38
+    /**
39
+     * @param object $object an object or classname
40
+     * @param string $method the method which we want to inspect
41
+     * @return void
42
+     * @since 8.0.0
43
+     * @deprecated 17.0.0 Reflect should not be called multiple times and only be used internally. This will be removed in Nextcloud 18
44
+     */
45
+    public function reflect($object, string $method);
46 46
 
47
-	/**
48
-	 * Inspects the PHPDoc parameters for types
49
-	 *
50
-	 * @param string $parameter the parameter whose type comments should be
51
-	 * parsed
52
-	 * @return string|null type in the type parameters (@param int $something)
53
-	 * would return int or null if not existing
54
-	 * @since 8.0.0
55
-	 */
56
-	public function getType(string $parameter);
47
+    /**
48
+     * Inspects the PHPDoc parameters for types
49
+     *
50
+     * @param string $parameter the parameter whose type comments should be
51
+     * parsed
52
+     * @return string|null type in the type parameters (@param int $something)
53
+     * would return int or null if not existing
54
+     * @since 8.0.0
55
+     */
56
+    public function getType(string $parameter);
57 57
 
58
-	/**
59
-	 * @return array the arguments of the method with key => default value
60
-	 * @since 8.0.0
61
-	 */
62
-	public function getParameters(): array;
58
+    /**
59
+     * @return array the arguments of the method with key => default value
60
+     * @since 8.0.0
61
+     */
62
+    public function getParameters(): array;
63 63
 
64
-	/**
65
-	 * Check if a method contains an annotation
66
-	 *
67
-	 * @param string $name the name of the annotation
68
-	 * @return bool true if the annotation is found
69
-	 * @since 8.0.0
70
-	 */
71
-	public function hasAnnotation(string $name): bool;
64
+    /**
65
+     * Check if a method contains an annotation
66
+     *
67
+     * @param string $name the name of the annotation
68
+     * @return bool true if the annotation is found
69
+     * @since 8.0.0
70
+     */
71
+    public function hasAnnotation(string $name): bool;
72 72
 
73 73
 }
Please login to merge, or discard this patch.