@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'success' |
84 | 84 | ); |
85 | 85 | //phpcs:ignore Generic.Files.LineLength.TooLong |
86 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.'); |
|
86 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return Registry::responseFactory()->redirect(AdminConfigPage::class); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task.'), 'danger'); |
141 | 141 | //@phpcs:ignore Generic.Files.LineLength.TooLong |
142 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.'); |
|
142 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.'); |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | 'danger' |
172 | 172 | ); |
173 | 173 | //phpcs:ignore Generic.Files.LineLength.TooLong |
174 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.'); |
|
174 | + Log::addConfigurationLog('Module '.$this->module->title().' : AdminTask “'.$task->name().'” specific settings could not be updated. See error log.'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return true; |
@@ -56,7 +56,7 @@ |
||
56 | 56 | |
57 | 57 | $token = $this->token_service->generateRandomToken(); |
58 | 58 | $this->module->setPreference('MAJ_AT_FORCE_EXEC_TOKEN', $token); |
59 | - Log::addConfigurationLog($this->module->title() . ' : New token generated.'); |
|
59 | + Log::addConfigurationLog($this->module->title().' : New token generated.'); |
|
60 | 60 | |
61 | 61 | return Registry::responseFactory()->response(['token' => $token]); |
62 | 62 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $this->module->setPreference('MAJ_AT_FORCE_EXEC_TOKEN', $token); |
64 | 64 | } |
65 | 65 | |
66 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
66 | + return $this->viewResponse($this->module->name().'::admin/config', [ |
|
67 | 67 | 'title' => $this->module->title(), |
68 | 68 | 'trigger_token' => $token, |
69 | 69 | 'trigger_route' => route(TaskTrigger::class, ['task' => '__TASKNAME__', 'force' => '__TOKEN__']), |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | Validator::attributes($request)->boolean('enable', false) ? |
75 | - $task_schedule->enable() : |
|
76 | - $task_schedule->disable(); |
|
75 | + $task_schedule->enable() : $task_schedule->disable(); |
|
77 | 76 | |
78 | 77 | if ($this->taskschedules_service->update($task_schedule) > 0) { |
79 | 78 | FlashMessages::addMessage( |
@@ -81,14 +80,14 @@ discard block |
||
81 | 80 | 'success' |
82 | 81 | ); |
83 | 82 | //phpcs:ignore Generic.Files.LineLength.TooLong |
84 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.'); |
|
83 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.'); |
|
85 | 84 | } else { |
86 | 85 | FlashMessages::addMessage( |
87 | 86 | I18N::translate('An error occured while updating the scheduled task.'), |
88 | 87 | 'danger' |
89 | 88 | ); |
90 | 89 | //phpcs:ignore Generic.Files.LineLength.TooLong |
91 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.'); |
|
90 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.'); |
|
92 | 91 | } |
93 | 92 | |
94 | 93 | return Registry::responseFactory()->redirect(AdminConfigPage::class); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | return Registry::cache()->array()->remember( |
103 | 103 | 'maj-available-admintasks', |
104 | - function (): Collection { |
|
104 | + function(): Collection { |
|
105 | 105 | /** @var Collection<string, string> $tasks */ |
106 | 106 | $tasks = $this->module_service |
107 | 107 | ->findByInterface(ModuleTasksProviderInterface::class) |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | $query = DB::table('maj_admintasks') |
207 | 207 | ->select() |
208 | 208 | ->where('majat_status', '=', 'enabled') |
209 | - ->where(function (Builder $query): void { |
|
209 | + ->where(function(Builder $query): void { |
|
210 | 210 | $query->where('majat_running', '=', 0) |
211 | 211 | ->orWhere('majat_last_run', '<=', CarbonImmutable::now('UTC')->subSeconds(self::TASK_TIME_OUT)); |
212 | 212 | }); |
213 | 213 | |
214 | 214 | if (!$force) { |
215 | - $query->where(function (Builder $query): void { |
|
215 | + $query->where(function(Builder $query): void { |
|
216 | 216 | |
217 | 217 | $query->where('majat_last_result', '=', 0) |
218 | 218 | ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()'); |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | $task_schedule->setLastResult($task->run($task_schedule)); |
265 | 265 | } catch (Throwable $ex) { |
266 | 266 | if ($first_error) { // Only record the first error, as this could fill the log. |
267 | - Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()) . ' ' . |
|
268 | - '[' . get_class($ex) . '] ' . $ex->getMessage() . ' ' . $ex->getFile() . ':' |
|
269 | - . $ex->getLine() . PHP_EOL . $ex->getTraceAsString()); |
|
267 | + Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()).' '. |
|
268 | + '['.get_class($ex).'] '.$ex->getMessage().' '.$ex->getFile().':' |
|
269 | + . $ex->getLine().PHP_EOL.$ex->getTraceAsString()); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public static function rowMapper(): Closure |
289 | 289 | { |
290 | - return static function (stdClass $row): TaskSchedule { |
|
290 | + return static function(stdClass $row): TaskSchedule { |
|
291 | 291 | return new TaskSchedule( |
292 | - (int) $row->majat_id, |
|
292 | + (int)$row->majat_id, |
|
293 | 293 | $row->majat_task_id, |
294 | 294 | $row->majat_status === 'enabled', |
295 | 295 | CarbonImmutable::parse($row->majat_last_run, 'UTC'), |
296 | - (bool) $row->majat_last_result, |
|
297 | - (int) $row->majat_frequency, |
|
298 | - (int) $row->majat_nb_occur, |
|
299 | - (bool) $row->majat_running |
|
296 | + (bool)$row->majat_last_result, |
|
297 | + (int)$row->majat_frequency, |
|
298 | + (int)$row->majat_nb_occur, |
|
299 | + (bool)$row->majat_running |
|
300 | 300 | ); |
301 | 301 | }; |
302 | 302 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
77 | 77 | |
78 | 78 | $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', '')); |
79 | - $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
79 | + $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
80 | 80 | |
81 | 81 | $mapper = null; |
82 | 82 | try { |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | 'success' |
102 | 102 | ); |
103 | 103 | //phpcs:ignore Generic.Files.LineLength.TooLong |
104 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.'); |
|
104 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been updated.'); |
|
105 | 105 | } catch (Throwable $ex) { |
106 | 106 | FlashMessages::addMessage( |
107 | 107 | I18N::translate('An error occured while updating the map configuration.'), |
108 | 108 | 'danger' |
109 | 109 | ); |
110 | 110 | //phpcs:ignore Generic.Files.LineLength.TooLong |
111 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage()); |
|
111 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating Map Adapter “'.$map_adapter->id().'”: '.$ex->getMessage()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return Registry::responseFactory()->redirect(MapAdapterEditPage::class, [ |
@@ -81,14 +81,14 @@ |
||
81 | 81 | 'success' |
82 | 82 | ); |
83 | 83 | //phpcs:ignore Generic.Files.LineLength.TooLong |
84 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
84 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.'); |
|
85 | 85 | } catch (Throwable $ex) { |
86 | 86 | FlashMessages::addMessage( |
87 | 87 | I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
88 | 88 | 'danger' |
89 | 89 | ); |
90 | 90 | //phpcs:ignore Generic.Files.LineLength.TooLong |
91 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
91 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]); |
@@ -79,14 +79,14 @@ |
||
79 | 79 | 'success' |
80 | 80 | ); |
81 | 81 | //phpcs:ignore Generic.Files.LineLength.TooLong |
82 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.'); |
|
82 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been deleted.'); |
|
83 | 83 | } else { |
84 | 84 | FlashMessages::addMessage( |
85 | 85 | I18N::translate('An error occured while deleting the map configuration.'), |
86 | 86 | 'danger' |
87 | 87 | ); |
88 | 88 | //phpcs:ignore Generic.Files.LineLength.TooLong |
89 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.'); |
|
89 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” could not be deleted. See error log.'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [ |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | 'success' |
99 | 99 | ); |
100 | 100 | //phpcs:ignore Generic.Files.LineLength.TooLong |
101 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.'); |
|
101 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$new_view_id.'” has been added.'); |
|
102 | 102 | return Registry::responseFactory()->redirect( |
103 | 103 | GeoAnalysisViewEditPage::class, |
104 | - ['tree' => $tree->name(), 'view_id' => $new_view_id ] |
|
104 | + ['tree' => $tree->name(), 'view_id' => $new_view_id] |
|
105 | 105 | ); |
106 | 106 | } else { |
107 | 107 | FlashMessages::addMessage( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'danger' |
110 | 110 | ); |
111 | 111 | //phpcs:ignore Generic.Files.LineLength.TooLong |
112 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.'); |
|
112 | + Log::addConfigurationLog('Module '.$this->module->title().' : A new View could not be added. See error log.'); |
|
113 | 113 | return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]); |
114 | 114 | } |
115 | 115 | } |