Completed
Push — master ( 960061...3603f5 )
by Jonathan
01:43
created
src/Webtrees/Constants.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Constants {
16 16
     
17
-    const LIB_NAMESPACE = __NAMESPACE__;
17
+	const LIB_NAMESPACE = __NAMESPACE__;
18 18
 	
19
-    /** Internal name of the Certificates Module
20
-     * @var string
21
-     */
22
-    const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates';
19
+	/** Internal name of the Certificates Module
20
+	 * @var string
21
+	 */
22
+	const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates';
23 23
     
24
-    /** Internal name of the GeoDispersion Module
25
-     * @var string
26
-     */
27
-    const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion';
24
+	/** Internal name of the GeoDispersion Module
25
+	 * @var string
26
+	 */
27
+	const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion';
28 28
     
29 29
 	/** Internal name of the Hooks Module
30 30
 	 * @var string
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return string $WT_RAPHAEL_JS_URL
62 62
 	 */
63 63
 	public static function WT_RAPHAEL_JS_URL() {
64
-	    return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
64
+		return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
65 65
 	}
66 66
 		
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleMenuItemInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ModuleMenuItemInterface
17 17
 {
18
-    /**
19
-     * Returns a menu item for the module.
20
-     * 
21
-     * @param \Fisharebest\Webtrees\Tree|null $tree
22
-     * @param mixed $reference
23
-     */
24
-    public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
18
+	/**
19
+	 * Returns a menu item for the module.
20
+	 * 
21
+	 * @param \Fisharebest\Webtrees\Tree|null $tree
22
+	 * @param mixed $reference
23
+	 */
24
+	public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/ConfigurableTaskInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ConfigurableTaskInterface {
17 17
     
18
-    /**
19
-     * Returns the HTML code to display the specific task configuration.
20
-     * 
21
-     * @return string HTML code
22
-     */
18
+	/**
19
+	 * Returns the HTML code to display the specific task configuration.
20
+	 * 
21
+	 * @return string HTML code
22
+	 */
23 23
 	function htmlConfigForm();
24 24
 	
25 25
 	/**
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/TaskProviderInterface.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -37,47 +37,47 @@
 block discarded – undo
37 37
 	 */
38 38
 	public function setTaskStatus(AbstractTask $task, $status);
39 39
 		
40
-    /**
41
-     * Update an Admin Task in the database.
42
-     * 
43
-     * @param AbstractTask $task Task to update
44
-     * @return bool
45
-     */
46
-    function updateTask(AbstractTask $task);    
40
+	/**
41
+	 * Update an Admin Task in the database.
42
+	 * 
43
+	 * @param AbstractTask $task Task to update
44
+	 * @return bool
45
+	 */
46
+	function updateTask(AbstractTask $task);    
47 47
     
48
-    /**
49
-     * Delete the task from the database, in a transactional manner.
50
-     *
51
-     * @param string $task_name Task to delete
52
-     */
53
-    public function deleteTask($task_name);
48
+	/**
49
+	 * Delete the task from the database, in a transactional manner.
50
+	 *
51
+	 * @param string $task_name Task to delete
52
+	 */
53
+	public function deleteTask($task_name);
54 54
     
55 55
 
56
-    /**
57
-     * Returns the number of Admin Tasks (active and inactive).
58
-     *
59
-     * @return int
60
-     */
61
-    public function getTasksCount();
56
+	/**
57
+	 * Returns the number of Admin Tasks (active and inactive).
58
+	 *
59
+	 * @return int
60
+	 */
61
+	public function getTasksCount();
62 62
     
63
-    /**
64
-     * Return the list of Admin Tasks matching specified criterias.
65
-     *
66
-     * @param string $search Search criteria in analysis description
67
-     * @param array $order_by Columns to order by
68
-     * @param int $start Offset to start with (for pagination)
69
-     * @param int|null $limit Max number of items to return (for pagination)
70
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
71
-     */
72
-    function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null);
63
+	/**
64
+	 * Return the list of Admin Tasks matching specified criterias.
65
+	 *
66
+	 * @param string $search Search criteria in analysis description
67
+	 * @param array $order_by Columns to order by
68
+	 * @param int $start Offset to start with (for pagination)
69
+	 * @param int|null $limit Max number of items to return (for pagination)
70
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
71
+	 */
72
+	function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null);
73 73
     
74
-    /**
75
-     * Returns the list of tasks that are currently meant to run.
76
-     * Tasks to run can be forced, or can be limited to only one.
77
-     * 
78
-     * @param string|null $force Force the enabled tasks to run.
79
-     * @param string|null $task_name Name of the specific task to run
80
-     */
74
+	/**
75
+	 * Returns the list of tasks that are currently meant to run.
76
+	 * Tasks to run can be forced, or can be limited to only one.
77
+	 * 
78
+	 * @param string|null $force Force the enabled tasks to run.
79
+	 * @param string|null $task_name Name of the specific task to run
80
+	 */
81 81
 	function getTasksToRun($force = false, $task_name = null);
82 82
 		
83 83
 	/**
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/TaskProvider.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class TaskProvider implements TaskProviderInterface {
22 22
     
23
-    /**
24
-     * Root path of thr folder containing the tasks
25
-     * @var string $root_path
26
-     */
27
-    protected $root_path;
23
+	/**
24
+	 * Root path of thr folder containing the tasks
25
+	 * @var string $root_path
26
+	 */
27
+	protected $root_path;
28 28
 	    
29
-    /**
30
-     * Constructor for the Task provider
31
-     * @param string $root_path
32
-     */
33
-    public function __construct($root_path) {
34
-        $this->root_path = $root_path;
29
+	/**
30
+	 * Constructor for the Task provider
31
+	 * @param string $root_path
32
+	 */
33
+	public function __construct($root_path) {
34
+		$this->root_path = $root_path;
35 35
 		$this->all_tasks = null;
36
-    }
36
+	}
37 37
 	
38
-    /**
39
-     * Load a task object from a file.
40
-     * 
41
-     * @param string $task_name Name of the task to load.
42
-     */
38
+	/**
39
+	 * Load a task object from a file.
40
+	 * 
41
+	 * @param string $task_name Name of the task to load.
42
+	 */
43 43
 	protected function loadTask($task_name) {
44 44
 		try {
45 45
 			if (file_exists($this->root_path . $task_name .'.php')) {
46 46
 				$task = include $this->root_path . $task_name .'.php';
47 47
 				if($task instanceof AbstractTask) {
48
-				    $task->setProvider($this);
48
+					$task->setProvider($this);
49 49
 					return $task;
50 50
 				}
51 51
 			}
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 		return null;
56 56
 	}
57 57
 	
58
-    /**
59
-     * Creates and returns a Task object from a data row.
60
-     * The row data is expected to be an array with the indexes:
61
-     *  - majat_name: task name
62
-     *  - majat_status: task status
63
-     *  - majat_last_run: last run time
64
-     *  - majat_last_result: last run result
65
-     *  - majat_frequency: run frequency
66
-     *  - majat_nb_occur: remaining running occurrences
67
-     *  - majat_running: is task running
68
-     *
69
-     * @param array $row
70
-     * @return AbstractTask|null
71
-     */
72
-    protected function loadTaskFromRow($row) {
73
-        $task = $this->loadTask($row['majat_name']);
58
+	/**
59
+	 * Creates and returns a Task object from a data row.
60
+	 * The row data is expected to be an array with the indexes:
61
+	 *  - majat_name: task name
62
+	 *  - majat_status: task status
63
+	 *  - majat_last_run: last run time
64
+	 *  - majat_last_result: last run result
65
+	 *  - majat_frequency: run frequency
66
+	 *  - majat_nb_occur: remaining running occurrences
67
+	 *  - majat_running: is task running
68
+	 *
69
+	 * @param array $row
70
+	 * @return AbstractTask|null
71
+	 */
72
+	protected function loadTaskFromRow($row) {
73
+		$task = $this->loadTask($row['majat_name']);
74 74
         
75 75
 		if($task) {
76 76
 			$task->setParameters(
@@ -85,99 +85,99 @@  discard block
 block discarded – undo
85 85
 			return $task;
86 86
 		}
87 87
 		else {
88
-		    $this->deleteTask($row['majat_name']);
88
+			$this->deleteTask($row['majat_name']);
89 89
 		}
90 90
 		return null;
91
-    }
91
+	}
92 92
     
93
-    /**
94
-     * {@inheritDoc}
95
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96
-     */
97
-    public function getTask($task_name, $only_enabled = true) {
98
-        $args = array (
99
-            'task_name' => $task_name
100
-        );
93
+	/**
94
+	 * {@inheritDoc}
95
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96
+	 */
97
+	public function getTask($task_name, $only_enabled = true) {
98
+		$args = array (
99
+			'task_name' => $task_name
100
+		);
101 101
     
102
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
-            ' FROM `##maj_admintasks`' .
104
-            ' WHERE majat_name = :task_name';
105
-        if($only_enabled) {
106
-            $sql .= ' AND majat_status = :status';
107
-            $args['status'] = 'enabled';
108
-        }
102
+		$sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
+			' FROM `##maj_admintasks`' .
104
+			' WHERE majat_name = :task_name';
105
+		if($only_enabled) {
106
+			$sql .= ' AND majat_status = :status';
107
+			$args['status'] = 'enabled';
108
+		}
109 109
     
110
-        $task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
110
+		$task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
111 111
     
112
-        if($task_array) {
113
-            return $this->loadTaskFromRow($task_array);
114
-        }
112
+		if($task_array) {
113
+			return $this->loadTaskFromRow($task_array);
114
+		}
115 115
     
116
-        return null;
117
-    }
116
+		return null;
117
+	}
118 118
     
119 119
 	/**
120 120
 	 * {@inheritDoc}
121 121
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::setTaskStatus()
122 122
 	 */
123
-    public function setTaskStatus(AbstractTask $task, $status) {
124
-        Database::prepare(
125
-            'UPDATE `##maj_admintasks`'.
126
-            ' SET majat_status = :status'.
127
-            ' WHERE majat_name = :name'
128
-        )->execute(array(
129
-                'name' => $task->getName(),
123
+	public function setTaskStatus(AbstractTask $task, $status) {
124
+		Database::prepare(
125
+			'UPDATE `##maj_admintasks`'.
126
+			' SET majat_status = :status'.
127
+			' WHERE majat_name = :name'
128
+		)->execute(array(
129
+				'name' => $task->getName(),
130 130
 				'status' => $status ? 'enabled' : 'disabled'
131
-        ));
132
-    }
131
+		));
132
+	}
133 133
 	
134 134
    /**
135 135
     * {@inheritDoc}
136 136
     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::updateTask()
137 137
     */
138
-    public function updateTask(AbstractTask $task) {        
139
-        try{
140
-            Database::prepare(
141
-                'UPDATE `##maj_admintasks`'.
142
-                ' SET majat_status = :status,'.
143
-                ' majat_last_run = :last_run,'.
144
-                ' majat_last_result = :last_result,'.
145
-                ' majat_frequency = :frequency,'.
146
-                ' majat_nb_occur = :nb_occurrences,'.
147
-                ' majat_running = :is_running'.
148
-                ' WHERE majat_name = :name'
149
-                )->execute(array(
150
-                    'name' => $task->getName(),
151
-                    'status' => $task->isEnabled() ? 'enabled' : 'disabled',
152
-                    'last_run' => $task->getLastUpdated()->format('Y-m-d H:i:s'),
153
-                    'last_result' =>  $task->isLastRunSuccess() ? 1 : 0,
154
-                    'frequency' => $task->getFrequency(),
155
-                    'nb_occurrences' => $task->getRemainingOccurrences(),
156
-                    'is_running' => $task->isRunning() ? 1 : 0
157
-                ));
158
-            return true;
159
-        }
160
-        catch (\Exception $ex) {
161
-            Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162
-            return false;
163
-        }        
164
-    }
138
+	public function updateTask(AbstractTask $task) {        
139
+		try{
140
+			Database::prepare(
141
+				'UPDATE `##maj_admintasks`'.
142
+				' SET majat_status = :status,'.
143
+				' majat_last_run = :last_run,'.
144
+				' majat_last_result = :last_result,'.
145
+				' majat_frequency = :frequency,'.
146
+				' majat_nb_occur = :nb_occurrences,'.
147
+				' majat_running = :is_running'.
148
+				' WHERE majat_name = :name'
149
+				)->execute(array(
150
+					'name' => $task->getName(),
151
+					'status' => $task->isEnabled() ? 'enabled' : 'disabled',
152
+					'last_run' => $task->getLastUpdated()->format('Y-m-d H:i:s'),
153
+					'last_result' =>  $task->isLastRunSuccess() ? 1 : 0,
154
+					'frequency' => $task->getFrequency(),
155
+					'nb_occurrences' => $task->getRemainingOccurrences(),
156
+					'is_running' => $task->isRunning() ? 1 : 0
157
+				));
158
+			return true;
159
+		}
160
+		catch (\Exception $ex) {
161
+			Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162
+			return false;
163
+		}        
164
+	}
165 165
 	
166 166
 	/**
167 167
 	 * {@inheritDoc}
168 168
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksCount()
169 169
 	 */
170
-    public function getTasksCount() {
171
-        return Database::prepare(
172
-            'SELECT COUNT(majat_name)' .
173
-            ' FROM `##maj_admintasks`'
174
-            )->execute()->fetchOne();
175
-    }
170
+	public function getTasksCount() {
171
+		return Database::prepare(
172
+			'SELECT COUNT(majat_name)' .
173
+			' FROM `##maj_admintasks`'
174
+			)->execute()->fetchOne();
175
+	}
176 176
 	
177
-    /**
178
-     * {@inheritDoc}
179
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksToRun()
180
-     */
177
+	/**
178
+	 * {@inheritDoc}
179
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksToRun()
180
+	 */
181 181
 	public function getTasksToRun($force = false, $task_name = null) 
182 182
 	{
183 183
 		$res = array();
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
207 207
 		
208 208
 		foreach($data as $task_row) {
209
-            $task = $this->loadTaskFromRow($task_row);
209
+			$task = $this->loadTaskFromRow($task_row);
210 210
 			if($task)
211 211
 			{
212 212
 				$res[] = $task;
213 213
 			} 
214
-        }
214
+		}
215 215
 		
216 216
 		return $res;	
217 217
 	}
@@ -220,69 +220,69 @@  discard block
 block discarded – undo
220 220
 	 * {@inheritDoc}
221 221
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getFilteredTasksList()
222 222
 	 */
223
-    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
224
-        $res = array();
223
+	public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
224
+		$res = array();
225 225
             
226
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
227
-            ' FROM `##maj_admintasks`';
226
+		$sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
227
+			' FROM `##maj_admintasks`';
228 228
         
229
-        $args = array();
229
+		$args = array();
230 230
                 
231
-        if ($order_by) {
232
-            $sql .= ' ORDER BY ';
233
-            $i = 0;
234
-            foreach ($order_by as $key => $value) {
235
-                if ($i > 0) {
236
-                    $sql .= ',';
237
-                }
231
+		if ($order_by) {
232
+			$sql .= ' ORDER BY ';
233
+			$i = 0;
234
+			foreach ($order_by as $key => $value) {
235
+				if ($i > 0) {
236
+					$sql .= ',';
237
+				}
238 238
                 
239
-                switch ($value['dir']) {
240
-                    case 'asc':
241
-                        $sql .= $value['column'] . ' ASC ';
242
-                        break;
243
-                    case 'desc':
244
-                        $sql .= $value['column'] . ' DESC ';
245
-                        break;
246
-                }
247
-                $i++;
248
-            }
249
-        } else {
250
-            $sql .= ' ORDER BY majat_name ASC';
251
-        }
239
+				switch ($value['dir']) {
240
+					case 'asc':
241
+						$sql .= $value['column'] . ' ASC ';
242
+						break;
243
+					case 'desc':
244
+						$sql .= $value['column'] . ' DESC ';
245
+						break;
246
+				}
247
+				$i++;
248
+			}
249
+		} else {
250
+			$sql .= ' ORDER BY majat_name ASC';
251
+		}
252 252
         
253
-        if ($limit) {
254
-            $sql .= ' LIMIT :limit OFFSET :offset';
255
-            $args['limit']  = $limit;
256
-            $args['offset'] = $start;
257
-        }
253
+		if ($limit) {
254
+			$sql .= ' LIMIT :limit OFFSET :offset';
255
+			$args['limit']  = $limit;
256
+			$args['offset'] = $start;
257
+		}
258 258
             
259
-        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
259
+		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
260 260
 
261
-        foreach($data as $ga) {
262
-            $task = $this->loadTaskFromRow($ga);
261
+		foreach($data as $ga) {
262
+			$task = $this->loadTaskFromRow($ga);
263 263
 			if($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
264 264
 			{
265 265
 				$res[] = $task;
266 266
 			}
267
-        }
267
+		}
268 268
 		
269
-        return $res;
270
-    }
269
+		return $res;
270
+	}
271 271
 	
272 272
 	
273
-    /**
274
-     * {inhericDoc}
275
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276
-     */
273
+	/**
274
+	 * {inhericDoc}
275
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276
+	 */
277 277
 	public function getInstalledTasks() {
278 278
 		$tasks=array();
279 279
 		$dir=opendir($this->root_path);
280 280
 		while (($file=readdir($dir))!==false){ 
281 281
 			try {
282
-			    if($file == '.' || $file == '..') continue;
282
+				if($file == '.' || $file == '..') continue;
283 283
 				$task = include $this->root_path . $file;
284 284
 				if($task ) {
285
-				    $task->setProvider($this);
285
+					$task->setProvider($this);
286 286
 					Database::prepare(
287 287
 						'INSERT IGNORE INTO `##maj_admintasks`'.
288 288
 						' (majat_name, majat_status, majat_frequency)'.
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
 					return $task;
50 50
 				}
51 51
 			}
52
-		}
53
-		catch(\Exception $ex) { }
52
+		} catch(\Exception $ex) { }
54 53
 		
55 54
 		return null;
56 55
 	}
@@ -83,8 +82,7 @@  discard block
 block discarded – undo
83 82
 				);
