Passed
Push — develop ( f46262...cc5787 )
by Nikolay
07:20 queued 11s
created
tests/PBXCoreREST/Lib/FilesManagementProcessorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     public function testScanDirRecursively()
20 20
     {
21
-        $logDir     = System::getLogDir();
21
+        $logDir = System::getLogDir();
22 22
         $entries = FilesManagementProcessor::scanDirRecursively($logDir);
23 23
         $this->assertTrue(true);
24 24
     }
Please login to merge, or discard this patch.
src/PBXCoreREST/Controllers/System/GetController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 'action'    => $actionName,
46 46
             ]
47 47
         );
48
-        $connection     = $this->di->getShared('beanstalkConnection');
48
+        $connection = $this->di->getShared('beanstalkConnection');
49 49
 
50 50
         if ($actionName === 'stopLog') {
51 51
             $response = $connection->request($requestMessage, 60, 0);
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
             if ($actionName === 'stopLog') {
63 63
                 $di           = Di::getDefault();
64 64
                 $downloadLink = $di->getShared('config')->path('www.downloadCacheDir');
65
-                $filename     = $downloadLink . "/" . $response['data']['filename'] ?? '';
66
-                if ( ! file_exists($filename)) {
65
+                $filename     = $downloadLink."/".$response['data']['filename'] ?? '';
66
+                if (!file_exists($filename)) {
67 67
                     $this->response->setPayloadSuccess('Log file not found.');
68 68
 
69 69
                     return;
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             } elseif ($actionName === 'getLogFromFile') {
80 80
                 $this->response->setPayloadSuccess('Log file not found.');
81 81
                 $filename = $response['data']['filename'] ?? '';
82
-                if ( ! file_exists($filename)) {
82
+                if (!file_exists($filename)) {
83 83
                     $this->response->setPayloadSuccess('Log file not found.');
84 84
 
85 85
                     return;
86 86
                 }
87
-                $response['data']['filename']  = $filename;
88
-                $response['data']['content'] = '' . file_get_contents($filename);
87
+                $response['data']['filename'] = $filename;
88
+                $response['data']['content'] = ''.file_get_contents($filename);
89 89
                 //unlink($filename);
90 90
                 $this->response->setPayloadSuccess($response);
91 91
             } else {
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/LogsManagementProcessor.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
         self::stopLog();
34 34
         $dir_all_log = System::getLogDir();
35 35
         $findPath    = Util::which('find');
36
-        Util::mwExec("{$findPath} {$dir_all_log}" . '/ -name *_start_all_log* | xargs rm -rf');
36
+        Util::mwExec("{$findPath} {$dir_all_log}".'/ -name *_start_all_log* | xargs rm -rf');
37 37
         // Получим каталог с логами.
38
-        $dirlog = $dir_all_log . '/dir_start_all_log';
38
+        $dirlog = $dir_all_log.'/dir_start_all_log';
39 39
         Util::mwMkdir($dirlog);
40 40
 
41 41
         $pingPath = Util::which('ping');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 "{$dirlog}/{$eth}_out.log"
76 76
             );
77 77
         }
78
-        $res->success=true;
78
+        $res->success = true;
79 79
         return $res;
80 80
     }
81 81
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
         $findPath = Util::which('find');
99 99
         $za7Path  = Util::which('7za');
100 100
         $cpPath   = Util::which('cp');
101
-        $chownPath   = Util::which('chown');
101
+        $chownPath = Util::which('chown');
102 102
 
103
-        $dirlog = $dir_all_log . '/dir_start_all_log';
103
+        $dirlog = $dir_all_log.'/dir_start_all_log';
104 104
         Util::mwMkdir($dirlog);
105 105
 
106 106
         $log_dir = System::getLogDir();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
         // Файл будет удален в cron скриптом cleaner_download_links.sh т.к. имя содержит "/temp-"
113 113
         // через 5 минут, если не будет занят процессом.
114
-        $result     = $dirsConfig->path('core.tempDir') . '/temp-all-log-'.time().'.zip';
114
+        $result = $dirsConfig->path('core.tempDir').'/temp-all-log-'.time().'.zip';
115 115
 
116 116
         if (file_exists($result)) {
117 117
             Util::mwExec("{$rmPath} -rf {$result}");
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
         // Пакуем логи.
120 120
         Util::mwExec("{$za7Path} a -tzip -mx0 -spf '{$result}' '{$dirlog}'");
121 121
         // Удаляем логи. Оставляем только архив.
122
-        Util::mwExec("{$findPath} {$dir_all_log}" . '/ -name *_start_all_log | xargs rm -rf');
122
+        Util::mwExec("{$findPath} {$dir_all_log}".'/ -name *_start_all_log | xargs rm -rf');
123 123
 
124 124
         if (file_exists($dirlog)) {
125
-            Util::mwExec("{$findPath} {$dirlog}" . '/ -name license.key | xargs rm -rf');
125
+            Util::mwExec("{$findPath} {$dirlog}".'/ -name license.key | xargs rm -rf');
126 126
         }
127 127
         // Удаляем каталог логов.
128 128
         Util::mwExecBg("{$rmPath} -rf {$dirlog}");
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
         $downloadLink = $di->getShared('config')->path('www.downloadCacheDir');
134 134
         $result_dir = "{$downloadLink}/{$uid}";
135 135
         Util::mwMkdir($result_dir);
136
-        $link_name = md5($result) . '.' . Util::getExtensionOfFile($result);
136
+        $link_name = md5($result).'.'.Util::getExtensionOfFile($result);
137 137
         $lnPath = Util::which('ln');
138 138
 
139 139
         Util::mwExec("{$lnPath} -s {$result} {$result_dir}/{$link_name}");
140 140
         Util::mwExec("{$chownPath} www:www {$result_dir}/{$link_name}");
141 141
 
142
-        $res->success=true;
142
+        $res->success = true;
143 143
         $res->data['filename'] = "{$uid}/{$link_name}";
144 144
         return $res;
145 145
     }
@@ -153,23 +153,23 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $res = new PBXApiResult();
155 155
         $res->processor = __METHOD__;
156
-        $logDir     = System::getLogDir();
156
+        $logDir = System::getLogDir();
157 157
         $filesList = [];
158 158
         $entries = FilesManagementProcessor::scanDirRecursively($logDir);
159 159
         $entries = array_merge(...$entries);
160
-        foreach($entries as $entry) {
161
-            $relativePath = str_ireplace($logDir. '/', '', $entry);
162
-            $fileSize = ceil(filesize($entry)/1024);
160
+        foreach ($entries as $entry) {
161
+            $relativePath = str_ireplace($logDir.'/', '', $entry);
162
+            $fileSize = ceil(filesize($entry) / 1024);
163 163
             $filesList[$relativePath] =
164 164
             [
165 165
                 'path'=> $relativePath,
166 166
                 'size'=> "{$fileSize} kb",
167
-                'default'=>($relativePath===self::DEFAULT_FILENAME)
167
+                'default'=>($relativePath === self::DEFAULT_FILENAME)
168 168
             ];
169 169
         }
170 170
 
171 171
         ksort($filesList);
172
-        $res->success=true;
172
+        $res->success = true;
173 173
         $res->data['files'] = $filesList;
174 174
         return $res;
175 175
     }
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $res = new PBXApiResult();
189 189
         $res->processor = __METHOD__;
190
-        if ( ! file_exists($filename)) {
191
-            $filename = System::getLogDir() . '/' . $filename;
190
+        if (!file_exists($filename)) {
191
+            $filename = System::getLogDir().'/'.$filename;
192 192
         }
193
-        if ( ! file_exists($filename)) {
193
+        if (!file_exists($filename)) {
194 194
             $res->success    = false;
195
-            $res->messages[] = 'No access to the file ' . $filename;
195
+            $res->messages[] = 'No access to the file '.$filename;
196 196
         } else {
197 197
             $res->success = true;
198 198
             $cat          = Util::which('cat');
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 
202 202
             $di          = Di::getDefault();
203 203
             $dirsConfig  = $di->getShared('config');
204
-            $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.log';
205
-            $cmd         = "{$cat} {$filename} | {$grep} " . escapeshellarg($filter) . " | $tail -n " . escapeshellarg(
204
+            $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.log';
205
+            $cmd         = "{$cat} {$filename} | {$grep} ".escapeshellarg($filter)." | $tail -n ".escapeshellarg(
206 206
                     $lines
207
-                ) . "> $filenameTmp";
207
+                )."> $filenameTmp";
208 208
             Util::mwExec("$cmd; chown www:www $filenameTmp");
209 209
             $res->data['filename'] = $filenameTmp;
210 210
         }
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/FilesManagementProcessor.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
             );
61 61
 
62 62
             if (isset($resumableIdentifier) && trim($resumableIdentifier) !== '') {
63
-                $temp_dir         = $uploadDir . '/' . Util::trimExtensionForFile(basename($resumableFilename));
64
-                $temp_dst_file    = $uploadDir . '/' . $upload_id . '/' . $upload_id . '_' . basename(
63
+                $temp_dir         = $uploadDir.'/'.Util::trimExtensionForFile(basename($resumableFilename));
64
+                $temp_dst_file    = $uploadDir.'/'.$upload_id.'/'.$upload_id.'_'.basename(
65 65
                         $resumableFilename
66 66
                     );
67
-                $chunks_dest_file = $temp_dir . '/' . $resumableFilename . '.part' . $resumableChunkNumber;
67
+                $chunks_dest_file = $temp_dir.'/'.$resumableFilename.'.part'.$resumableChunkNumber;
68 68
             } else {
69
-                $temp_dir         = $uploadDir . '/' . $upload_id;
70
-                $temp_dst_file    = $temp_dir . '/' . $upload_id . '_' . basename($file->getClientFilename());
69
+                $temp_dir         = $uploadDir.'/'.$upload_id;
70
+                $temp_dst_file    = $temp_dir.'/'.$upload_id.'_'.basename($file->getClientFilename());
71 71
                 $chunks_dest_file = $temp_dst_file;
72 72
             }
73
-            if ( ! Util::mwMkdir($temp_dir) || ! Util::mwMkdir(dirname($temp_dst_file))) {
73
+            if (!Util::mwMkdir($temp_dir) || !Util::mwMkdir(dirname($temp_dst_file))) {
74 74
                 Util::sysLogMsg('UploadFile', "Error create dir '$temp_dir'");
75 75
                 $res->success    = false;
76 76
                 $res->messages[] = "Error create dir '{$temp_dir}'";
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                         ],
94 94
                         'action' => 'merge',
95 95
                     ];
96
-                    $settings_file  = "{$temp_dir}/merge_settings";
96
+                    $settings_file = "{$temp_dir}/merge_settings";
97 97
                     file_put_contents(
98 98
                         $settings_file,
99 99
                         json_encode($merge_settings, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
                 $res->data['upload_id'] = $upload_id;
114 114
                 $res->data['filename']  = $temp_dst_file;
115 115
                 $res->data['d_status']  = 'UPLOAD_COMPLETE';
116
-                file_put_contents($temp_dir . '/progress', '100');
116
+                file_put_contents($temp_dir.'/progress', '100');
117 117
 
118 118
                 Util::mwExecBg(
119
-                    '/sbin/shell_functions.sh killprocesses ' . $temp_dir . ' -TERM 0;rm -rf ' . $temp_dir,
119
+                    '/sbin/shell_functions.sh killprocesses '.$temp_dir.' -TERM 0;rm -rf '.$temp_dir,
120 120
                     '/dev/null',
121 121
                     120
122 122
                 );
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
         $uploadDir = $di->getShared('config')->path('www.uploadDir');
148 148
         if ($postData && isset($postData['id'])) {
149 149
             $upload_id     = $postData['id'];
150
-            $progress_dir  = $uploadDir . '/' . $upload_id;
151
-            $progress_file = $progress_dir . '/progress';
150
+            $progress_dir  = $uploadDir.'/'.$upload_id;
151
+            $progress_file = $progress_dir.'/progress';
152 152
 
153 153
             if (empty($upload_id)) {
154 154
                 $res->success                   = false;
155 155
                 $res->data['d_status_progress'] = '0';
156 156
                 $res->data['d_status']          = 'ID_NOT_SET';
157
-            } elseif ( ! file_exists($progress_file) && file_exists($progress_dir)) {
157
+            } elseif (!file_exists($progress_file) && file_exists($progress_dir)) {
158 158
                 $res->success                   = true;
159 159
                 $res->data['d_status_progress'] = '0';
160 160
                 $res->data['d_status']          = 'INPROGRESS';
161
-            } elseif ( ! file_exists($progress_dir)) {
161
+            } elseif (!file_exists($progress_dir)) {
162 162
                 $res->success                   = false;
163 163
                 $res->data['d_status_progress'] = '0';
164 164
                 $res->data['d_status']          = 'NOT_FOUND';
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $res            = new PBXApiResult();
188 188
         $res->processor = __METHOD__;
189
-        if ( ! file_exists($filename)) {
189
+        if (!file_exists($filename)) {
190 190
             $res->success    = false;
191 191
             $res->messages[] = "File '{$filename}' not found.";
192 192
 
193 193
             return $res;
194 194
         }
195 195
         $out          = [];
196
-        $tmp_filename = '/tmp/' . time() . "_" . basename($filename);
196
+        $tmp_filename = '/tmp/'.time()."_".basename($filename);
197 197
         if (false === copy($filename, $tmp_filename)) {
198 198
             $res->success    = false;
199 199
             $res->messages[] = "Unable to create temporary file '{$tmp_filename}'.";
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
         // Принудительно устанавливаем расширение файла в wav.
205
-        $n_filename     = Util::trimExtensionForFile($filename) . ".wav";
206
-        $n_filename_mp3 = Util::trimExtensionForFile($filename) . ".mp3";
205
+        $n_filename     = Util::trimExtensionForFile($filename).".wav";
206
+        $n_filename_mp3 = Util::trimExtensionForFile($filename).".mp3";
207 207
         // Конвертируем файл.
208 208
         $tmp_filename = escapeshellcmd($tmp_filename);
209 209
         $n_filename   = escapeshellcmd($n_filename);
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
             $grepPath    = Util::which('grep');
253 253
             $echoPath    = Util::which('echo');
254 254
             $awkPath     = Util::which('awk');
255
-            $cmd         = 'f="' . $filePath . '"; p=`' . $sevenZaPath . ' l $f | ' . $grepPath . ' module.json`;if [ "$?" == "0" ]; then ' . $sevenZaPath . ' -so e -y -r $f `' . $echoPath . ' $p |  ' . $awkPath . ' -F" " \'{print $6}\'`; fi';
255
+            $cmd         = 'f="'.$filePath.'"; p=`'.$sevenZaPath.' l $f | '.$grepPath.' module.json`;if [ "$?" == "0" ]; then '.$sevenZaPath.' -so e -y -r $f `'.$echoPath.' $p |  '.$awkPath.' -F" " \'{print $6}\'`; fi';
256 256
 
257 257
             Util::mwExec($cmd, $out);
258 258
             $settings = json_decode(implode("\n", $out), true);
259 259
 
260 260
             $moduleUniqueID = $settings['moduleUniqueID'] ?? null;
261
-            if ( ! $moduleUniqueID) {
261
+            if (!$moduleUniqueID) {
262 262
                 $res->messages[] = 'The" moduleUniqueID " in the module file is not described.the json or file does not exist.';
263 263
 
264 264
                 return $res;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             $res->data[]  = rawurlencode(file_get_contents($filename));
296 296
         } else {
297 297
             $res->success    = false;
298
-            $res->messages[] = 'No access to the file ' . $filename;
298
+            $res->messages[] = 'No access to the file '.$filename;
299 299
         }
300 300
 
301 301
         return $res;
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
         }
321 321
         $rmPath = Util::which('rm');
322 322
         $module = 'NewFirmware';
323
-        if ( ! file_exists($tempDir . "/{$module}")) {
324
-            Util::mwMkdir($tempDir . "/{$module}");
323
+        if (!file_exists($tempDir."/{$module}")) {
324
+            Util::mwMkdir($tempDir."/{$module}");
325 325
         } else {
326 326
             // Чистим файлы, загруженные онлайн.
327 327
             Util::mwExec("{$rmPath} -rf {$tempDir}/{$module}/* ");
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 
342 342
         $workerDownloaderPath = Util::getFilePathByClassName(WorkerDownloader::class);
343 343
 
344
-        file_put_contents($tempDir . "/{$module}/progress", '0');
344
+        file_put_contents($tempDir."/{$module}/progress", '0');
345 345
         file_put_contents(
346
-            $tempDir . "/{$module}/download_settings.json",
346
+            $tempDir."/{$module}/download_settings.json",
347 347
             json_encode($download_settings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
348 348
         );
349 349
         $phpPath = Util::which('php');
350
-        Util::mwExecBg("{$phpPath} -f {$workerDownloaderPath} " . $tempDir . "/{$module}/download_settings.json");
350
+        Util::mwExecBg("{$phpPath} -f {$workerDownloaderPath} ".$tempDir."/{$module}/download_settings.json");
351 351
 
352 352
         $res                   = new PBXApiResult();
353 353
         $res->processor        = __METHOD__;
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
         } else {
376 376
             $tempDir = '/tmp';
377 377
         }
378
-        $modulesDir    = $tempDir . '/NewFirmware';
379
-        $progress_file = $modulesDir . '/progress';
378
+        $modulesDir    = $tempDir.'/NewFirmware';
379
+        $progress_file = $modulesDir.'/progress';
380 380
 
381 381
         $error = '';
382
-        if (file_exists($modulesDir . '/error')) {
383
-            $error = trim(file_get_contents($modulesDir . '/error'));
382
+        if (file_exists($modulesDir.'/error')) {
383
+            $error = trim(file_get_contents($modulesDir.'/error'));
384 384
         }
385 385
 
386
-        if ( ! file_exists($progress_file)) {
386
+        if (!file_exists($progress_file)) {
387 387
             $res->data['d_status_progress'] = '0';
388 388
             $res->data['d_status']          = 'NOT_FOUND';
389 389
         } elseif ('' !== $error) {
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
             $res->data['filePath']          = "{$tempDir}/NewFirmware/update.img";
397 397
         } else {
398 398
             $res->data['d_status_progress'] = file_get_contents($progress_file);
399
-            $d_pid                          = Util::getPidOfProcess($tempDir . '/NewFirmware/download_settings.json');
399
+            $d_pid                          = Util::getPidOfProcess($tempDir.'/NewFirmware/download_settings.json');
400 400
             if (empty($d_pid)) {
401 401
                 $res->data['d_status'] = 'DOWNLOAD_ERROR';
402 402
                 $error                 = '';
403
-                if (file_exists($modulesDir . '/error')) {
404
-                    $error = file_get_contents($modulesDir . '/error');
403
+                if (file_exists($modulesDir.'/error')) {
404
+                    $error = file_get_contents($modulesDir.'/error');
405 405
                 }
406 406
                 $res->data['d_error'] = $error;
407 407
             } else {
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
         } else {
483 483
             $tempDir = '/tmp';
484 484
         }
485
-        $moduleDirTmp  = $tempDir . '/' . $moduleUniqueID;
486
-        $progress_file = $moduleDirTmp . '/progress';
485
+        $moduleDirTmp  = $tempDir.'/'.$moduleUniqueID;
486
+        $progress_file = $moduleDirTmp.'/progress';
487 487
         $error         = '';
488
-        if (file_exists($moduleDirTmp . '/error')) {
489
-            $error = trim(file_get_contents($moduleDirTmp . '/error'));
488
+        if (file_exists($moduleDirTmp.'/error')) {
489
+            $error = trim(file_get_contents($moduleDirTmp.'/error'));
490 490
         }
491 491
 
492 492
         // Ожидание запуска процесса загрузки.
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
             usleep(500000);
496 496
         }
497 497
 
498
-        if ( ! file_exists($progress_file)) {
498
+        if (!file_exists($progress_file)) {
499 499
             $res->data['d_status_progress'] = '0';
500 500
             $res->data['d_status']          = 'NOT_FOUND';
501 501
             $res->success                   = false;
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
             $res->success                   = true;
512 512
         } else {
513 513
             $res->data['d_status_progress'] = file_get_contents($progress_file);
514
-            $d_pid                          = Util::getPidOfProcess($moduleDirTmp . '/download_settings.json');
514
+            $d_pid                          = Util::getPidOfProcess($moduleDirTmp.'/download_settings.json');
515 515
             if (empty($d_pid)) {
516 516
                 $res->data['d_status'] = 'DOWNLOAD_ERROR';
517 517
                 $error                 = '';
518
-                if (file_exists($moduleDirTmp . '/error')) {
519
-                    $error = file_get_contents($moduleDirTmp . '/error');
518
+                if (file_exists($moduleDirTmp.'/error')) {
519
+                    $error = file_get_contents($moduleDirTmp.'/error');
520 520
                 }
521 521
                 $res->messages[] = $error;
522 522
                 $res->success    = false;
@@ -541,14 +541,14 @@  discard block
 block discarded – undo
541 541
         $res            = new PBXApiResult();
542 542
         $res->processor = __METHOD__;
543 543
         $extension      = Util::getExtensionOfFile($filePath);
544
-        if ( ! in_array($extension, ['mp3', 'wav', 'alaw'])) {
544
+        if (!in_array($extension, ['mp3', 'wav', 'alaw'])) {
545 545
             $res->success    = false;
546 546
             $res->messages[] = "It is forbidden to remove the file type $extension.";
547 547
 
548 548
             return $res;
549 549
         }
550 550
 
551
-        if ( ! file_exists($filePath)) {
551
+        if (!file_exists($filePath)) {
552 552
             $res->success         = true;
553 553
             $res->data['message'] = "File '{$filePath}' already deleted";
554 554
 
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
         $out = [];
559 559
 
560 560
         $arrDeletedFiles = [
561
-            escapeshellarg(Util::trimExtensionForFile($filePath) . ".wav"),
562
-            escapeshellarg(Util::trimExtensionForFile($filePath) . ".mp3"),
563
-            escapeshellarg(Util::trimExtensionForFile($filePath) . ".alaw"),
561
+            escapeshellarg(Util::trimExtensionForFile($filePath).".wav"),
562
+            escapeshellarg(Util::trimExtensionForFile($filePath).".mp3"),
563
+            escapeshellarg(Util::trimExtensionForFile($filePath).".alaw"),
564 564
         ];
565 565
 
566 566
         $rmPath = Util::which('rm');
567
-        Util::mwExec("{$rmPath} -rf " . implode(' ', $arrDeletedFiles), $out);
567
+        Util::mwExec("{$rmPath} -rf ".implode(' ', $arrDeletedFiles), $out);
568 568
         if (file_exists($filePath)) {
569 569
             $res->success  = false;
570 570
             $res->messages = $out;
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $res            = new PBXApiResult();
589 589
         $res->processor = __METHOD__;
590 590
         $moduleMetadata = FilesManagementProcessor::getMetadataFromModuleFile($filePath);
591
-        if ( ! $moduleMetadata->success) {
591
+        if (!$moduleMetadata->success) {
592 592
             return $moduleMetadata;
593 593
         } else {
594 594
             $moduleUniqueID = $moduleMetadata->data['uniqid'];
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
         if (class_exists($pbxExtensionSetupClass)
628 628
             && method_exists($pbxExtensionSetupClass, 'installModule')) {
629 629
             $setup = new $pbxExtensionSetupClass($moduleUniqueID);
630
-            if ( ! $setup->installModule()) {
630
+            if (!$setup->installModule()) {
631 631
                 $res->success    = false;
632 632
                 $res->messages[] = $setup->getMessages();
633 633
             }
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
                 continue;
720 720
             }
721 721
             //if current file ($d) is a directory, call scanDirRecursively
722
-            if (is_dir($dir . '/' . $d)) {
723
-                $list[] = self::scanDirRecursively($dir . '/' . $d);
722
+            if (is_dir($dir.'/'.$d)) {
723
+                $list[] = self::scanDirRecursively($dir.'/'.$d);
724 724
                 //otherwise, add the file to the list
725
-            } elseif (is_file($dir . '/' . $d) || is_link($dir . '/' . $d)) {
726
-                $list[] = $dir . '/' . $d;
725
+            } elseif (is_file($dir.'/'.$d) || is_link($dir.'/'.$d)) {
726
+                $list[] = $dir.'/'.$d;
727 727
             }
728 728
         }
729 729
 
Please login to merge, or discard this patch.
src/Core/System/Configs/NatsConf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public static function logRotate(): void
35 35
     {
36
-        $log_dir = System::getLogDir() . '/nats';
36
+        $log_dir = System::getLogDir().'/nats';
37 37
         $gnatsdPath = Util::which('gnatsd');
38 38
         $pid     = Util::getPidOfProcess($gnatsdPath, 'custom_modules');
39 39
         $max_size = 1;
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
         if (Util::mFileSize("{$log_dir}/gnatsd.log") > $mb10) {
63 63
             $options = '-f';
64 64
         }
65
-        $di     = Di::getDefault();
66
-        if ($di !== null){
65
+        $di = Di::getDefault();
66
+        if ($di !== null) {
67 67
             $varEtcDir = $di->getConfig()->path('core.varEtcDir');
68 68
         } else {
69 69
             $varEtcDir = '/var/etc';
70 70
         }
71
-        $path_conf  = $varEtcDir . '/gnatsd_logrotate.conf';
71
+        $path_conf = $varEtcDir.'/gnatsd_logrotate.conf';
72 72
         file_put_contents($path_conf, $text_config);
73 73
         if (file_exists("{$log_dir}/gnatsd.log")) {
74 74
             $logrotatePath = Util::which('logrotate');
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $confdir = '/etc/nats';
85 85
         Util::mwMkdir($confdir);
86 86
 
87
-        $logdir = System::getLogDir() . '/nats';
87
+        $logdir = System::getLogDir().'/nats';
88 88
         Util::mwMkdir($logdir);
89 89
 
90 90
         $tempDir = $this->config->path('core.tempDir');
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             'sessions_path'    => $sessionsDir,
106 106
             'log_file'         => "{$logdir}/gnatsd.log",
107 107
         ];
108
-        $config   = '';
108
+        $config = '';
109 109
         foreach ($settings as $key => $val) {
110 110
             $config .= "{$key}: {$val} \n";
111 111
         }
Please login to merge, or discard this patch.
src/AdminCabinet/Forms/SystemDiagnosticForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         $this->add($filenames);
33 33
 
34 34
         $this->add(new Text('filter', ['value' => '']));
35
-        $this->add(new Numeric('lines',  ['value' => '500']));
35
+        $this->add(new Numeric('lines', ['value' => '500']));
36 36
 
37 37
     }
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/SystemDiagnosticController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     public function indexAction(): void
17 17
     {
18 18
 
19
-        $this->view->form     = new SystemDiagnosticForm();
19
+        $this->view->form = new SystemDiagnosticForm();
20 20
 
21 21
         // $fileData = FilesManagementProcessor::getLogFromFile(SystemDiagnosticForm::DEFAULT_FILENAME);
22 22
         // if($fileData->success){
Please login to merge, or discard this patch.