Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created
src/Webtrees/Module/AdminTasks/Contracts/TaskInterface.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
  */
20 20
 interface TaskInterface
21 21
 {
22
-    /**
23
-     * Display name of the task
24
-     *
25
-     * @return string
26
-     */
27
-    public function name(): string;
22
+	/**
23
+	 * Display name of the task
24
+	 *
25
+	 * @return string
26
+	 */
27
+	public function name(): string;
28 28
     
29
-    /**
30
-     * Return the default frequency for the execution of the task, in minutes.
31
-     *
32
-     * @return int Frequency for the execution of the task
33
-     */
34
-    public function defaultFrequency(): int;
29
+	/**
30
+	 * Return the default frequency for the execution of the task, in minutes.
31
+	 *
32
+	 * @return int Frequency for the execution of the task
33
+	 */
34
+	public function defaultFrequency(): int;
35 35
     
36
-    /**
37
-     * Run the task's actions, and return whether the execution has been successful.
38
-     *
39
-     * @param TaskSchedule $task_schedule
40
-     * @return bool Has the execution been a success
41
-     */
42
-    public function run(TaskSchedule $task_schedule): bool;
36
+	/**
37
+	 * Run the task's actions, and return whether the execution has been successful.
38
+	 *
39
+	 * @param TaskSchedule $task_schedule
40
+	 * @return bool Has the execution been a success
41
+	 */
42
+	public function run(TaskSchedule $task_schedule): bool;
43 43
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Contracts/ModuleTasksProviderInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
20 20
 interface ModuleTasksProviderInterface
21 21
 {
22 22
     
23
-    /**
24
-     * List tasks provided by the module as an associative array.
25
-     * They keys are used as task IDs for storage and reference.
26
-     *
27
-     * @return array<string, string> List of tasks
28
-     */
29
-    public function listTasks(): array;
23
+	/**
24
+	 * List tasks provided by the module as an associative array.
25
+	 * They keys are used as task IDs for storage and reference.
26
+	 *
27
+	 * @return array<string, string> List of tasks
28
+	 */
29
+	public function listTasks(): array;
30 30
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -25,117 +25,117 @@
 block discarded – undo
25 25
 class LineageNode
26 26
 {
27 27
 
28
-    /**
29
-     * @var Collection $linked_fams Spouse families linked to the node
30
-     */
31
-    private $linked_fams;
32
-
33
-    /**
34
-     * @var ?Individual $node_indi Reference individual for the node
35
-     */
36
-    private $node_indi;
37
-
38
-    /**
39
-     * @var LineageRootNode $root_node Root node of the lineage
40
-     */
41
-    private $root_node;
42
-
43
-    /**
44
-     * @var ?string $alt_surname Linked surname, used to link to another lineage
45
-     */
46
-    private $alt_surname;
47
-
48
-    /**
49
-     * Constructor for Lineage node
50
-     *
51
-     * @param Individual $node_indi Main individual
52
-     * @param LineageRootNode $root_node Node of the lineage root
53
-     * @param null|string $alt_surname Follow-up surname
54
-     */
55
-    public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null)
56
-    {
57
-        $this->node_indi = $node_indi;
58
-        $this->root_node = $root_node;
59
-        $this->alt_surname = $alt_surname;
60
-        $this->linked_fams = new Collection();
61
-    }
62
-
63
-    /**
64
-     * Add a spouse family to the node
65
-     *
66
-     * @param Family $fams
67
-     * @return stdClass
68
-     */
69
-    public function addFamily(Family $fams): object
70
-    {
71
-        if (!$this->linked_fams->has($fams->xref())) {
72
-            $this->linked_fams->put($fams->xref(), (object) [
73
-                'family'   =>  $fams,
74
-                'children' =>  new Collection()
75
-            ]);
76
-        }
77
-        return $this->linked_fams->get($fams->xref());
78
-    }
79
-
80
-    /**
81
-     * Add a child LineageNode to the node
82
-     *
83
-     * @param Family $fams
84
-     * @param LineageNode $child
85
-     */
86
-    public function addChild(Family $fams, LineageNode $child = null): void
87
-    {
88
-        $this->addFamily($fams)->children->push($child);
89
-        $this->root_node->incrementChildNodes();
90
-    }
91
-
92
-    /**
93
-     * Returns the node individual
94
-     *
95
-     * @return Individual|NULL
96
-     */
97
-    public function individual(): ?Individual
98
-    {
99
-        return $this->node_indi;
100
-    }
101
-
102
-    /**
103
-     * Returns the lineage root node individual
104
-     *
105
-     * @return LineageRootNode
106
-     */
107
-    public function rootNode(): LineageRootNode
108
-    {
109
-        return $this->root_node;
110
-    }
111
-
112
-    /**
113
-     * Returns the spouse families linked to the node
114
-     *
115
-     * @return Collection
116
-     */
117
-    public function families(): Collection
118
-    {
119
-        return $this->linked_fams;
120
-    }
121
-
122
-    /**
123
-     * Returns the follow-up surname
124
-     *
125
-     * @return string
126
-     */
127
-    public function followUpSurname(): string
128
-    {
129
-        return $this->alt_surname ?? '';
130
-    }
131
-
132
-    /**
133
-     * Indicates whether the node has a follow up surname
134
-     *
135
-     * @return boolean
136
-     */
137
-    public function hasFollowUpSurname(): bool
138
-    {
139
-        return mb_strlen($this->followUpSurname()) > 0 ;
140
-    }
28
+	/**
29
+	 * @var Collection $linked_fams Spouse families linked to the node
30
+	 */
31
+	private $linked_fams;
32
+
33
+	/**
34
+	 * @var ?Individual $node_indi Reference individual for the node
35
+	 */
36
+	private $node_indi;
37
+
38
+	/**
39
+	 * @var LineageRootNode $root_node Root node of the lineage
40
+	 */
41
+	private $root_node;
42
+
43
+	/**
44
+	 * @var ?string $alt_surname Linked surname, used to link to another lineage
45
+	 */
46
+	private $alt_surname;
47
+
48
+	/**
49
+	 * Constructor for Lineage node
50
+	 *
51
+	 * @param Individual $node_indi Main individual
52
+	 * @param LineageRootNode $root_node Node of the lineage root
53
+	 * @param null|string $alt_surname Follow-up surname
54
+	 */
55
+	public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null)
56
+	{
57
+		$this->node_indi = $node_indi;
58
+		$this->root_node = $root_node;
59
+		$this->alt_surname = $alt_surname;
60
+		$this->linked_fams = new Collection();
61
+	}
62
+
63
+	/**
64
+	 * Add a spouse family to the node
65
+	 *
66
+	 * @param Family $fams
67
+	 * @return stdClass
68
+	 */
69
+	public function addFamily(Family $fams): object
70
+	{
71
+		if (!$this->linked_fams->has($fams->xref())) {
72
+			$this->linked_fams->put($fams->xref(), (object) [
73
+				'family'   =>  $fams,
74
+				'children' =>  new Collection()
75
+			]);
76
+		}
77
+		return $this->linked_fams->get($fams->xref());
78
+	}
79
+
80
+	/**
81
+	 * Add a child LineageNode to the node
82
+	 *
83
+	 * @param Family $fams
84
+	 * @param LineageNode $child
85
+	 */
86
+	public function addChild(Family $fams, LineageNode $child = null): void
87
+	{
88
+		$this->addFamily($fams)->children->push($child);
89
+		$this->root_node->incrementChildNodes();
90
+	}
91
+
92
+	/**
93
+	 * Returns the node individual
94
+	 *
95
+	 * @return Individual|NULL
96
+	 */
97
+	public function individual(): ?Individual
98
+	{
99
+		return $this->node_indi;
100
+	}
101
+
102
+	/**
103
+	 * Returns the lineage root node individual
104
+	 *
105
+	 * @return LineageRootNode
106
+	 */
107
+	public function rootNode(): LineageRootNode
108
+	{
109
+		return $this->root_node;
110
+	}
111
+
112
+	/**
113
+	 * Returns the spouse families linked to the node
114
+	 *
115
+	 * @return Collection
116
+	 */
117
+	public function families(): Collection
118
+	{
119
+		return $this->linked_fams;
120
+	}
121
+
122
+	/**
123
+	 * Returns the follow-up surname
124
+	 *
125
+	 * @return string
126
+	 */
127
+	public function followUpSurname(): string
128
+	{
129
+		return $this->alt_surname ?? '';
130
+	}
131
+
132
+	/**
133
+	 * Indicates whether the node has a follow up surname
134
+	 *
135
+	 * @return boolean
136
+	 */
137
+	public function hasFollowUpSurname(): bool
138
+	{
139
+		return mb_strlen($this->followUpSurname()) > 0 ;
140
+	}
141 141
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/TaskSchedule.php 1 patch
Indentation   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -25,290 +25,290 @@
 block discarded – undo
25 25
 class TaskSchedule
26 26
 {
27 27
 
28
-    /**
29
-     * Task Schedule ID
30
-     * @var int $id
31
-     */
32
-    private $id;
33
-
34
-    /**
35
-     * Task schedule status
36
-     * @var bool $enabled
37
-     */
38
-    private $enabled;
39
-
40
-    /**
41
-     * ID of the task attached to schedule
42
-     * @var string $task_id
43
-     */
44
-    private $task_id;
45
-
46
-    /**
47
-     * Last updated date
48
-     * @var Carbon $last_run
49
-     */
50
-    private $last_run;
51
-
52
-    /**
53
-     * Last run result
54
-     * @var bool $last_result
55
-     */
56
-    private $last_result;
57
-
58
-    /**
59
-     * Task run frequency
60
-     * @var CarbonInterval $frequency
61
-     */
62
-    private $frequency;
63
-
64
-    /**
65
-     * Task remaining runs
66
-     * @var int $nb_occurrences
67
-     */
68
-    private $nb_occurrences;
69
-
70
-    /**
71
-     * Current running status of the task
72
-     * @var bool $is_running
73
-     */
74
-    private $is_running;
75
-
76
-    /**
77
-     * Constructor for TaskSchedule
78
-     *
79
-     * @param int $id Schedule ID
80
-     * @param string $task_id Task ID
81
-     * @param bool $enabled Is the schedule enabled
82
-     * @param Carbon $last_run Last successful run date/time
83
-     * @param bool $last_result Result of the last run
84
-     * @param CarbonInterval $frequency Schedule frequency
85
-     * @param int $nb_occurrences Number of remaining occurrences to be run
86
-     * @param bool $is_running Is the task currently running
87
-     */
88
-    public function __construct(
89
-        int $id,
90
-        string $task_id,
91
-        bool $enabled,
92
-        Carbon $last_run,
93
-        bool $last_result,
94
-        CarbonInterval $frequency,
95
-        int $nb_occurrences,
96
-        bool $is_running
97
-    ) {
98
-        $this->id = $id;
99
-        $this->task_id = $task_id;
100
-        $this->enabled = $enabled;
101
-        $this->last_run = $last_run;
102
-        $this->last_result = $last_result;
103
-        $this->frequency = $frequency;
104
-        $this->nb_occurrences = $nb_occurrences;
105
-        $this->is_running = $is_running;
106
-    }
107
-
108
-    /**
109
-     * Get the schedule ID.
110
-     *
111
-     * @return int
112
-     */
113
-    public function id(): int
114
-    {
115
-        return $this->id;
116
-    }
117
-
118
-    /**
119
-     * Get the task ID.
120
-     *
121
-     * @return string
122
-     */
123
-    public function taskId(): string
124
-    {
125
-        return $this->task_id;
126
-    }
127
-
128
-    /**
129
-     * Returns whether the schedule is enabled
130
-     *
131
-     * @return bool
132
-     */
133
-    public function isEnabled(): bool
134
-    {
135
-        return $this->enabled;
136
-    }
137
-
138
-    /**
139
-     * Enable the schedule
140
-     *
141
-     * @return self
142
-     */
143
-    public function enable(): self
144
-    {
145
-        $this->enabled = true;
146
-        return $this;
147
-    }
148
-
149
-    /**
150
-     * Disable the schedule
151
-     *
152
-     * @return self
153
-     */
154
-    public function disable(): self
155
-    {
156
-        $this->enabled = false;
157
-        return $this;
158
-    }
159
-
160
-    /**
161
-     * Get the frequency of the schedule
162
-     *
163
-     * @return CarbonInterval
164
-     */
165
-    public function frequency(): CarbonInterval
166
-    {
167
-        return $this->frequency;
168
-    }
169
-
170
-    /**
171
-     * Set the frequency of the schedule
172
-     *
173
-     * @param CarbonInterval $frequency
174
-     * @return self
175
-     */
176
-    public function setFrequency(CarbonInterval $frequency): self
177
-    {
178
-        $this->frequency = $frequency;
179
-        return $this;
180
-    }
181
-
182
-    /**
183
-     * Get the date/time of the last successful run.
184
-     *
185
-     * @return Carbon
186
-     */
187
-    public function lastRunTime(): Carbon
188
-    {
189
-        return $this->last_run;
190
-    }
191
-
192
-    /**
193
-     * Set the last successful run date/time
194
-     *
195
-     * @param Carbon $last_run
196
-     * @return self
197
-     */
198
-    public function setLastRunTime(Carbon $last_run): self
199
-    {
200
-        $this->last_run = $last_run;
201
-        return $this;
202
-    }
203
-
204
-    /**
205
-     * Returns whether the last run was successful
206
-     *
207
-     * @return bool
208
-     */
209
-    public function wasLastRunSuccess(): bool
210
-    {
211
-        return $this->last_result;
212
-    }
213
-
214
-    /**
215
-     * Set the last run result
216
-     *
217
-     * @param bool $last_result
218
-     * @return self
219
-     */
220
-    public function setLastResult(bool $last_result): self
221
-    {
222
-        $this->last_result = $last_result;
223
-        return $this;
224
-    }
225
-
226
-    /**
227
-     * Get the number of remaining of occurrences of task runs.
228
-     * Returns 0 if the tasks must be run indefinitely.
229
-     *
230
-     * @return int
231
-     */
232
-    public function remainingOccurences(): int
233
-    {
234
-        return $this->nb_occurrences;
235
-    }
236
-
237
-    /**
238
-     * Decrements the number of remaining occurences by 1.
239
-     * The task will be disabled when the number reaches 0.
240
-     *
241
-     * @return self
242
-     */
243
-    public function decrementRemainingOccurences(): self
244
-    {
245
-        if ($this->nb_occurrences > 0) {
246
-            $this->nb_occurrences--;
247
-            if ($this->nb_occurrences == 0) {
248
-                $this->disable();
249
-            }
250
-        }
251
-        return $this;
252
-    }
253
-
254
-    /**
255
-     * Set the number of remaining occurences of task runs.
256
-     *
257
-     * @param int $nb_occurrences
258
-     * @return self
259
-     */
260
-    public function setRemainingOccurences(int $nb_occurrences): self
261
-    {
262
-        $this->nb_occurrences = $nb_occurrences;
263
-        return $this;
264
-    }
265
-
266
-    /**
267
-     * Returns whether the task is running
268
-     * @return bool
269
-     */
270
-    public function isRunning(): bool
271
-    {
272
-        return $this->is_running;
273
-    }
274
-
275
-    /**
276
-     * Informs the schedule that the task is going to run
277
-     *
278
-     * @return self
279
-     */
280
-    public function startRunning(): self
281
-    {
282
-        $this->is_running = true;
283
-        return $this;
284
-    }
285
-
286
-    /**
287
-     * Informs the schedule that the task has stopped running.
288
-     * @return self
289
-     */
290
-    public function stopRunning(): self
291
-    {
292
-        $this->is_running = false;
293
-        return $this;
294
-    }
295
-
296
-    /**
297
-     * Returns the schedule details as an associate array
298
-     *
299
-     * @return array
300
-     */
301
-    public function toArray(): array
302
-    {
303
-        return [
304
-            'id'            =>  $this->id,
305
-            'task_id'       =>  $this->task_id,
306
-            'enabled'       =>  $this->enabled,
307
-            'last_run'      =>  $this->last_run,
308
-            'last_result'   =>  $this->last_result,
309
-            'frequency'     =>  $this->frequency,
310
-            'nb_occurrences' =>  $this->nb_occurrences,
311
-            'is_running'    =>  $this->is_running
312
-        ];
313
-    }
28
+	/**
29
+	 * Task Schedule ID
30
+	 * @var int $id
31
+	 */
32
+	private $id;
33
+
34
+	/**
35
+	 * Task schedule status
36
+	 * @var bool $enabled
37
+	 */
38
+	private $enabled;
39
+
40
+	/**
41
+	 * ID of the task attached to schedule
42
+	 * @var string $task_id
43
+	 */
44
+	private $task_id;
45
+
46
+	/**
47
+	 * Last updated date
48
+	 * @var Carbon $last_run
49
+	 */
50
+	private $last_run;
51
+
52
+	/**
53
+	 * Last run result
54
+	 * @var bool $last_result
55
+	 */
56
+	private $last_result;
57
+
58
+	/**
59
+	 * Task run frequency
60
+	 * @var CarbonInterval $frequency
61
+	 */
62
+	private $frequency;
63
+
64
+	/**
65
+	 * Task remaining runs
66
+	 * @var int $nb_occurrences
67
+	 */
68
+	private $nb_occurrences;
69
+
70
+	/**
71
+	 * Current running status of the task
72
+	 * @var bool $is_running
73
+	 */
74
+	private $is_running;
75
+
76
+	/**
77
+	 * Constructor for TaskSchedule
78
+	 *
79
+	 * @param int $id Schedule ID
80
+	 * @param string $task_id Task ID
81
+	 * @param bool $enabled Is the schedule enabled
82
+	 * @param Carbon $last_run Last successful run date/time
83
+	 * @param bool $last_result Result of the last run
84
+	 * @param CarbonInterval $frequency Schedule frequency
85
+	 * @param int $nb_occurrences Number of remaining occurrences to be run
86
+	 * @param bool $is_running Is the task currently running
87
+	 */
88
+	public function __construct(
89
+		int $id,
90
+		string $task_id,
91
+		bool $enabled,
92
+		Carbon $last_run,
93
+		bool $last_result,
94
+		CarbonInterval $frequency,
95
+		int $nb_occurrences,
96
+		bool $is_running
97
+	) {
98
+		$this->id = $id;
99
+		$this->task_id = $task_id;
100
+		$this->enabled = $enabled;
101
+		$this->last_run = $last_run;
102
+		$this->last_result = $last_result;
103
+		$this->frequency = $frequency;
104
+		$this->nb_occurrences = $nb_occurrences;
105
+		$this->is_running = $is_running;
106
+	}
107
+
108
+	/**
109
+	 * Get the schedule ID.
110
+	 *
111
+	 * @return int
112
+	 */
113
+	public function id(): int
114
+	{
115
+		return $this->id;
116
+	}
117
+
118
+	/**
119
+	 * Get the task ID.
120
+	 *
121
+	 * @return string
122
+	 */
123
+	public function taskId(): string
124
+	{
125
+		return $this->task_id;
126
+	}
127
+
128
+	/**
129
+	 * Returns whether the schedule is enabled
130
+	 *
131
+	 * @return bool
132
+	 */
133
+	public function isEnabled(): bool
134
+	{
135
+		return $this->enabled;
136
+	}
137
+
138
+	/**
139
+	 * Enable the schedule
140
+	 *
141
+	 * @return self
142
+	 */
143
+	public function enable(): self
144
+	{
145
+		$this->enabled = true;
146
+		return $this;
147
+	}
148
+
149
+	/**
150
+	 * Disable the schedule
151
+	 *
152
+	 * @return self
153
+	 */
154
+	public function disable(): self
155
+	{
156
+		$this->enabled = false;
157
+		return $this;
158
+	}
159
+
160
+	/**
161
+	 * Get the frequency of the schedule
162
+	 *
163
+	 * @return CarbonInterval
164
+	 */
165
+	public function frequency(): CarbonInterval
166
+	{
167
+		return $this->frequency;
168
+	}
169
+
170
+	/**
171
+	 * Set the frequency of the schedule
172
+	 *
173
+	 * @param CarbonInterval $frequency
174
+	 * @return self
175
+	 */
176
+	public function setFrequency(CarbonInterval $frequency): self
177
+	{
178
+		$this->frequency = $frequency;
179
+		return $this;
180
+	}
181
+
182
+	/**
183
+	 * Get the date/time of the last successful run.
184
+	 *
185
+	 * @return Carbon
186
+	 */
187
+	public function lastRunTime(): Carbon
188
+	{
189
+		return $this->last_run;
190
+	}
191
+
192
+	/**
193
+	 * Set the last successful run date/time
194
+	 *
195
+	 * @param Carbon $last_run
196
+	 * @return self
197
+	 */
198
+	public function setLastRunTime(Carbon $last_run): self
199
+	{
200
+		$this->last_run = $last_run;
201
+		return $this;
202
+	}
203
+
204
+	/**
205
+	 * Returns whether the last run was successful
206
+	 *
207
+	 * @return bool
208
+	 */
209
+	public function wasLastRunSuccess(): bool
210
+	{
211
+		return $this->last_result;
212
+	}
213
+
214
+	/**
215
+	 * Set the last run result
216
+	 *
217
+	 * @param bool $last_result
218
+	 * @return self
219
+	 */
220
+	public function setLastResult(bool $last_result): self
221
+	{
222
+		$this->last_result = $last_result;
223
+		return $this;
224
+	}
225
+
226
+	/**
227
+	 * Get the number of remaining of occurrences of task runs.
228
+	 * Returns 0 if the tasks must be run indefinitely.
229
+	 *
230
+	 * @return int
231
+	 */
232
+	public function remainingOccurences(): int
233
+	{
234
+		return $this->nb_occurrences;
235
+	}
236
+
237
+	/**
238
+	 * Decrements the number of remaining occurences by 1.
239
+	 * The task will be disabled when the number reaches 0.
240
+	 *
241
+	 * @return self
242
+	 */
243
+	public function decrementRemainingOccurences(): self
244
+	{
245
+		if ($this->nb_occurrences > 0) {
246
+			$this->nb_occurrences--;
247
+			if ($this->nb_occurrences == 0) {
248
+				$this->disable();
249
+			}
250
+		}
251
+		return $this;
252
+	}
253
+
254
+	/**
255
+	 * Set the number of remaining occurences of task runs.
256
+	 *
257
+	 * @param int $nb_occurrences
258
+	 * @return self
259
+	 */
260
+	public function setRemainingOccurences(int $nb_occurrences): self
261
+	{
262
+		$this->nb_occurrences = $nb_occurrences;
263
+		return $this;
264
+	}
265
+
266
+	/**
267
+	 * Returns whether the task is running
268
+	 * @return bool
269
+	 */
270
+	public function isRunning(): bool
271
+	{
272
+		return $this->is_running;
273
+	}
274
+
275
+	/**
276
+	 * Informs the schedule that the task is going to run
277
+	 *
278
+	 * @return self
279
+	 */
280
+	public function startRunning(): self
281
+	{
282
+		$this->is_running = true;
283
+		return $this;
284
+	}
285
+
286
+	/**
287
+	 * Informs the schedule that the task has stopped running.
288
+	 * @return self
289
+	 */
290
+	public function stopRunning(): self
291
+	{
292
+		$this->is_running = false;
293
+		return $this;
294
+	}
295
+
296
+	/**
297
+	 * Returns the schedule details as an associate array
298
+	 *
299
+	 * @return array
300
+	 */
301
+	public function toArray(): array
302
+	{
303
+		return [
304
+			'id'            =>  $this->id,
305
+			'task_id'       =>  $this->task_id,
306
+			'enabled'       =>  $this->enabled,
307
+			'last_run'      =>  $this->last_run,
308
+			'last_result'   =>  $this->last_result,
309
+			'frequency'     =>  $this->frequency,
310
+			'nb_occurrences' =>  $this->nb_occurrences,
311
+			'is_running'    =>  $this->is_running
312
+		];
313
+	}
314 314
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Schema/Migration1.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@
 block discarded – undo
25 25
 class Migration1 implements MigrationInterface
26 26
 {
27 27
 
28
-    /**
29
-     * {@inheritDoc}
30
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
31
-     */
32
-    public function upgrade(): void
33
-    {
34
-        // Clean up previous admin tasks table if it exists
35
-        DB::schema()->dropIfExists('maj_admintasks');
36
-
37
-        DB::schema()->create('maj_admintasks', static function (Blueprint $table): void {
38
-
39
-            $table->increments('majat_id');
40
-            $table->string('majat_task_id', 32)->unique();
41
-            $table->enum('majat_status', ['enabled', 'disabled'])->default('disabled');
42
-            $table->dateTime('majat_last_run')->default(Carbon::createFromTimestampUTC(0));
43
-            $table->boolean('majat_last_result')->default(true);
44
-            $table->integer('majat_frequency')->default(10080);
45
-            $table->smallInteger('majat_nb_occur')->default(0);
46
-            $table->boolean('majat_running')->default(false);
47
-        });
48
-    }
28
+	/**
29
+	 * {@inheritDoc}
30
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
31
+	 */
32
+	public function upgrade(): void
33
+	{
34
+		// Clean up previous admin tasks table if it exists
35
+		DB::schema()->dropIfExists('maj_admintasks');
36
+
37
+		DB::schema()->create('maj_admintasks', static function (Blueprint $table): void {
38
+
39
+			$table->increments('majat_id');
40
+			$table->string('majat_task_id', 32)->unique();
41
+			$table->enum('majat_status', ['enabled', 'disabled'])->default('disabled');
42
+			$table->dateTime('majat_last_run')->default(Carbon::createFromTimestampUTC(0));
43
+			$table->boolean('majat_last_result')->default(true);
44
+			$table->integer('majat_frequency')->default(10080);
45
+			$table->smallInteger('majat_nb_occur')->default(0);
46
+			$table->boolean('majat_running')->default(false);
47
+		});
48
+	}
49 49
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Services/HealthCheckService.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -27,101 +27,101 @@
 block discarded – undo
27 27
  */
28 28
 class HealthCheckService
29 29
 {
30
-    /**
31
-     * Returns a query collating all gedcom records, for use in other queries
32
-     *
33
-     * @param Tree $tree
34
-     * @return Builder
35
-     */
36
-    private function allGedcomRecords(Tree $tree): Builder
37
-    {
38
-        return DB::table('individuals')
39
-            ->select(DB::raw("'indi' AS ged_type"), 'i_id AS ged_id')->where('i_file', '=', $tree->id())
40
-            ->unionAll(DB::table('families')
41
-                ->select(DB::raw("'fam' AS ged_type"), 'f_id AS ged_id')->where('f_file', '=', $tree->id()))
42
-            ->unionAll(DB::table('sources')
43
-                ->select(DB::raw("'sour' AS ged_type"), 's_id AS ged_id')->where('s_file', '=', $tree->id()))
44
-            ->unionAll(DB::table('media')
45
-                ->select(DB::raw("'media' AS ged_type"), 'm_id AS ged_id')->where('m_file', '=', $tree->id()))
46
-            ->unionAll(DB::table('other')
47
-                ->select(DB::raw('LOWER(o_type) AS ged_type'), 'o_id AS ged_id')->where('o_file', '=', $tree->id()));
48
-    }
30
+	/**
31
+	 * Returns a query collating all gedcom records, for use in other queries
32
+	 *
33
+	 * @param Tree $tree
34
+	 * @return Builder
35
+	 */
36
+	private function allGedcomRecords(Tree $tree): Builder
37
+	{
38
+		return DB::table('individuals')
39
+			->select(DB::raw("'indi' AS ged_type"), 'i_id AS ged_id')->where('i_file', '=', $tree->id())
40
+			->unionAll(DB::table('families')
41
+				->select(DB::raw("'fam' AS ged_type"), 'f_id AS ged_id')->where('f_file', '=', $tree->id()))
42
+			->unionAll(DB::table('sources')
43
+				->select(DB::raw("'sour' AS ged_type"), 's_id AS ged_id')->where('s_file', '=', $tree->id()))
44
+			->unionAll(DB::table('media')
45
+				->select(DB::raw("'media' AS ged_type"), 'm_id AS ged_id')->where('m_file', '=', $tree->id()))
46
+			->unionAll(DB::table('other')
47
+				->select(DB::raw('LOWER(o_type) AS ged_type'), 'o_id AS ged_id')->where('o_file', '=', $tree->id()));
48
+	}
49 49
 
50
-    /**
51
-     * Returns the count of gedcom records by type in a Tree, as a keyed Collection.
52
-     *
53
-     * Collection output:
54
-     *      - Key : gedcom record type
55
-     *      - Value: count of records
56
-     *
57
-     * @param Tree $tree
58
-     * @return Collection
59
-     */
60
-    public function countByRecordType(Tree $tree): Collection
61
-    {
62
-        return DB::query()
63
-            ->fromSub($this->allGedcomRecords($tree), 'gedrecords')
64
-            ->select('ged_type', new Expression('COUNT(ged_id) AS total'))
65
-            ->groupBy('ged_type')
66
-            ->pluck('total', 'ged_type');
67
-    }
50
+	/**
51
+	 * Returns the count of gedcom records by type in a Tree, as a keyed Collection.
52
+	 *
53
+	 * Collection output:
54
+	 *      - Key : gedcom record type
55
+	 *      - Value: count of records
56
+	 *
57
+	 * @param Tree $tree
58
+	 * @return Collection
59
+	 */
60
+	public function countByRecordType(Tree $tree): Collection
61
+	{
62
+		return DB::query()
63
+			->fromSub($this->allGedcomRecords($tree), 'gedrecords')
64
+			->select('ged_type', new Expression('COUNT(ged_id) AS total'))
65
+			->groupBy('ged_type')
66
+			->pluck('total', 'ged_type');
67
+	}
68 68
 
69
-    /**
70
-     * Returns the count of gedcom records changes by type in a Tree across a number of days, as a keyed Collection.
71
-     *
72
-     * Collection output:
73
-     *      - Key : gedcom record type
74
-     *      - Value: count of changes
75
-     *
76
-     * @param Tree $tree
77
-     * @return Collection
78
-     */
79
-    public function changesByRecordType(Tree $tree, int $nb_days): Collection
80
-    {
81
-        return DB::table('change')
82
-            ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void {
69
+	/**
70
+	 * Returns the count of gedcom records changes by type in a Tree across a number of days, as a keyed Collection.
71
+	 *
72
+	 * Collection output:
73
+	 *      - Key : gedcom record type
74
+	 *      - Value: count of changes
75
+	 *
76
+	 * @param Tree $tree
77
+	 * @return Collection
78
+	 */
79
+	public function changesByRecordType(Tree $tree, int $nb_days): Collection
80
+	{
81
+		return DB::table('change')
82
+			->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void {
83 83
 
84
-                $join->on('change.xref', '=', 'gedrecords.ged_id')
85
-                    ->where('change.gedcom_id', '=', $tree->id());
86
-            })
87
-            ->select('ged_type AS type', new Expression('COUNT(change_id) AS count'))
88
-            ->where('change.status', '', 'accepted')
89
-            ->where('change.change_time', '>=', Carbon::now()->subDays($nb_days))
90
-            ->groupBy('ged_type')
91
-            ->pluck('total', 'ged_type');
92
-    }
84
+				$join->on('change.xref', '=', 'gedrecords.ged_id')
85
+					->where('change.gedcom_id', '=', $tree->id());
86
+			})
87
+			->select('ged_type AS type', new Expression('COUNT(change_id) AS count'))
88
+			->where('change.status', '', 'accepted')
89
+			->where('change.change_time', '>=', Carbon::now()->subDays($nb_days))
90
+			->groupBy('ged_type')
91
+			->pluck('total', 'ged_type');
92
+	}
93 93
 
94
-    /**
95
-     * Return the error logs associated with a tree across a number of days, grouped by error message, as a Collection.
96
-     *
97
-     * Collection output:
98
-     *      - Value: stdClass object
99
-     *          - log message:  Error log message
100
-     *          - type:         'site' if no associated Tree, the Tree ID otherwise
101
-     *          - nblogs:       The number of occurence of the same error message
102
-     *          - lastoccurred: Date/time of the last occurence of the error message
103
-     *
104
-     * @param Tree $tree
105
-     * @param int $nb_days
106
-     * @return Collection
107
-     */
108
-    public function errorLogs(Tree $tree, int $nb_days): Collection
109
-    {
110
-        return DB::table('log')
111
-            ->select(
112
-                'log_message',
113
-                new Expression("IFNULL(gedcom_id, 'site') as type"),
114
-                new Expression('COUNT(log_id) AS nblogs'),
115
-                new Expression('MAX(log_time) AS lastoccurred')
116
-            )
117
-            ->where('log_type', '=', 'error')
118
-            ->where(function (Builder $query) use ($tree): void {
119
-                $query->where('gedcom_id', '=', $tree->id())
120
-                    ->orWhereNull('gedcom_id');
121
-            })
122
-            ->where('log_time', '>=', Carbon::now()->subDays($nb_days))
123
-            ->groupBy('log_message', 'gedcom_id')
124
-            ->orderByDesc('lastoccurred')
125
-            ->get();
126
-    }
94
+	/**
95
+	 * Return the error logs associated with a tree across a number of days, grouped by error message, as a Collection.
96
+	 *
97
+	 * Collection output:
98
+	 *      - Value: stdClass object
99
+	 *          - log message:  Error log message
100
+	 *          - type:         'site' if no associated Tree, the Tree ID otherwise
101
+	 *          - nblogs:       The number of occurence of the same error message
102
+	 *          - lastoccurred: Date/time of the last occurence of the error message
103
+	 *
104
+	 * @param Tree $tree
105
+	 * @param int $nb_days
106
+	 * @return Collection
107
+	 */
108
+	public function errorLogs(Tree $tree, int $nb_days): Collection
109
+	{
110
+		return DB::table('log')
111
+			->select(
112
+				'log_message',
113
+				new Expression("IFNULL(gedcom_id, 'site') as type"),
114
+				new Expression('COUNT(log_id) AS nblogs'),
115
+				new Expression('MAX(log_time) AS lastoccurred')
116
+			)
117
+			->where('log_type', '=', 'error')
118
+			->where(function (Builder $query) use ($tree): void {
119
+				$query->where('gedcom_id', '=', $tree->id())
120
+					->orWhereNull('gedcom_id');
121
+			})
122
+			->where('log_time', '>=', Carbon::now()->subDays($nb_days))
123
+			->groupBy('log_message', 'gedcom_id')
124
+			->orderByDesc('lastoccurred')
125
+			->get();
126
+	}
127 127
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Schema/Migration1.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 class Migration1 implements MigrationInterface
23 23
 {
24 24
     
25
-    /**
26
-     * {@inheritDoc}
27
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
-     */
29
-    public function upgrade(): void
30
-    {
31
-        // These migrations have been merged into migration 2.
32
-    }
25
+	/**
26
+	 * {@inheritDoc}
27
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
+	 */
29
+	public function upgrade(): void
30
+	{
31
+		// These migrations have been merged into migration 2.
32
+	}
33 33
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Http/RequestHandlers/SosaComputeAction.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -31,61 +31,61 @@
 block discarded – undo
31 31
  */
32 32
 class SosaComputeAction implements RequestHandlerInterface
33 33
 {
34
-    /**
35
-     * @var UserService $user_service
36
-     */
37
-    private $user_service;
34
+	/**
35
+	 * @var UserService $user_service
36
+	 */
37
+	private $user_service;
38 38
 
39
-    /**
40
-     * Constructor for SosaConfigAction Request Handler
41
-     *
42
-     * @param UserService $user_service
43
-     */
44
-    public function __construct(UserService $user_service)
45
-    {
46
-        $this->user_service = $user_service;
47
-    }
39
+	/**
40
+	 * Constructor for SosaConfigAction Request Handler
41
+	 *
42
+	 * @param UserService $user_service
43
+	 */
44
+	public function __construct(UserService $user_service)
45
+	{
46
+		$this->user_service = $user_service;
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
-     */
53
-    public function handle(ServerRequestInterface $request): ResponseInterface
54
-    {
55
-        $tree = $request->getAttribute('tree');
56
-        assert($tree instanceof Tree);
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
+	 */
53
+	public function handle(ServerRequestInterface $request): ResponseInterface
54
+	{
55
+		$tree = $request->getAttribute('tree');
56
+		assert($tree instanceof Tree);
57 57
 
58
-        $params = $request->getParsedBody();
59
-        assert(is_array($params));
58
+		$params = $request->getParsedBody();
59
+		assert(is_array($params));
60 60
 
61
-        $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0);
62
-        $partial_from = $params['partial_from'] ?? null;
61
+		$user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0);
62
+		$partial_from = $params['partial_from'] ?? null;
63 63
 
64
-        if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) {
65
-            $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
64
+		if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) {
65
+			$user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id);
66 66
 
67
-            /** @var SosaCalculatorService $sosa_calc_service */
68
-            $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
67
+			/** @var SosaCalculatorService $sosa_calc_service */
68
+			$sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]);
69 69
 
70
-            if (
71
-                $partial_from !== null &&
72
-                ($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null
73
-            ) {
74
-                $res = $sosa_calc_service->computeFromIndividual($sosa_from);
75
-            } else {
76
-                $res = $sosa_calc_service->computeAll();
77
-            }
70
+			if (
71
+				$partial_from !== null &&
72
+				($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null
73
+			) {
74
+				$res = $sosa_calc_service->computeFromIndividual($sosa_from);
75
+			} else {
76
+				$res = $sosa_calc_service->computeAll();
77
+			}
78 78
 
79
-            return $res ?
80
-                response('', 200) :
81
-                response(
82
-                    I18N::translate('An error occurred while computing Sosa ancestors.'),
83
-                    StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
84
-                );
85
-        }
86
-        return response(
87
-            I18N::translate('You do not have permission to modify the user.'),
88
-            StatusCodeInterface::STATUS_FORBIDDEN
89
-        );
90
-    }
79
+			return $res ?
80
+				response('', 200) :
81
+				response(
82
+					I18N::translate('An error occurred while computing Sosa ancestors.'),
83
+					StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
84
+				);
85
+		}
86
+		return response(
87
+			I18N::translate('You do not have permission to modify the user.'),
88
+			StatusCodeInterface::STATUS_FORBIDDEN
89
+		);
90
+	}
91 91
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Schema/Migration0.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 class Migration0 implements MigrationInterface
23 23
 {
24 24
 
25
-    /**
26
-     * {@inheritDoc}
27
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
-     */
29
-    public function upgrade(): void
30
-    {
31
-        // These migrations have been merged into migration 2.
32
-    }
25
+	/**
26
+	 * {@inheritDoc}
27
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
+	 */
29
+	public function upgrade(): void
30
+	{
31
+		// These migrations have been merged into migration 2.
32
+	}
33 33
 }
Please login to merge, or discard this patch.