84 83
         
85 84
 			return $task;
86
-		}
87
-		else {
85
+		} else {
88 86
 		    $this->deleteTask($row['majat_name']);
89 87
 		}
90 88
 		return null;
@@ -156,8 +154,7 @@  discard block
 block discarded – undo
156 154
                     'is_running' => $task->isRunning() ? 1 : 0
157 155
                 ));
158 156
             return true;
159
-        }
160
-        catch (\Exception $ex) {
157
+        } catch (\Exception $ex) {
161 158
             Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162 159
             return false;
163 160
         }        
@@ -279,7 +276,9 @@  discard block
 block discarded – undo
279 276
 		$dir=opendir($this->root_path);
280 277
 		while (($file=readdir($dir))!==false){ 
281 278
 			try {
282
-			    if($file == '.' || $file == '..') continue;
279
+			    if($file == '.' || $file == '..') {
280
+			    	continue;
281
+			    }
283 282
 				$task = include $this->root_path . $file;
284 283
 				if($task ) {
285 284
 				    $task->setProvider($this);
@@ -294,12 +293,10 @@  discard block
 block discarded – undo
294 293
 					));
295 294
 					
296 295
 					$tasks[] = $task;
297
-				}
298
-				else {
296
+				} else {
299 297
 					throw new \Exception;
300 298
 				}
