@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tasks') === false) { |
65 | 65 | // Not allowed page |
66 | 66 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
67 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
67 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
68 | 68 | exit; |
69 | 69 | } |
70 | 70 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | // Get last cron execution timestamp |
127 | 127 | $queryResults = DB::query( |
128 | 128 | 'SELECT valeur |
129 | - FROM ' . prefixTable('misc') . ' |
|
129 | + FROM ' . prefixTable('misc').' |
|
130 | 130 | WHERE type = %s AND intitule = %s and valeur >= %d', |
131 | 131 | 'admin', |
132 | 132 | 'last_cron_exec', |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $task = isset($SETTINGS['users_personal_folder_task']) === true ? explode(";", $SETTINGS['users_personal_folder_task']) : []; |
235 | 235 | ?> |
236 | 236 | <input type='text' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'> |
237 | - <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'> |
|
237 | + <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'> |
|
238 | 238 | </div> |
239 | 239 | <div class='col-2'> |
240 | 240 | <button class="btn btn-primary task-define" data-task="users_personal_folder_task"> |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $task = isset($SETTINGS['clean_orphan_objects_task']) === true ? explode(";", $SETTINGS['clean_orphan_objects_task']) : []; |
257 | 257 | ?> |
258 | 258 | <input type='text' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'> |
259 | - <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'> |
|
259 | + <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'> |
|
260 | 260 | </div> |
261 | 261 | <div class='col-2'> |
262 | 262 | <button class="btn btn-primary task-define" data-task="clean_orphan_objects_task"> |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $task = isset($SETTINGS['purge_temporary_files_task']) === true ? explode(";", $SETTINGS['purge_temporary_files_task']) : []; |
279 | 279 | ?> |
280 | 280 | <input type='text' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'> |
281 | - <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'> |
|
281 | + <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'> |
|
282 | 282 | </div> |
283 | 283 | <div class='col-2'> |
284 | 284 | <button class="btn btn-primary task-define" data-task="purge_temporary_files_task"> |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $task = isset($SETTINGS['reload_cache_table_task']) === true ? explode(";", $SETTINGS['reload_cache_table_task']) : []; |
301 | 301 | ?> |
302 | 302 | <input type='text' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'> |
303 | - <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'> |
|
303 | + <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'> |
|
304 | 304 | </div> |
305 | 305 | <div class='col-2'> |
306 | 306 | <button class="btn btn-primary task-define" data-task="reload_cache_table_task"> |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | <h5><?php echo $lang->get('day_of_month'); ?></h5> |
518 | 518 | <select class='form-control form-control-sm no-save' id='task-define-modal-parameter-monthly-value' style="width:100%;"> |
519 | 519 | <?php |
520 | - for ($i=1; $i<=31; $i++) { |
|
520 | + for ($i = 1; $i <= 31; $i++) { |
|
521 | 521 | echo '<option value="'.$i.'">'.$lang->get('day').' '.$i.'</option>'; |
522 | 522 | } |
523 | 523 | ?> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | || isset($SETTINGS['allow_import']) === false || (int) $SETTINGS['allow_import'] !== 1) { |
72 | 72 | // Not allowed page |
73 | 73 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
74 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
74 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
75 | 75 | exit; |
76 | 76 | } |
77 | 77 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <?php |
184 | 184 | $complexitySelect = ''; |
185 | 185 | foreach (TP_PW_COMPLEXITY as $level) { |
186 | - $complexitySelect .= '<option value="' . $level[0] . '">' . $level[1] . '</option>'; |
|
186 | + $complexitySelect .= '<option value="'.$level[0].'">'.$level[1].'</option>'; |
|
187 | 187 | } |
188 | 188 | echo $complexitySelect; |
189 | 189 | ?> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('import') === false) { |
73 | 73 | // Not allowed page |
74 | 74 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
75 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
75 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
76 | 76 | exit; |
77 | 77 | } |
78 | 78 | ?> |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | // Isolate first item |
1044 | 1044 | if (itemsList.length > 0) { |
1045 | 1045 | $('#import-feedback-progress-text') |
1046 | - .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress');?> ('+((counter*100)/itemsNumber).toFixed(2)+'%) - <i id="item-title"></i>'); |
|
1046 | + .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress'); ?> ('+((counter*100)/itemsNumber).toFixed(2)+'%) - <i id="item-title"></i>'); |
|
1047 | 1047 | |
1048 | 1048 | // XSS Filtering : |
1049 | 1049 | $('#import-feedback-progress-text').text(itemsList[0].Title); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | trait ItemHandlerTrait { |
30 | 30 | |
31 | 31 | private function generateUserPasswordKeys($arguments) { |
32 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG'); |
|
32 | + if (LOG_TASKS === true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG'); |
|
33 | 33 | // Generate keys for user passwords |
34 | 34 | storeUsersShareKey( |
35 | 35 | prefixTable('sharekeys_items'), |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * @param array $taskData |
50 | 50 | */ |
51 | 51 | private function generateUserFileKeys($taskData) { |
52 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG'); |
|
53 | - foreach($taskData['files_keys'] as $file) { |
|
52 | + if (LOG_TASKS === true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG'); |
|
53 | + foreach ($taskData['files_keys'] as $file) { |
|
54 | 54 | storeUsersShareKey( |
55 | 55 | prefixTable('sharekeys_files'), |
56 | 56 | 0, |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @param array $arguments |
71 | 71 | */ |
72 | 72 | private function generateUserFieldKeys($arguments) { |
73 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG'); |
|
74 | - foreach($arguments['fields_keys'] as $field) { |
|
75 | - $this->logger->log('Processing generateUserFieldKeys for: ' . $field['object_id'], 'DEBUG'); |
|
73 | + if (LOG_TASKS === true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG'); |
|
74 | + foreach ($arguments['fields_keys'] as $field) { |
|
75 | + $this->logger->log('Processing generateUserFieldKeys for: '.$field['object_id'], 'DEBUG'); |
|
76 | 76 | storeUsersShareKey( |
77 | 77 | prefixTable('sharekeys_fields'), |
78 | 78 | 0, |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | //get through all users with enabled personnal folder. |
81 | 81 | $users = DB::query( |
82 | 82 | 'SELECT id, login, email |
83 | - FROM ' . prefixTable('users') . ' |
|
83 | + FROM ' . prefixTable('users').' |
|
84 | 84 | WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.') |
85 | 85 | AND personal_folder = 1 |
86 | 86 | ORDER BY login ASC' |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | //if folder doesn't exist then create it |
90 | 90 | $data = DB::queryFirstRow( |
91 | 91 | 'SELECT id |
92 | - FROM ' . prefixTable('nested_tree') . ' |
|
92 | + FROM ' . prefixTable('nested_tree').' |
|
93 | 93 | WHERE title = %s AND parent_id = %i', |
94 | 94 | $user['id'], |
95 | 95 | 0 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // get count of Items in this folder |
73 | 73 | $get = DB::queryFirstRow( |
74 | 74 | 'SELECT count(*) as num_results |
75 | - FROM ' . prefixTable('items') . ' |
|
75 | + FROM ' . prefixTable('items').' |
|
76 | 76 | WHERE inactif = %i AND id_tree = %i', |
77 | 77 | 0, |
78 | 78 | $child->id |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | $ret[$child->id]['id'] = $child->id; |
82 | 82 | |
83 | 83 | // get number of subfolders |
84 | - $nodeDescendants =$tree->getDescendants($child->id, false, false, true); |
|
84 | + $nodeDescendants = $tree->getDescendants($child->id, false, false, true); |
|
85 | 85 | $ret[$child->id]['subfoldersCount'] = count($nodeDescendants); |
86 | 86 | |
87 | 87 | // get items number in subfolders |
88 | 88 | if (count($nodeDescendants) > 0) { |
89 | 89 | $get = DB::queryFirstRow( |
90 | 90 | 'SELECT count(*) as num_results |
91 | - FROM ' . prefixTable('items') . ' |
|
91 | + FROM ' . prefixTable('items').' |
|
92 | 92 | WHERE inactif = %i AND id_tree IN (%l)', |
93 | 93 | 0, |
94 | 94 | implode(',', $nodeDescendants) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | // Get item key |
140 | 140 | $itemKey = DB::queryFirstRow( |
141 | 141 | 'SELECT share_key |
142 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
142 | + FROM ' . prefixTable('sharekeys_items').' |
|
143 | 143 | WHERE user_id = %i AND object_id = %i', |
144 | 144 | TP_USER_ID, |
145 | 145 | $item['itemId'] |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ) { |
77 | 77 | // Not allowed page |
78 | 78 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
79 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
79 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | // Output |
170 | 170 | $sOutput = '{'; |
171 | - $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
171 | + $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
172 | 172 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
173 | 173 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
174 | 174 | $sOutput .= '"aaData": '; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // Output |
243 | 243 | $sOutput = '{'; |
244 | - $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
244 | + $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
245 | 245 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
246 | 246 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
247 | 247 | $sOutput .= '"aaData": '; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | // Output |
316 | 316 | $sOutput = '{'; |
317 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
317 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
318 | 318 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
319 | 319 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
320 | 320 | $sOutput .= '"aaData": '; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | // Output |
389 | 389 | $sOutput = '{'; |
390 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
390 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
391 | 391 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
392 | 392 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
393 | 393 | $sOutput .= '"aaData": [ '; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | // Output |
492 | 492 | $sOutput = '{'; |
493 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
493 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
494 | 494 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
495 | 495 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
496 | 496 | $sOutput .= '"aaData": [ '; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $iTotal = 0; |
573 | 573 | } |
574 | 574 | $sOutput = '{'; |
575 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
575 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
576 | 576 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
577 | 577 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
578 | 578 | $sOutput .= '"aaData": '; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | |
649 | 649 | // Output |
650 | 650 | $sOutput = '{'; |
651 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
651 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
652 | 652 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
653 | 653 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
654 | 654 | $sOutput .= '"aaData": '; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | |
718 | 718 | // Output |
719 | 719 | $sOutput = '{'; |
720 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
720 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
721 | 721 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
722 | 722 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
723 | 723 | $sOutput .= '"aaData": '; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | |
791 | 791 | // Output |
792 | 792 | $sOutput = '{'; |
793 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
793 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
794 | 794 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
795 | 795 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
796 | 796 | $sOutput .= '"aaData": '; |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | FROM '.prefixTable('background_tasks').' AS p |
868 | 868 | LEFT JOIN '.prefixTable('users').' AS u ON %l |
869 | 869 | WHERE %l ORDER BY %l %l LIMIT %i, %i'; |
870 | - $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength]; |
|
870 | + $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength]; |
|
871 | 871 | |
872 | 872 | // Get the records |
873 | 873 | $rows = DB::query($sql, ...$params); |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | // Output |
877 | 877 | $sOutput = '{'; |
878 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
878 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
879 | 879 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
880 | 880 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
881 | 881 | $sOutput .= '"aaData": '; |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | //col1 |
891 | 891 | $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", '; |
892 | 892 | //col2 |
893 | - $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", '; |
|
893 | + $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", '; |
|
894 | 894 | //col3 |
895 | 895 | //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", '; |
896 | 896 | $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", '; |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | // col5 |
901 | 901 | if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) { |
902 | 902 | $data_user = DB::queryFirstRow( |
903 | - 'SELECT name, lastname FROM ' . prefixTable('users') . ' |
|
903 | + 'SELECT name, lastname FROM '.prefixTable('users').' |
|
904 | 904 | WHERE id = %i', |
905 | 905 | json_decode($record['arguments'], true)['new_user_id'] |
906 | 906 | ); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | FROM '.prefixTable('background_tasks').' AS p |
957 | 957 | LEFT JOIN '.prefixTable('users').' AS u ON %l |
958 | 958 | WHERE %l ORDER BY %l %l LIMIT %i, %i'; |
959 | - $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength]; |
|
959 | + $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength]; |
|
960 | 960 | |
961 | 961 | // Get the records |
962 | 962 | $rows = DB::query($sql, ...$params); |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | |
965 | 965 | // Output |
966 | 966 | $sOutput = '{'; |
967 | - $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', '; |
|
967 | + $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', '; |
|
968 | 968 | $sOutput .= '"iTotalRecords": '.$iTotal.', '; |
969 | 969 | $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', '; |
970 | 970 | $sOutput .= '"aaData": '; |
@@ -980,13 +980,12 @@ discard block |
||
980 | 980 | //col1 |
981 | 981 | $sOutput .= '"'.(is_null($record['error_message']) ? '' : addslashes($record['error_message'])).'", '; |
982 | 982 | //col2 |
983 | - $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", '; |
|
983 | + $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", '; |
|
984 | 984 | //col3 |
985 | 985 | $sOutput .= is_null($record['started_at']) === false ? |
986 | - ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') : |
|
987 | - ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", '); |
|
986 | + ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", '); |
|
988 | 987 | //col4 |
989 | - $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", '; |
|
988 | + $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", '; |
|
990 | 989 | // col7 |
991 | 990 | $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",'; |
992 | 991 | //col5 |
@@ -1009,11 +1008,10 @@ discard block |
||
1009 | 1008 | // col6 |
1010 | 1009 | $arguments = json_decode($record['arguments'], true); |
1011 | 1010 | $newUserId = array_key_exists('new_user_id', $arguments) ? |
1012 | - $arguments['new_user_id'] : |
|
1013 | - (array_key_exists('user_id', $arguments) ? $arguments['user_id'] : null); |
|
1011 | + $arguments['new_user_id'] : (array_key_exists('user_id', $arguments) ? $arguments['user_id'] : null); |
|
1014 | 1012 | if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) { |
1015 | 1013 | $data_user = DB::queryFirstRow( |
1016 | - 'SELECT name, lastname, login FROM ' . prefixTable('users') . ' |
|
1014 | + 'SELECT name, lastname, login FROM '.prefixTable('users').' |
|
1017 | 1015 | WHERE id = %i', |
1018 | 1016 | $newUserId |
1019 | 1017 | ); |
@@ -1029,7 +1027,7 @@ discard block |
||
1029 | 1027 | } elseif ($record['process_type'] === 'user_build_cache_tree') { |
1030 | 1028 | $user = json_decode($record['arguments'], true)['user_id']; |
1031 | 1029 | $data_user = DB::queryFirstRow( |
1032 | - 'SELECT name, lastname, login FROM ' . prefixTable('users') . ' |
|
1030 | + 'SELECT name, lastname, login FROM '.prefixTable('users').' |
|
1033 | 1031 | WHERE id = %i', |
1034 | 1032 | $user |
1035 | 1033 | ); |
@@ -1063,7 +1061,7 @@ discard block |
||
1063 | 1061 | { |
1064 | 1062 | $subtasks = DB::query( |
1065 | 1063 | 'SELECT * |
1066 | - FROM ' . prefixTable('background_subtasks') . ' |
|
1064 | + FROM ' . prefixTable('background_subtasks').' |
|
1067 | 1065 | WHERE task_id = %i', |
1068 | 1066 | $id |
1069 | 1067 | ); |
@@ -1079,5 +1077,5 @@ discard block |
||
1079 | 1077 | $i++; |
1080 | 1078 | } |
1081 | 1079 | |
1082 | - return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%'; |
|
1080 | + return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%'; |
|
1083 | 1081 | } |
1084 | 1082 | \ No newline at end of file |
@@ -47,8 +47,8 @@ |
||
47 | 47 | */ |
48 | 48 | public function log(string $message, string $level = 'INFO') { |
49 | 49 | if (!empty($this->settings['enable_tasks_log'])) { |
50 | - $formattedMessage = date($this->settings['date_format'] . ' ' . $this->settings['time_format']) . |
|
51 | - " - [$level] $message" . PHP_EOL; |
|
50 | + $formattedMessage = date($this->settings['date_format'].' '.$this->settings['time_format']). |
|
51 | + " - [$level] $message".PHP_EOL; |
|
52 | 52 | |
53 | 53 | if (!empty($this->logFile)) { |
54 | 54 | // WWrite to the specified log file |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | require_once __DIR__.'/traits/ItemHandlerTrait.php'; |
33 | 33 | require_once __DIR__.'/traits/UserHandlerTrait.php'; |
34 | 34 | require_once __DIR__.'/traits/EmailTrait.php'; |
35 | -require_once __DIR__ . '/taskLogger.php'; |
|
35 | +require_once __DIR__.'/taskLogger.php'; |
|
36 | 36 | |
37 | 37 | class TaskWorker { |
38 | 38 | use ItemHandlerTrait; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function execute() { |
66 | 66 | try { |
67 | - if (LOG_TASKS=== true) $this->logger->log('Processing task: ' . print_r($this->taskData, true), 'DEBUG'); |
|
67 | + if (LOG_TASKS === true) $this->logger->log('Processing task: '.print_r($this->taskData, true), 'DEBUG'); |
|
68 | 68 | // Dispatch selon le type de processus |
69 | 69 | switch ($this->processType) { |
70 | 70 | case 'item_copy': |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $arguments = ''; |
137 | 137 | } |
138 | 138 | |
139 | - if (LOG_TASKS=== true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
139 | + if (LOG_TASKS === true) $this->logger->log('Process: '.$this->processType.' -- '.print_r($arguments, true), 'DEBUG'); |
|
140 | 140 | |
141 | 141 | // Add 'arguments' only if not empty |
142 | 142 | if (!empty($arguments)) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'increment_id = %i', |
151 | 151 | $this->taskId |
152 | 152 | ); |
153 | - if (LOG_TASKS=== true) $this->logger->log('Finishing task: ' . $this->taskId, 'DEBUG'); |
|
153 | + if (LOG_TASKS === true) $this->logger->log('Finishing task: '.$this->taskId, 'DEBUG'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | 'increment_id = %i', |
174 | 174 | $this->taskId |
175 | 175 | ); |
176 | - $this->logger->log('Task failure: ' . $e->getMessage(), 'ERROR'); |
|
176 | + $this->logger->log('Task failure: '.$e->getMessage(), 'ERROR'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | * @return void |
186 | 186 | */ |
187 | 187 | private function processSubTasks($arguments) { |
188 | - if (LOG_TASKS=== true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
188 | + if (LOG_TASKS === true) $this->logger->log('processSubTasks: '.print_r($arguments, true), 'DEBUG'); |
|
189 | 189 | // Get all subtasks related to this task |
190 | 190 | $subtasks = DB::query( |
191 | - 'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
191 | + 'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC', |
|
192 | 192 | $this->taskId |
193 | 193 | ); |
194 | 194 | |
195 | 195 | // Check if there are any subtasks to process |
196 | 196 | if (empty($subtasks)) { |
197 | - if (LOG_TASKS=== true) $this->logger->log('No subtask was found for task: ' . $this->taskId, 'DEBUG'); |
|
197 | + if (LOG_TASKS === true) $this->logger->log('No subtask was found for task: '.$this->taskId, 'DEBUG'); |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // Get the subtask data |
205 | 205 | $subtaskData = json_decode($subtask['task'], true); |
206 | 206 | |
207 | - if (LOG_TASKS=== true) $this->logger->log('Processing subtask: ' . $subtaskData['step'], 'DEBUG'); |
|
207 | + if (LOG_TASKS === true) $this->logger->log('Processing subtask: '.$subtaskData['step'], 'DEBUG'); |
|
208 | 208 | |
209 | 209 | // Process the subtask based on its type |
210 | 210 | switch ($subtaskData['step'] ?? '') { |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | $subtask['increment_id'] |
249 | 249 | ); |
250 | 250 | |
251 | - $this->logger->log('processSubTasks : ' . $e->getMessage(), 'ERROR'); |
|
251 | + $this->logger->log('processSubTasks : '.$e->getMessage(), 'ERROR'); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | // Are all subtasks completed? |
256 | 256 | $remainingSubtasks = DB::queryFirstField( |
257 | - 'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0', |
|
257 | + 'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0', |
|
258 | 258 | $this->taskId |
259 | 259 | ); |
260 | 260 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | error_log("Usage: php background_tasks___worker.php <task_id> <process_type> [<task_data>]"); |
271 | 271 | exit(1); |
272 | 272 | } |
273 | -$taskId = (int)$argv[1]; |
|
273 | +$taskId = (int) $argv[1]; |
|
274 | 274 | $processType = $argv[2]; |
275 | 275 | $taskData = $argv[3] ?? null; |
276 | 276 | if ($taskData) { |