301
-			}
302
-			catch (\Exception $ex) {
299
+			} catch (\Exception $ex) {
303 300
 				Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage());
304 301
 			}
305 302
 		}
@@ -325,8 +322,7 @@  discard block
 block discarded – undo
325 322
 			Log::addConfigurationLog('Admin Task '.$task_name.' has been deleted from disk - deleting it from DB');
326 323
 			
327 324
 			return true;
328
-		}
329
-		catch(\Exception $ex) {
325
+		} catch(\Exception $ex) {
330 326
 			Database::rollback();
331 327
 		
332 328
 			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage());
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Tasks/HealthCheckEmailTask.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -185,8 +185,7 @@  discard block
 block discarded – undo
185 185
 						I18N::translate('Error').Mail::EOL.
186 186
 						str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL.
187 187
 						$tmp_message.Mail::EOL;
188
-				}
189
-				else{
188
+				} else{
190 189
 					$message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL;
191 190
 				}
192 191
 				
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
 				}
252 251
 			}
253 252
 			return true;
254
-		}
255
-		catch (\Exception $ex) {
253
+		} catch (\Exception $ex) {
256 254
 			Log::addErrorLog(sprintf('Error while updating the Admin Task "%s". Exception: %s', $this->getName(), $ex->getMessage()));
257 255
 			return false;
258 256
 		}
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class HealthCheckEmailTask extends AbstractTask implements ConfigurableTaskInterface {
31 31
     
32
-    /**
33
-     * {@inheritDoc}
34
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
-     */
36
-    public function getTitle() {
32
+	/**
33
+	 * {@inheritDoc}
34
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
+	 */
36
+	public function getTitle() {
37 37
 		return I18N::translate('Healthcheck Email');
38 38
 	}
39 39
 	
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * {@inheritDoc}
42 42
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency()
43 43
 	 */
44
-    public function getDefaultFrequency() {
44
+	public function getDefaultFrequency() {
45 45
 		return 10080;  // = 1 week = 7 * 24 * 60 min
46 46
 	}
47 47
     
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * {@inheritDoc}
50 50
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::executeSteps()
51 51
 	 */
52
-    protected function executeSteps() {
52
+	protected function executeSteps() {
53 53
 	
54 54
 		$res = false;		
55 55
 		
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$interval = max($this->frequency, $interval_sincelast);
64 64
 		$nbdays = ceil($interval / (24 * 60));
65 65
 				
66
-        // Check for updates
67
-        $latest_version_txt = Functions::fetchLatestVersion();
68
-        if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
-        	list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
-        } else {
71
-        	// Cannot determine the latest version
72
-        	list($latest_version, , $download_url) = explode('|', '||');
73
-        }
66
+		// Check for updates
67
+		$latest_version_txt = Functions::fetchLatestVersion();
68
+		if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
+			list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
+		} else {
71
+			// Cannot determine the latest version
72
+			list($latest_version, , $download_url) = explode('|', '||');
73
+		}
74 74
 		
75 75
 		// Users statistics
76 76
 		$warnusers = 0;
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 		$html = '
214 214
 			<div class="form-group">
215 215
     			<label class="control-label col-sm-3"> '.
216
-    				I18N::translate('Enable healthcheck emails for') .
217
-    			'</label>
216
+					I18N::translate('Enable healthcheck emails for') .
217
+				'</label>
218 218
     			<div class="col-sm-9">';
219 219
 
220 220
 		foreach(Tree::getAll() as $tree){
221 221
 			if(Auth::isManager($tree)){	
222
-			    $html .= '<div class="form-group row">
222
+				$html .= '<div class="form-group row">
223 223
 			        <span class="col-sm-3 control-label">' .
224
-			             $tree->getTitle() .
224
+						 $tree->getTitle() .
225 225
 					'</span>
226 226
 					 <div class="col-sm-2">';
227 227
 				$html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"');
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 		
232 232
 		$html .= '	<p class="small text-muted">'.
233
-    					I18N::translate('Enable the health check emails for each of the selected trees.') .
234
-    				'</p>
233
+						I18N::translate('Enable the health check emails for each of the selected trees.') .
234
+					'</p>
235 235
     			</div>
236 236
     		</div>';
237 237
 			
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/AdminConfigController.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -187,7 +187,9 @@  discard block
 block discarded – undo
187 187
     
188 188
         // Generate an AJAX/JSON response for datatables to load a block of rows
189 189
         $search = Filter::postArray('search');
190
-        if($search) $search = $search['value'];
190
+        if($search) {
191
+        	$search = $search['value'];
192
+        }
191 193
         $start  = Filter::postInteger('start');
192 194
         $length = Filter::postInteger('length');
193 195
         $order  = Filter::postArray('order');
@@ -261,8 +263,7 @@  discard block
 block discarded – undo
261 263
     			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
262 264
     			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
263 265
     			    </button>';
264
-			}
265
-			else {
266
+			} else {
266 267
 			    $datum[9] = '';
267 268
 			}			    
268 269
 						
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -35,37 +35,37 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class AdminConfigController extends MvcController
37 37
 {    
38
-    /**
39
-     * Tasks Provider
40
-     * @var TaskProviderInterface $provider
41
-     */
42
-    protected $provider;    
38
+	/**
39
+	 * Tasks Provider
40
+	 * @var TaskProviderInterface $provider
41
+	 */
42
+	protected $provider;    
43 43
     
44
-    /**
45
-     * Constructor for Admin Config controller
46
-     * @param \Fisharebest\Webtrees\Module\AbstractModule $module
47
-     */
48
-    public function __construct(AbstractModule $module) {
49
-        parent::__construct($module);
44
+	/**
45
+	 * Constructor for Admin Config controller
46
+	 * @param \Fisharebest\Webtrees\Module\AbstractModule $module
47
+	 */
48
+	public function __construct(AbstractModule $module) {
49
+		parent::__construct($module);
50 50
         
51
-        $this->provider = $this->module->getProvider();
52
-    }    
51
+		$this->provider = $this->module->getProvider();
52
+	}    
53 53
     
54
-    /**
55
-     * Pages
56
-     */
54
+	/**
55
+	 * Pages
56
+	 */
57 57
         
58
-    /**
59
-     * AdminConfig@index
60
-     */
61
-    public function index() {
58
+	/**
59
+	 * AdminConfig@index
60
+	 */
61
+	public function index() {
62 62
         
63
-        $tree = Globals::getTree();
64
-        Theme::theme(new AdministrationTheme)->init($tree);
65
-        $controller = new PageController();
66
-        $controller
67
-            ->restrictAccess(Auth::isAdmin())
68
-            ->setPageTitle($this->module->getTitle());
63
+		$tree = Globals::getTree();
64
+		Theme::theme(new AdministrationTheme)->init($tree);
65
+		$controller = new PageController();
66
+		$controller
67
+			->restrictAccess(Auth::isAdmin())
68
+			->setPageTitle($this->module->getTitle());
69 69
 			
70 70
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
71 71
 		if(is_null($token)) {
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 			$this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token);
74 74
 		}
75 75
         
76
-        $data = new ViewBag();
77
-        $data->set('title', $controller->getPageTitle());
76
+		$data = new ViewBag();
77
+		$data->set('title', $controller->getPageTitle());
78 78
         
79
-        $table_id = 'table-admintasks-' . Uuid::uuid4();
80
-        $data->set('table_id', $table_id);
79
+		$table_id = 'table-admintasks-' . Uuid::uuid4();
80
+		$data->set('table_id', $table_id);
81 81
 		
82 82
 		$data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger');
83 83
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 		$this->provider->getInstalledTasks();
91 91
 		
92 92
 		$controller
93
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
94
-            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
95
-            ->addInlineJavascript('
93
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
94
+			->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
95
+			->addInlineJavascript('
96 96
                 //Datatable initialisation
97 97
 				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
98 98
 				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				});
125 125
                 
126 126
                 ')
127
-                ->addInlineJavascript('					
127
+				->addInlineJavascript('					
128 128
 					function generate_force_token() {
129 129
 						jQuery("#bt_genforcetoken").attr("disabled", "disabled");
130 130
 						jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>");
@@ -172,54 +172,54 @@  discard block
 block discarded – undo
172 172
                     } 
173 173
                 ');
174 174
         
175
-        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
176
-    }
175
+		ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
176
+	}
177 177
     
178
-    /**
179
-     * AdminConfig@jsonTasksList
180
-     */
181
-    public function jsonTasksList() {    
182
-        $controller = new JsonController();
183
-        $controller
184
-            ->restrictAccess(Auth::isAdmin());
178
+	/**
179
+	 * AdminConfig@jsonTasksList
180
+	 */
181
+	public function jsonTasksList() {    
182
+		$controller = new JsonController();
183
+		$controller
184
+			->restrictAccess(Auth::isAdmin());
185 185
     
186
-        // Generate an AJAX/JSON response for datatables to load a block of rows
187
-        $search = Filter::postArray('search');
188
-        if($search) $search = $search['value'];
189
-        $start  = Filter::postInteger('start');
190
-        $length = Filter::postInteger('length');
191
-        $order  = Filter::postArray('order');
186
+		// Generate an AJAX/JSON response for datatables to load a block of rows
187
+		$search = Filter::postArray('search');
188
+		if($search) $search = $search['value'];
189
+		$start  = Filter::postInteger('start');
190
+		$length = Filter::postInteger('length');
191
+		$order  = Filter::postArray('order');
192 192
     
193 193
 		$order_by_name = false;
194
-        foreach($order as $key => &$value) {
195
-            switch($value['column']) {
196
-                case 3:
194
+		foreach($order as $key => &$value) {
195
+			switch($value['column']) {
196
+				case 3:
197 197
 					$order_by_name = true;
198
-                    unset($order[$key]);
199
-                    break;
200
-                case 4;
198
+					unset($order[$key]);
199
+					break;
200
+				case 4;
201 201
 					$value['column'] = 'majat_last_run';
202 202
 					break;
203 203
 				case 4;
204 204
 					$value['column'] = 'majat_last_result';
205 205
 					break;
206
-                default:
207
-                    unset($order[$key]);
208
-            }
209
-        }
206
+				default:
207
+					unset($order[$key]);
208
+			}
209
+		}
210 210
     
211
-        $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
211
+		$list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
212 212
 		if($order_by_name) {
213 213
 			usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); });
214 214
 		}
215
-        $recordsFiltered = count($list);
216
-        $recordsTotal = $this->provider->getTasksCount();
215
+		$recordsFiltered = count($list);
216
+		$recordsTotal = $this->provider->getTasksCount();
217 217
     
218
-        $data = array();
219
-        foreach($list as $task) {    
220
-            $datum = array();
218
+		$data = array();
219
+		foreach($list as $task) {    
220
+			$datum = array();
221 221
 			
222
-            $datum[0] = '
222
+			$datum[0] = '
223 223
                 <div class="btn-group">
224 224
                     <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
225 225
                         <i class="fa fa-pencil"></i><span class="caret"></span>
@@ -237,50 +237,50 @@  discard block
 block discarded – undo
237 237
                        </li>
238 238
                     </ul>
239 239
                 </div>';
240
-            $datum[1] = $task->getName();
241
-            $datum[2] = $task->isEnabled() ? 
240
+			$datum[1] = $task->getName();
241
+			$datum[2] = $task->isEnabled() ? 
242 242
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
243 243
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
244
-            $datum[3] = $task->getTitle();
245
-            $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
244
+			$datum[3] = $task->getTitle();
245
+			$date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
246 246
 			$datum[4] = $task->getLastUpdated()->format($date_format);
247
-            $datum[5] = $task->isLastRunSuccess() ? 
247
+			$datum[5] = $task->isLastRunSuccess() ? 
248 248
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
249 249
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
250
-            $dtF = new \DateTime('@0');
251
-            $dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
252
-            $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
250
+			$dtF = new \DateTime('@0');
251
+			$dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
252
+			$datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
253 253
 			$datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
254 254
 			$datum[8] = $task->isRunning() ? 
255 255
 				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : 
256 256
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
257 257
 			if($task->isEnabled() && !$task->isRunning()) {
258
-			    $datum[9] = '
258
+				$datum[9] = '
259 259
     			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
260 260
     			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
261 261
     			    </button>';
262 262
 			}
263 263
 			else {
264
-			    $datum[9] = '';
264
+				$datum[9] = '';
265 265
 			}			    
266 266
 						
267
-            $data[] = $datum;
268
-        }
267
+			$data[] = $datum;
268
+		}
269 269
     
270
-        $controller->pageHeader();
270
+		$controller->pageHeader();
271 271
     
272
-        $controller->encode(array(
273
-            'draw'            => Filter::getInteger('draw'),
274
-            'recordsTotal'    => $recordsTotal,
275
-            'recordsFiltered' => $recordsFiltered,
276
-            'data'            => $data
277
-        ));
272
+		$controller->encode(array(
273
+			'draw'            => Filter::getInteger('draw'),
274
+			'recordsTotal'    => $recordsTotal,
275
+			'recordsFiltered' => $recordsFiltered,
276
+			'data'            => $data
277
+		));
278 278
     
279
-    }
279
+	}
280 280
 		
281 281
 	/**
282 282
 	 * AdminConfig@generateToken
283
-     *
283
+	 *
284 284
 	 * Ajax call to generate a new token. Display the token, if generated.
285 285
 	 * Tokens call only be generated by a site administrator.
286 286
 	 *
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/TaskEditView.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	 * {@inhericDoc}
27 27
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
28 28
 	 */
29
-    protected function renderContent() {
29
+	protected function renderContent() {
30 30
         
31
-        /** @var AbstractTask $task */
32
-        $task = $this->data->get('task');
33
-        ?>        
31
+		/** @var AbstractTask $task */
32
+		$task = $this->data->get('task');
33
+		?>        
34 34
         <ol class="breadcrumb small">
35 35
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
36 36
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     	</form>
123 123
 		
124 124
 		<?php        
125
-    }
125
+	}
126 126
     
127 127
 }
128 128
  
129 129
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/AdminConfigView.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 * {@inhericDoc}
23 23
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
24 24
 	 */
25
-    protected function renderContent() {
25
+	protected function renderContent() {
26 26
         
27
-        $table_id = $this->data->get('table_id');
28
-        ?>        
27
+		$table_id = $this->data->get('table_id');
28
+		?>        
29 29
         <ol class="breadcrumb small">
30 30
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
31 31
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     	</table>
69 69
 		
70 70
 		<?php        
71
-    }
71
+	}
72 72
     
73 73
 }
74 74
  
75 75
\ No newline at end of file
Please login to merge, or discard this patch.