@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public const SELECT_CDR_TUBE = 'select_cdr_tube'; |
25 | 25 | public const UPDATE_CDR_TUBE = 'update_cdr_tube'; |
26 | - protected int $maxProc=1; |
|
26 | + protected int $maxProc = 1; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | private BeanstalkClient $client_queue; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ] |
92 | 92 | ]; |
93 | 93 | |
94 | - $results = Users::find($parameters); |
|
94 | + $results = Users::find($parameters); |
|
95 | 95 | foreach ($results as $record) { |
96 | 96 | if (empty($record->email)) { |
97 | 97 | continue; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function getActiveIdChannels(): array |
162 | 162 | { |
163 | - $am = Util::getAstManager('off'); |
|
163 | + $am = Util::getAstManager('off'); |
|
164 | 164 | return $am->GetChannels(true); |
165 | 165 | } |
166 | 166 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $this->no_answered_calls[$row['linkedid']]['NOANSWER'] = false; |
176 | 176 | return; |
177 | 177 | } |
178 | - if ( ! array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
178 | + if (!array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
179 | 179 | // dst_num - не является номером сотрудника. Это исходящий. |
180 | 180 | return; |
181 | 181 | } |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | if (!empty($row['recordingfile'])) { |
241 | 241 | // Удаляем файлы |
242 | 242 | $p_info = pathinfo($row['recordingfile']); |
243 | - $fileName = $p_info['dirname'] . '/' . $p_info['filename']; |
|
244 | - $file_list = [$fileName . '.mp3', $fileName . '.wav', $fileName . '_in.wav', $fileName . '_out.wav',]; |
|
243 | + $fileName = $p_info['dirname'].'/'.$p_info['filename']; |
|
244 | + $file_list = [$fileName.'.mp3', $fileName.'.wav', $fileName.'_in.wav', $fileName.'_out.wav', ]; |
|
245 | 245 | foreach ($file_list as $file) { |
246 | 246 | if (!file_exists($file) || is_dir($file)) { |
247 | 247 | continue; |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | /** |
265 | 265 | */ |
266 | - private function getCheckResult(){ |
|
266 | + private function getCheckResult() { |
|
267 | 267 | $result_data = $this->client_queue->getBody(); |
268 | 268 | // Получаем результат. |
269 | 269 | $result = json_decode($result_data, true); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $result = $file_data; |
276 | 276 | } |
277 | - if ( ! is_array($result) && ! is_object($result)) { |
|
277 | + if (!is_array($result) && !is_object($result)) { |
|
278 | 278 | $result = []; |
279 | 279 | } |
280 | 280 | return $result; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | Processes::mwExec("rm -rf {$row['recordingfile']}"); |
300 | 300 | } |
301 | 301 | } elseif (!empty($row['recordingfile']) && |
302 | - !file_exists(Util::trimExtensionForFile($row['recordingfile']) . '.wav') && |
|
302 | + !file_exists(Util::trimExtensionForFile($row['recordingfile']).'.wav') && |
|
303 | 303 | !file_exists($row['recordingfile'])) { |
304 | 304 | /** @var CallDetailRecordsTmp $rec_data */ |
305 | 305 | $rec_data = CallDetailRecordsTmp::findFirst("linkedid='{$row['linkedid']}' AND dst_chan='{$row['dst_chan']}'"); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | file_put_contents($this->getPidFile(), $activeProcesses); |
88 | 88 | } else { |
89 | 89 | $pidFilesDir = dirname($this->getPidFile()); |
90 | - $pidFile = $pidFilesDir . '/' . pathinfo($this->getPidFile(), PATHINFO_BASENAME); |
|
90 | + $pidFile = $pidFilesDir.'/'.pathinfo($this->getPidFile(), PATHINFO_BASENAME); |
|
91 | 91 | // Delete old PID files |
92 | 92 | $rm = Util::which('rm'); |
93 | 93 | Processes::mwExec("{$rm} -rf {$pidFile}*"); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function pingCallBack(BeanstalkClient $message): void |
127 | 127 | { |
128 | - $message->reply(json_encode($message->getBody() . ':pong')); |
|
128 | + $message->reply(json_encode($message->getBody().':pong')); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function __destruct() |
166 | 166 | { |
167 | 167 | $pidFilesDir = dirname($this->getPidFile()); |
168 | - $pidFile = $pidFilesDir . '/' . pathinfo($this->getPidFile(), PATHINFO_BASENAME); |
|
168 | + $pidFile = $pidFilesDir.'/'.pathinfo($this->getPidFile(), PATHINFO_BASENAME); |
|
169 | 169 | // Delete old PID files |
170 | 170 | $rm = Util::which('rm'); |
171 | 171 | Processes::mwExec("{$rm} -rf {$pidFile}*"); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | if (false === $result) { |
167 | 167 | Processes::processPHPWorker($workerClassName); |
168 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
168 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
169 | 169 | } |
170 | 170 | $time_elapsed_secs = microtime(true) - $start; |
171 | 171 | if ($time_elapsed_secs > 10) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | if ($res_ping === false && $level < 10) { |
235 | 235 | Processes::processPHPWorker($workerClassName); |
236 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
236 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
237 | 237 | // Wait 1 second while service will be ready to listen requests |
238 | 238 | sleep(1); |
239 | 239 |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | $orign_chan = $agi->get_variable("orign_chan", true); |
33 | 33 | $id = $agi->get_variable("pt1c_UNIQUEID", true); |
34 | 34 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
35 | - if ($id == '' || ! empty($QUEUE_SRC_CHAN)) { |
|
35 | + if ($id == '' || !empty($QUEUE_SRC_CHAN)) { |
|
36 | 36 | // Если это вызов на агента очереди !empty($QUEUE_SRC_CHAN). |
37 | 37 | // Если это новый вызов $id == ''. |
38 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
38 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
39 | 39 | } |
40 | 40 | // Канал, AGI скрипта. |
41 | 41 | $channel = $agi->request['agi_channel']; |
42 | - $is_local = ! (stripos($channel, 'local/') === false); |
|
42 | + $is_local = !(stripos($channel, 'local/') === false); |
|
43 | 43 | if ($QUEUE_SRC_CHAN != '' && $is_local) { |
44 | 44 | // Это LOCAL, Переопределим на исходный. |
45 | 45 | $channel = $QUEUE_SRC_CHAN; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | $data['action'] = "$action"; |
57 | - if ( ! empty($IS_ORGNT)) { |
|
57 | + if (!empty($IS_ORGNT)) { |
|
58 | 58 | $dst_num = $agi->request['agi_callerid']; |
59 | 59 | $src_num = $agi->request['agi_extension']; |
60 | 60 | $data['dialstatus'] = 'ORIGINATE'; |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $num = substr($agi->request['agi_channel'], $p_start, $p_end); |
66 | 66 | |
67 | 67 | $p_start = strpos($agi->request['agi_channel'], ';'); |
68 | - $dst_chan = substr($agi->request['agi_channel'], 0, $p_start) . ';1'; |
|
68 | + $dst_chan = substr($agi->request['agi_channel'], 0, $p_start).';1'; |
|
69 | 69 | |
70 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $num . '_' . $IS_ORGNT; |
|
70 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$num.'_'.$IS_ORGNT; |
|
71 | 71 | $data['dst_chan'] = $dst_chan; |
72 | 72 | } else { |
73 | 73 | $src_num = $agi->request['agi_callerid']; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $data['agi_channel'] = $agi->request['agi_channel']; |
85 | 85 | $data['did'] = $agi->get_variable("FROM_DID", true); |
86 | 86 | $data['from_account'] = $from_account; |
87 | - $data['IS_ORGNT'] = ! empty($IS_ORGNT); |
|
87 | + $data['IS_ORGNT'] = !empty($IS_ORGNT); |
|
88 | 88 | |
89 | 89 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
90 | 90 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
118 | - if ( ! empty($IS_ORGNT)) { |
|
118 | + if (!empty($IS_ORGNT)) { |
|
119 | 119 | // Вероятно необходимо переопределить искать по двум ID. |
120 | 120 | // Применимо только для Originate, когда в качестве звонящего используем два канала |
121 | 121 | // мобильный и внутренний номер. |
122 | 122 | $peer_mobile = $agi->get_variable("peer_mobile", true); |
123 | - if ( ! empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
124 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $peer_mobile . '_' . $IS_ORGNT; |
|
123 | + if (!empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
124 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$peer_mobile.'_'.$IS_ORGNT; |
|
125 | 125 | $data['org_id'] = $id; |
126 | 126 | } |
127 | 127 | } |
@@ -154,22 +154,22 @@ discard block |
||
154 | 154 | $data['BRIDGEPEER'] = $agi->get_variable("FROM_CHAN", true); |
155 | 155 | |
156 | 156 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
157 | - if ( ! empty($IS_ORGNT)) { |
|
157 | + if (!empty($IS_ORGNT)) { |
|
158 | 158 | // Вероятно необходимо переопределить ID. |
159 | 159 | // Применимо только для Originate, когда в качестве звонящего используем два канала |
160 | 160 | // мобильный и внутренний номер. |
161 | 161 | $peer_mobile = $agi->get_variable("peer_mobile", true); |
162 | - if ( ! empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
163 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $peer_mobile . '_' . $IS_ORGNT; |
|
162 | + if (!empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
163 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$peer_mobile.'_'.$IS_ORGNT; |
|
164 | 164 | $data['org_id'] = $id; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - if ( ! empty($data['ENDCALLONANSWER'])) { |
|
168 | + if (!empty($data['ENDCALLONANSWER'])) { |
|
169 | 169 | $agi->set_variable("__ENDCALLONANSWER", ""); |
170 | 170 | } |
171 | 171 | |
172 | - $PICKUPEER = trim('' . $agi->get_variable("PICKUPEER", true)); |
|
172 | + $PICKUPEER = trim(''.$agi->get_variable("PICKUPEER", true)); |
|
173 | 173 | $data['dnid'] = $agi->request['agi_dnid']; |
174 | 174 | $mikoPBXConfig = new MikoPBXConfig(); |
175 | 175 | $pickupexten = $mikoPBXConfig->getGeneralSettings('PBXFeaturePickupExten'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | // Очищаем переменную канала. Больше не требуется. |
185 | 185 | $agi->set_variable("PICKUPEER", ""); |
186 | 186 | $data['old_id'] = $id; |
187 | - $data['id'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
187 | + $data['id'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
188 | 188 | } |
189 | 189 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
190 | 190 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
212 | 212 | $data['did'] = $agi->get_variable("FROM_DID", true); |
213 | 213 | |
214 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
214 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
215 | 215 | |
216 | 216 | return $data; |
217 | 217 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | function Event_transfer_dial($agi, $action) |
228 | 228 | { |
229 | 229 | $now = Util::getNowDate(); |
230 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
230 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
231 | 231 | |
232 | 232 | // Пытаемся определить канал. |
233 | 233 | $TRANSFERERNAME = $agi->get_variable("TRANSFERERNAME", true); |
234 | 234 | $QUEUE_SRC_CHAN = $agi->get_variable("QUEUE_SRC_CHAN", true); |
235 | - $is_local = ! (stripos($TRANSFERERNAME, 'local/') === false); |
|
235 | + $is_local = !(stripos($TRANSFERERNAME, 'local/') === false); |
|
236 | 236 | if ($QUEUE_SRC_CHAN != '' && $is_local) { |
237 | 237 | // Это LOCAL, Переопределим на исходный. |
238 | 238 | $channel = $QUEUE_SRC_CHAN; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | $data = []; |
249 | 249 | $data['action'] = "$action"; |
250 | - $data['agi_channel'] = $channel;// $agi->request['agi_channel']; |
|
250 | + $data['agi_channel'] = $channel; // $agi->request['agi_channel']; |
|
251 | 251 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
252 | 252 | $data['src_chan'] = $channel; |
253 | 253 | $data['did'] = $agi->get_variable("FROM_DID", true); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $data['did'] = $agi->get_variable("FROM_DID", true); |
322 | 322 | $data['action'] = "$action"; |
323 | 323 | $data['agi_channel'] = $agi->request['agi_channel']; |
324 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
324 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
325 | 325 | |
326 | 326 | $pos = stripos($data['agi_channel'], 'local/'); |
327 | 327 | if ($pos === false) { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $data = []; |
351 | 351 | $data['action'] = "$action"; |
352 | 352 | $data['did'] = $agi->get_variable("FROM_DID", true); |
353 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
353 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
354 | 354 | |
355 | 355 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
356 | 356 | $data['dialstatus'] = $agi->get_variable("DIALSTATUS", true); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $agi->set_variable("pt1c_PARK_CHAN", $park_row['ParkeeChannel']); |
386 | 386 | |
387 | 387 | // Сбор данных для генерации CDR. |
388 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
388 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
389 | 389 | $channel = $agi->request['agi_channel']; |
390 | 390 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
391 | 391 | $data = []; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $data['src_chan'] = $channel; |
404 | 404 | $data['src_num'] = $agi->request['agi_callerid']; |
405 | 405 | $data['dst_num'] = $agi->request['agi_extension']; |
406 | - $data['dst_chan'] = 'Park:' . $agi->request['agi_extension']; |
|
406 | + $data['dst_chan'] = 'Park:'.$agi->request['agi_extension']; |
|
407 | 407 | } elseif (true === $park_row['pt1c_is_dst']) { |
408 | 408 | $data['src_chan'] = $channel; |
409 | 409 | $data['dst_chan'] = $park_row['ParkeeChannel']; |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | if (trim($park_row['ParkingDuration']) !== '') { |
420 | 420 | $time_start = date("Y-m-d H:i:s", time() - 1 * ($park_row['ParkingDuration'])); |
421 | 421 | $data_parking = [ |
422 | - 'UNIQUEID' => $id . '_' . Util::generateRandomString(3), |
|
422 | + 'UNIQUEID' => $id.'_'.Util::generateRandomString(3), |
|
423 | 423 | 'src_chan' => $park_row['ParkeeChannel'], |
424 | 424 | 'src_num' => $park_row['ParkeeCallerIDNum'], |
425 | 425 | 'dst_num' => $park_row['ParkingSpace'], |
426 | - 'dst_chan' => 'Park:' . $park_row['ParkingSpace'], |
|
426 | + 'dst_chan' => 'Park:'.$park_row['ParkingSpace'], |
|
427 | 427 | 'start' => $time_start, |
428 | 428 | 'answer' => $time_start, |
429 | 429 | 'endtime' => $now, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | function Event_unpark_call_timeout($agi, $action) |
449 | 449 | { |
450 | 450 | $now = Util::getNowDate(); |
451 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
451 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
452 | 452 | // PARKER=SIP/206 |
453 | 453 | $PARKING_DURATION = $agi->get_variable("PARKING_DURATION", true); |
454 | 454 | $PARKING_DURATION = ($PARKING_DURATION == '') ? 45 : $PARKING_DURATION; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'src_chan' => $agi->request['agi_channel'], // $agi->get_variable("PARKER", true), // ??? |
461 | 461 | 'src_num' => $agi->request['agi_callerid'], |
462 | 462 | 'dst_num' => $PARKING_SPACE, |
463 | - 'dst_chan' => 'Park:' . $PARKING_SPACE, |
|
463 | + 'dst_chan' => 'Park:'.$PARKING_SPACE, |
|
464 | 464 | 'start' => $time_start, |
465 | 465 | 'answer' => $time_start, |
466 | 466 | 'endtime' => $now, |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | ]; |
473 | 473 | |
474 | 474 | |
475 | - $id2 = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
475 | + $id2 = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
476 | 476 | $agi->set_variable("__pt1c_UNIQUEID", "$id2"); |
477 | 477 | |
478 | 478 | return $data; |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | $id = $agi->get_variable("pt1c_UNIQUEID", true); |
494 | 494 | $ISTRANSFER = $agi->get_variable("ISTRANSFER", true); |
495 | 495 | |
496 | - if (empty($id) || ! empty($ISTRANSFER)) { |
|
497 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
496 | + if (empty($id) || !empty($ISTRANSFER)) { |
|
497 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
498 | 498 | $time_start = $now; |
499 | 499 | } |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | // 'src_chan' => $agi->request['agi_channel'], |
504 | 504 | // 'src_num' => $agi->request['agi_callerid'], |
505 | 505 | 'dst_num' => $agi->request['agi_extension'], |
506 | - 'dst_chan' => 'Queue:' . $agi->request['agi_extension'], |
|
506 | + 'dst_chan' => 'Queue:'.$agi->request['agi_extension'], |
|
507 | 507 | // 'answer' => $time_start, |
508 | 508 | // 'end' => $now, |
509 | 509 | 'did' => $agi->get_variable("FROM_DID", true), |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | 'UNIQUEID' => $id, |
512 | 512 | 'linkedid' => $agi->get_variable("CDR(linkedid)", true), |
513 | 513 | ]; |
514 | - if ( ! empty($time_start)) { |
|
514 | + if (!empty($time_start)) { |
|
515 | 515 | $data['src_chan'] = $agi->get_variable("QUEUE_SRC_CHAN", true); |
516 | 516 | $data['src_num'] = $agi->request['agi_callerid']; |
517 | 517 | $data['start'] = $time_start; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $data['transfer'] = '0'; |
520 | 520 | $agi->set_variable("__pt1c_q_UNIQUEID", "$id"); |
521 | 521 | } |
522 | - if ( ! empty($ISTRANSFER)) { |
|
522 | + if (!empty($ISTRANSFER)) { |
|
523 | 523 | $data['transfer'] = '1'; |
524 | 524 | } else { |
525 | 525 | $data['transfer'] = '0'; |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | |
591 | 591 | $is_conf = ($agi->get_variable('CALLERID(num)', true) === 'Conference_Room'); |
592 | 592 | $not_local = (stripos($agi->request['agi_channel'], 'local/') === false); |
593 | - if ($not_local && ! $is_conf) { |
|
593 | + if ($not_local && !$is_conf) { |
|
594 | 594 | $am = Util::getAstManager(); |
595 | 595 | $res = $am->meetMeCollectInfo($exten, ['conf_1c']); |
596 | 596 | $callid = $agi->request['agi_callerid']; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | if (empty($id)) { |
631 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
631 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | $recordingfile = CdrDb::MeetMeSetRecFilename($id); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | 'src_chan' => $agi->request['agi_channel'], |
638 | 638 | 'src_num' => $src_num, |
639 | 639 | 'dst_num' => $dst_num, |
640 | - 'dst_chan' => 'MeetMe:' . $mikoidconf, |
|
640 | + 'dst_chan' => 'MeetMe:'.$mikoidconf, |
|
641 | 641 | 'start' => $time_start, |
642 | 642 | 'answer' => $time_start, |
643 | 643 | 'recordingfile' => "{$recordingfile}.mp3", |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $lamePath = Util::which('lame'); |
680 | 680 | $nicePath = Util::which('nice'); |
681 | 681 | $chmodPath = Util::which('chmod'); |
682 | - $command = "{$nicePath} -n 19 {$lamePath} -b 32 --silent \"{$recordingfile}.wav\" \"{$recordingfile}.mp3\" && {$chmodPath} o+r \"{$recordingfile}.mp3\""; |
|
682 | + $command = "{$nicePath} -n 19 {$lamePath} -b 32 --silent \"{$recordingfile}.wav\" \"{$recordingfile}.mp3\" && {$chmodPath} o+r \"{$recordingfile}.mp3\""; |
|
683 | 683 | Processes::mwExecBg($command); |
684 | 684 | |
685 | 685 | return $data; |
@@ -695,14 +695,14 @@ discard block |
||
695 | 695 | */ |
696 | 696 | function Event_dial_app($agi, $action) |
697 | 697 | { |
698 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
698 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
699 | 699 | $extension = $agi->get_variable("APPEXTEN", true); |
700 | 700 | if (empty($extension)) { |
701 | 701 | $extension = $agi->request['agi_extension']; |
702 | 702 | } |
703 | 703 | |
704 | 704 | $data = Event_dial($agi, $action); |
705 | - $data['dst_chan'] = 'App:' . $extension; |
|
705 | + $data['dst_chan'] = 'App:'.$extension; |
|
706 | 706 | $data['dst_num'] = $extension; |
707 | 707 | $data['is_app'] = 1; |
708 | 708 | $data['UNIQUEID'] = $id; |
@@ -743,5 +743,5 @@ discard block |
||
743 | 743 | $result = $func_name($agi, $action); |
744 | 744 | // Оповещение без задержек. |
745 | 745 | $data = base64_encode(json_encode($result)); |
746 | - $agi->exec("UserEvent", "CdrConnector,AgiData:" . base64_encode(json_encode($result))); |
|
746 | + $agi->exec("UserEvent", "CdrConnector,AgiData:".base64_encode(json_encode($result))); |
|
747 | 747 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | Processes::killByName('pcapsipdump'); |
32 | - $log_dir = System::getLogDir() . '/pcapsipdump'; |
|
32 | + $log_dir = System::getLogDir().'/pcapsipdump'; |
|
33 | 33 | Util::mwMkdir($log_dir); |
34 | 34 | |
35 | 35 | $network = new Network(); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | foreach ($arr_eth as $eth) { |
39 | 39 | $pid_file = "/var/run/pcapsipdump_{$eth}.pid"; |
40 | 40 | Processes::mwExecBg( |
41 | - $pcapsipdumpPath . ' -T 120 -P ' . $pid_file . ' -i ' . $eth . ' -m \'^(INVITE|REGISTER)$\' -L ' . $log_dir . '/dump.db' |
|
41 | + $pcapsipdumpPath.' -T 120 -P '.$pid_file.' -i '.$eth.' -m \'^(INVITE|REGISTER)$\' -L '.$log_dir.'/dump.db' |
|
42 | 42 | ); |
43 | 43 | } |
44 | 44 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | /** @var \MikoPBX\Common\Models\LanInterfaces $res */ |
147 | 147 | $res = LanInterfaces::findFirst("internet = '1'"); |
148 | 148 | if (null !== $res) { |
149 | - if ( ! empty($res->primarydns) && '127.0.0.1' != $res->primarydns) { |
|
149 | + if (!empty($res->primarydns) && '127.0.0.1' != $res->primarydns) { |
|
150 | 150 | $dns[] = $res->primarydns; |
151 | 151 | } |
152 | - if ( ! empty($res->secondarydns) && '127.0.0.1' != $res->secondarydns) { |
|
152 | + if (!empty($res->secondarydns) && '127.0.0.1' != $res->secondarydns) { |
|
153 | 153 | $dns[] = $res->secondarydns; |
154 | 154 | } |
155 | 155 | } |
@@ -165,39 +165,39 @@ discard block |
||
165 | 165 | public function generatePdnsdConfig($named_dns): void |
166 | 166 | { |
167 | 167 | $tempDir = $this->di->getShared('config')->path('core.tempDir'); |
168 | - $cache_dir = $tempDir . '/pdnsd/cache'; |
|
168 | + $cache_dir = $tempDir.'/pdnsd/cache'; |
|
169 | 169 | Util::mwMkdir($cache_dir); |
170 | 170 | |
171 | - $conf = 'global {' . "\n" . |
|
172 | - ' perm_cache=10240;' . "\n" . |
|
173 | - ' cache_dir="' . $cache_dir . '";' . "\n" . |
|
174 | - ' pid_file = /var/run/pdnsd.pid;' . "\n" . |
|
175 | - ' run_as="nobody";' . "\n" . |
|
176 | - ' server_ip = 127.0.0.1;' . "\n" . |
|
177 | - ' status_ctl = on;' . "\n" . |
|
178 | - ' query_method=udp_tcp;' . "\n" . |
|
179 | - ' min_ttl=15m;' . "\n" . |
|
180 | - ' max_ttl=1w;' . "\n" . |
|
181 | - ' timeout=10;' . "\n" . |
|
182 | - ' neg_domain_pol=on;' . "\n" . |
|
183 | - ' run_as=root;' . "\n" . |
|
184 | - ' daemon=on;' . "\n" . |
|
185 | - '}' . "\n" . |
|
186 | - 'server {' . "\n" . |
|
187 | - ' label = "main";' . "\n" . |
|
188 | - ' ip = ' . implode(', ', $named_dns) . ';' . "\n" . |
|
189 | - ' interface=lo;' . "\n" . |
|
190 | - ' uptest=if;' . "\n" . |
|
191 | - ' interval=10m;' . "\n" . |
|
192 | - ' purge_cache=off;' . "\n" . |
|
171 | + $conf = 'global {'."\n". |
|
172 | + ' perm_cache=10240;'."\n". |
|
173 | + ' cache_dir="'.$cache_dir.'";'."\n". |
|
174 | + ' pid_file = /var/run/pdnsd.pid;'."\n". |
|
175 | + ' run_as="nobody";'."\n". |
|
176 | + ' server_ip = 127.0.0.1;'."\n". |
|
177 | + ' status_ctl = on;'."\n". |
|
178 | + ' query_method=udp_tcp;'."\n". |
|
179 | + ' min_ttl=15m;'."\n". |
|
180 | + ' max_ttl=1w;'."\n". |
|
181 | + ' timeout=10;'."\n". |
|
182 | + ' neg_domain_pol=on;'."\n". |
|
183 | + ' run_as=root;'."\n". |
|
184 | + ' daemon=on;'."\n". |
|
185 | + '}'."\n". |
|
186 | + 'server {'."\n". |
|
187 | + ' label = "main";'."\n". |
|
188 | + ' ip = '.implode(', ', $named_dns).';'."\n". |
|
189 | + ' interface=lo;'."\n". |
|
190 | + ' uptest=if;'."\n". |
|
191 | + ' interval=10m;'."\n". |
|
192 | + ' purge_cache=off;'."\n". |
|
193 | 193 | '}'; |
194 | 194 | |
195 | - $pdnsdConfFile = '/etc/pdnsd.conf'; |
|
195 | + $pdnsdConfFile = '/etc/pdnsd.conf'; |
|
196 | 196 | $savedConf = ''; |
197 | - if(file_exists($pdnsdConfFile)){ |
|
197 | + if (file_exists($pdnsdConfFile)) { |
|
198 | 198 | $savedConf = file_get_contents($pdnsdConfFile); |
199 | 199 | } |
200 | - if($savedConf != $conf){ |
|
200 | + if ($savedConf != $conf) { |
|
201 | 201 | file_put_contents($pdnsdConfFile, $conf); |
202 | 202 | } |
203 | 203 | $pdnsdPath = Util::which('pdnsd'); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | if (!empty($pid) && $savedConf === $conf) { |
206 | 206 | // Выполним дополнительную проверку, работает ли сервер. |
207 | 207 | $resultResolve = gethostbynamel('lic.miko.ru'); |
208 | - if($resultResolve !== false){ |
|
208 | + if ($resultResolve !== false) { |
|
209 | 209 | // Ничего делать не нужно. Конфиг не изменился. Рестарт не требуется. |
210 | 210 | return; |
211 | 211 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | $pid_file = "/var/run/udhcpc_{$if_name}"; |
284 | 284 | $pid_pcc = Processes::getPidOfProcess($pid_file); |
285 | - if ( ! empty($pid_pcc) && file_exists($pid_file)) { |
|
285 | + if (!empty($pid_pcc) && file_exists($pid_file)) { |
|
286 | 286 | // Завершаем старый процесс. |
287 | 287 | $killPath = Util::which('kill'); |
288 | 288 | $catPath = Util::which('cat'); |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | |
412 | 412 | $result = ['']; |
413 | 413 | if (file_exists('/etc/static-routes')) { |
414 | - $command = "{$catPath} /etc/static-routes " . |
|
415 | - "| {$grepPath} '^rout' " . |
|
416 | - "| {$busyboxPath} awk -F ';' '{print $1}' " . |
|
417 | - "| {$grepPath} '{$if_name}\$' " . |
|
414 | + $command = "{$catPath} /etc/static-routes ". |
|
415 | + "| {$grepPath} '^rout' ". |
|
416 | + "| {$busyboxPath} awk -F ';' '{print $1}' ". |
|
417 | + "| {$grepPath} '{$if_name}\$' ". |
|
418 | 418 | "| {$awkPath} -F 'dev {$if_name}' '{ print $1 }'"; |
419 | 419 | Processes::mwExec($command, $result); |
420 | 420 | } |
@@ -424,19 +424,19 @@ discard block |
||
424 | 424 | |
425 | 425 | if ($if_data['vlanid'] > 0) { |
426 | 426 | // Пока только статика. |
427 | - $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n" . |
|
428 | - "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n" . |
|
429 | - "address {$ipaddr}\n" . |
|
430 | - "netmask {$subnet}\n" . |
|
431 | - "gateway {$gateway}\n" . |
|
432 | - "dns-nameservers 127.0.0.1\n" . |
|
433 | - "vlan_raw_device {$if_data['interface_orign']}\n" . |
|
434 | - "{$routs_add}\n" . |
|
427 | + $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n". |
|
428 | + "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n". |
|
429 | + "address {$ipaddr}\n". |
|
430 | + "netmask {$subnet}\n". |
|
431 | + "gateway {$gateway}\n". |
|
432 | + "dns-nameservers 127.0.0.1\n". |
|
433 | + "vlan_raw_device {$if_data['interface_orign']}\n". |
|
434 | + "{$routs_add}\n". |
|
435 | 435 | "{$routs_rem}\n"; |
436 | 436 | } elseif (trim($if_data['dhcp']) === '1') { |
437 | - $lan_config = "auto {$if_name}\n" . |
|
438 | - "iface {$if_name} inet dhcp\n" . |
|
439 | - "{$routs_add}\n" . |
|
437 | + $lan_config = "auto {$if_name}\n". |
|
438 | + "iface {$if_name} inet dhcp\n". |
|
439 | + "{$routs_add}\n". |
|
440 | 440 | "{$routs_rem}\n"; |
441 | 441 | } else { |
442 | 442 | if (empty($ipaddr)) { |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | echo "Caught exception: $ipaddr $subnet", $e->getMessage(), "\n"; |
450 | 450 | continue; |
451 | 451 | } |
452 | - $lan_config = "auto {$if_name}\n" . |
|
453 | - "iface {$if_name} inet static\n" . |
|
454 | - "address {$ipaddr}\n" . |
|
455 | - "netmask {$subnet}\n" . |
|
456 | - "gateway {$gateway}\n" . |
|
457 | - "dns-nameservers 127.0.0.1\n" . |
|
458 | - "{$routs_add}\n" . |
|
452 | + $lan_config = "auto {$if_name}\n". |
|
453 | + "iface {$if_name} inet static\n". |
|
454 | + "address {$ipaddr}\n". |
|
455 | + "netmask {$subnet}\n". |
|
456 | + "gateway {$gateway}\n". |
|
457 | + "dns-nameservers 127.0.0.1\n". |
|
458 | + "{$routs_add}\n". |
|
459 | 459 | "{$routs_rem}\n"; |
460 | 460 | } |
461 | 461 | file_put_contents("/etc/network/interfaces.d/{$if_name}", $lan_config); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $net_mask = explode(".", $net_mask); |
547 | 547 | |
548 | 548 | foreach ($net_mask as $oct_ect) { |
549 | - $bits += strlen(str_replace("0", "", decbin((int)$oct_ect))); |
|
549 | + $bits += strlen(str_replace("0", "", decbin((int) $oct_ect))); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | return $bits; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $data->hostname = 'mikopbx'; |
610 | 610 | $data->domain = ''; |
611 | 611 | $data->topology = 'private'; |
612 | - $data->primarydns= ''; |
|
612 | + $data->primarydns = ''; |
|
613 | 613 | $data->save(); |
614 | 614 | |
615 | 615 | return $data->toArray(); |
@@ -630,15 +630,15 @@ discard block |
||
630 | 630 | public function hostnameConfigure(): void |
631 | 631 | { |
632 | 632 | $data = Network::getHostName(); |
633 | - $hosts_conf = "127.0.0.1 localhost\n" . |
|
633 | + $hosts_conf = "127.0.0.1 localhost\n". |
|
634 | 634 | "127.0.0.1 {$data['hostname']}\n"; |
635 | - if ( ! empty($data['domain'])) { |
|
635 | + if (!empty($data['domain'])) { |
|
636 | 636 | $hosts_conf .= "127.0.0.1 {$data['hostname']}.{$data['domain']}\n"; |
637 | 637 | } |
638 | 638 | Util::fileWriteContent('/etc/hosts', $hosts_conf); |
639 | 639 | |
640 | 640 | $hostnamePath = Util::which('hostname'); |
641 | - Processes::mwExec($hostnamePath . ' ' . escapeshellarg("{$data['hostname']}")); |
|
641 | + Processes::mwExec($hostnamePath.' '.escapeshellarg("{$data['hostname']}")); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | |
653 | 653 | $pidFile = '/var/run/openvpn.pid'; |
654 | 654 | $pid = Processes::getPidOfProcess('openvpn'); |
655 | - if ( ! empty($pid)) { |
|
655 | + if (!empty($pid)) { |
|
656 | 656 | // Завершаем процесс. |
657 | 657 | $busyboxPath = Util::which('busybox'); |
658 | 658 | Processes::mwExec("{$busyboxPath} kill '$pid'"); |
659 | 659 | } |
660 | - if ( ! empty($data)) { |
|
660 | + if (!empty($data)) { |
|
661 | 661 | $openvpnPath = Util::which('openvpn'); |
662 | 662 | Processes::mwExecBg("{$openvpnPath} --config /etc/openvpn.ovpn --writepid {$pidFile}", '/dev/null', 5); |
663 | 663 | } |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | if ($res === null) { |
868 | 868 | return; |
869 | 869 | } |
870 | - if (empty($res->primarydns) && ! empty($data['primarydns'])) { |
|
870 | + if (empty($res->primarydns) && !empty($data['primarydns'])) { |
|
871 | 871 | $res->writeAttribute('primarydns', $data['primarydns']); |
872 | 872 | } elseif (empty($res->secondarydns) && $res->primarydns !== $data['primarydns']) { |
873 | 873 | $res->writeAttribute('secondarydns', $data['primarydns']); |
874 | 874 | } |
875 | - if (empty($res->secondarydns) && ! empty($data['secondarydns'])) { |
|
875 | + if (empty($res->secondarydns) && !empty($data['secondarydns'])) { |
|
876 | 876 | $res->writeAttribute('secondarydns', $data['secondarydns']); |
877 | 877 | } |
878 | 878 | $res->save(); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | { |
916 | 916 | // Настройка по умолчанию. |
917 | 917 | $interface = trim(getenv('interface')); |
918 | - if ( ! Util::isSystemctl()) { |
|
918 | + if (!Util::isSystemctl()) { |
|
919 | 919 | // Для MIKO LFS Edition. |
920 | 920 | $busyboxPath = Util::which('busybox'); |
921 | 921 | Processes::mwExec("{$busyboxPath} ifconfig $interface 192.168.2.1 netmask 255.255.255.0"); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $config = $this->di->get('config')->beanstalk; |
50 | 50 | $port = $config->port; |
51 | - if ( ! empty($this->port) && is_numeric($this->port)) { |
|
51 | + if (!empty($this->port) && is_numeric($this->port)) { |
|
52 | 52 | $port = $this->port; |
53 | 53 | } |
54 | 54 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $this->queue->delete($job); |
103 | 103 | } |
104 | 104 | } catch (Throwable $exception) { |
105 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
105 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
106 | 106 | if ($job !== null) { |
107 | 107 | $this->queue->bury($job); |
108 | 108 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ): Job { |
135 | 135 | $tube = str_replace("\\", '-', $tube); |
136 | 136 | // Change tube |
137 | - if ( ! empty($tube) && $this->tube !== $tube) { |
|
137 | + if (!empty($tube) && $this->tube !== $tube) { |
|
138 | 138 | $this->queue->useTube($tube); |
139 | 139 | } |
140 | 140 | $job_data = serialize($job_data); |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | $queueStats = $this->queue->stats()->getArrayCopy(); |
160 | 160 | |
161 | 161 | // Delete buried jobs |
162 | - $countBuried=$queueStats['current-jobs-buried']; |
|
162 | + $countBuried = $queueStats['current-jobs-buried']; |
|
163 | 163 | while ($job = $this->queue->peekBuried()) { |
164 | 164 | $countBuried--; |
165 | - if ($countBuried<0){ |
|
165 | + if ($countBuried < 0) { |
|
166 | 166 | break; |
167 | 167 | } |
168 | 168 | $id = $job->getId(); |
@@ -171,23 +171,23 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | // Delete outdated jobs |
174 | - $countReady=$queueStats['current-jobs-ready']; |
|
174 | + $countReady = $queueStats['current-jobs-ready']; |
|
175 | 175 | while ($job = $this->queue->peekReady()) { |
176 | 176 | $countReady--; |
177 | - if ($countReady<0){ |
|
177 | + if ($countReady < 0) { |
|
178 | 178 | break; |
179 | 179 | } |
180 | 180 | $id = $job->getId(); |
181 | 181 | $jobStats = $this->queue->statsJob($job)->getArrayCopy(); |
182 | - $age = (int)$jobStats['age']; |
|
183 | - $expectedTimeToExecute = (int)$jobStats['ttr'] * 2; |
|
182 | + $age = (int) $jobStats['age']; |
|
183 | + $expectedTimeToExecute = (int) $jobStats['ttr'] * 2; |
|
184 | 184 | if ($age > $expectedTimeToExecute) { |
185 | 185 | $this->queue->delete($job); |
186 | 186 | Util::sysLogMsg(__METHOD__, "Deleted outdated job with ID {$id} from {$tube}"); |
187 | 187 | } |
188 | 188 | } |
189 | 189 | } catch (Throwable $exception) { |
190 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
190 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | try { |
221 | 221 | $job = $this->queue->reserveWithTimeout($timeout); |
222 | 222 | } catch (Throwable $exception) { |
223 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
223 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | if ($job === null) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $killallPath = Util::which('killall'); |
29 | 29 | |
30 | - return self::mwExec($killallPath . ' ' . escapeshellarg($procName)); |
|
30 | + return self::mwExec($killallPath.' '.escapeshellarg($procName)); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public static function mwExec($command, &$outArr = null, &$retVal = null): int |
43 | 43 | { |
44 | 44 | $retVal = 0; |
45 | - $outArr = []; |
|
45 | + $outArr = []; |
|
46 | 46 | $di = Di::getDefault(); |
47 | 47 | |
48 | 48 | if ($di !== null && $di->getShared('config')->path('core.debugMode')) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $rmPath = Util::which('rm'); |
69 | 69 | $sleepPath = Util::which('sleep'); |
70 | 70 | if ($sleep_time > 0) { |
71 | - $filename = '/tmp/' . time() . '_noop.sh'; |
|
71 | + $filename = '/tmp/'.time().'_noop.sh'; |
|
72 | 72 | file_put_contents($filename, "{$sleepPath} {$sleep_time}; {$command}; {$rmPath} -rf {$filename}"); |
73 | 73 | $noop_command = "{$nohupPath} {$shPath} {$filename} > {$out_file} 2>&1 &"; |
74 | 74 | } else { |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * @param string $param |
143 | 143 | * @param string $action |
144 | 144 | */ |
145 | - public static function processPHPWorker(string $className, string $param = 'start', string $action='restart'): void |
|
145 | + public static function processPHPWorker(string $className, string $param = 'start', string $action = 'restart'): void |
|
146 | 146 | { |
147 | 147 | $workerPath = Util::getFilePathByClassName($className); |
148 | - if ( ! empty($workerPath)) { |
|
148 | + if (!empty($workerPath)) { |
|
149 | 149 | $command = "php -f {$workerPath}"; |
150 | 150 | $path_kill = Util::which('kill'); |
151 | 151 | $path_nohup = Util::which('nohup'); |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | |
239 | 239 | $name = addslashes($name); |
240 | 240 | $filter_cmd = ''; |
241 | - if ( ! empty($exclude)) { |
|
242 | - $filter_cmd = "| $path_grep -v " . escapeshellarg($exclude); |
|
241 | + if (!empty($exclude)) { |
|
242 | + $filter_cmd = "| $path_grep -v ".escapeshellarg($exclude); |
|
243 | 243 | } |
244 | 244 | $out = []; |
245 | 245 | self::mwExec( |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | $max_size = 2; |
93 | - $log_dir = System::getLogDir() . '/asterisk/'; |
|
93 | + $log_dir = System::getLogDir().'/asterisk/'; |
|
94 | 94 | $text_config = "{$log_dir}{$f_name} { |
95 | 95 | nocreate |
96 | 96 | nocopytruncate |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | {$asteriskPath} -rx 'logger reload' > /dev/null 2> /dev/null |
106 | 106 | endscript |
107 | 107 | }"; |
108 | - $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | - $path_conf = $varEtcDir . '/asterisk_logrotate_' . $f_name . '.conf'; |
|
108 | + $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | + $path_conf = $varEtcDir.'/asterisk_logrotate_'.$f_name.'.conf'; |
|
110 | 110 | file_put_contents($path_conf, $text_config); |
111 | 111 | $mb10 = $max_size * 1024 * 1024; |
112 | 112 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | public static function checkCodec($name, $desc, $type): void |
205 | 205 | { |
206 | - $codec = Codecs::findFirst('name="' . $name . '"'); |
|
206 | + $codec = Codecs::findFirst('name="'.$name.'"'); |
|
207 | 207 | if ($codec === null) { |
208 | 208 | /** @var \MikoPBX\Common\Models\Codecs $codec_g722 */ |
209 | 209 | $codec = new Codecs(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function sipReload():void |
221 | 221 | { |
222 | - $di = Di::getDefault(); |
|
222 | + $di = Di::getDefault(); |
|
223 | 223 | if ($di === null) { |
224 | 224 | return; |
225 | 225 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | Processes::mwExec("{$asteriskPath} -rx 'module reload acl'"); |
236 | 236 | Processes::mwExec("{$asteriskPath} -rx 'core reload'"); |
237 | 237 | } else { |
238 | - Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk',LOG_INFO, LOG_INFO); |
|
238 | + Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk', LOG_INFO, LOG_INFO); |
|
239 | 239 | // Завершаем каналы. |
240 | 240 | Processes::mwExec("{$asteriskPath} -rx 'channel request hangup all'"); |
241 | 241 | usleep(500000); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public static function iaxReload(): void |
250 | 250 | { |
251 | - $iax = new IAXConf(); |
|
251 | + $iax = new IAXConf(); |
|
252 | 252 | $iax->generateConfig(); |
253 | 253 | $asteriskPath = Util::which('asterisk'); |
254 | 254 | Processes::mwExec("{$asteriskPath} -rx 'iax2 reload'"); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'result' => 'ERROR', |
306 | 306 | ]; |
307 | 307 | |
308 | - if ( ! $this->di->getShared('registry')->booting) { |
|
308 | + if (!$this->di->getShared('registry')->booting) { |
|
309 | 309 | $this->stop(); |
310 | 310 | } |
311 | 311 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | // Создание базы данных истории звонков. |
322 | 322 | /** @var \Phalcon\Db\Adapter\Pdo\Sqlite $connection */ |
323 | 323 | $connection = $this->di->get('dbCDR'); |
324 | - if ( ! $connection->tableExists('cdr')) { |
|
324 | + if (!$connection->tableExists('cdr')) { |
|
325 | 325 | RegisterDIServices::recreateDBConnections(); |
326 | 326 | } else { |
327 | 327 | CdrDb::checkDb(); |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | public static function isStorageDisk($device): bool |
74 | 74 | { |
75 | 75 | $result = false; |
76 | - if ( ! file_exists("{$device}")) { |
|
76 | + if (!file_exists("{$device}")) { |
|
77 | 77 | return $result; |
78 | 78 | } |
79 | 79 | |
80 | - $tmp_dir = '/tmp/mnt_' . time(); |
|
80 | + $tmp_dir = '/tmp/mnt_'.time(); |
|
81 | 81 | Util::mwMkdir($tmp_dir); |
82 | 82 | $out = []; |
83 | 83 | |
84 | 84 | $storage = new Storage(); |
85 | - $uid_part = 'UUID=' . $storage->getUuid($device) . ''; |
|
85 | + $uid_part = 'UUID='.$storage->getUuid($device).''; |
|
86 | 86 | $format = $storage->getFsType($device); |
87 | 87 | if ($format === '') { |
88 | 88 | return false; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | Processes::mwExec("{$umountPath} {$device}"); |
102 | 102 | } |
103 | 103 | |
104 | - if ( ! self::isStorageDiskMounted($device)) { |
|
104 | + if (!self::isStorageDiskMounted($device)) { |
|
105 | 105 | Processes::mwExec("{$rmPath} -rf '{$tmp_dir}'"); |
106 | 106 | } |
107 | 107 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | $timeoutPath = Util::which('timeout'); |
232 | 232 | $sshfsPath = Util::which('sshfs'); |
233 | 233 | |
234 | - $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' " . |
|
235 | - "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n" . |
|
236 | - "{$pass}\n" . |
|
234 | + $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' ". |
|
235 | + "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n". |
|
236 | + "{$pass}\n". |
|
237 | 237 | "EOF\n"; |
238 | 238 | // file_put_contents('/tmp/sshfs_'.$host, $command); |
239 | 239 | Processes::mwExec($command, $out); |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | |
266 | 266 | // Собираем строку подключения к ftp. |
267 | 267 | $auth_line = ''; |
268 | - if ( ! empty($user)) { |
|
269 | - $auth_line .= 'user="' . $user; |
|
270 | - if ( ! empty($pass)) { |
|
268 | + if (!empty($user)) { |
|
269 | + $auth_line .= 'user="'.$user; |
|
270 | + if (!empty($pass)) { |
|
271 | 271 | $auth_line .= ":{$pass}"; |
272 | 272 | } |
273 | 273 | $auth_line .= '",'; |
274 | 274 | } |
275 | 275 | |
276 | - $connect_line = 'ftp://' . $host; |
|
277 | - if ( ! empty($port)) { |
|
276 | + $connect_line = 'ftp://'.$host; |
|
277 | + if (!empty($port)) { |
|
278 | 278 | $connect_line .= ":{$port}"; |
279 | 279 | } |
280 | - if ( ! empty($remout_dir)) { |
|
280 | + if (!empty($remout_dir)) { |
|
281 | 281 | $connect_line .= "$remout_dir"; |
282 | 282 | } |
283 | 283 | |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public static function mkfs_disk($dev) |
305 | 305 | { |
306 | - if ( ! file_exists($dev)) { |
|
306 | + if (!file_exists($dev)) { |
|
307 | 307 | $dev = "/dev/{$dev}"; |
308 | 308 | } |
309 | - if ( ! file_exists($dev)) { |
|
309 | + if (!file_exists($dev)) { |
|
310 | 310 | return false; |
311 | 311 | } |
312 | 312 | $dir = ''; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | Processes::mwExec("/sbin/shell_functions.sh 'killprocesses' '$dir' -TERM 0"); |
342 | 342 | Processes::mwExec("{$umountPath} {$dir}"); |
343 | 343 | } |
344 | - $result = ! self::isStorageDiskMounted($dir); |
|
344 | + $result = !self::isStorageDiskMounted($dir); |
|
345 | 345 | if ($result && file_exists($dir)) { |
346 | 346 | // Если диск не смонтирован, то удаляем каталог. |
347 | 347 | Processes::mwExec("{$rmPath} -rf '{$dir}'"); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public static function statusMkfs($dev): string |
413 | 413 | { |
414 | - if ( ! file_exists($dev)) { |
|
414 | + if (!file_exists($dev)) { |
|
415 | 415 | $dev = "/dev/{$dev}"; |
416 | 416 | } |
417 | 417 | $out = []; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | $config = $di->getShared('config'); |
436 | 436 | $phpSessionDir = $config->path('www.phpSessionDir'); |
437 | - if ( ! empty($phpSessionDir)) { |
|
437 | + if (!empty($phpSessionDir)) { |
|
438 | 438 | $rmPath = Util::which('rm'); |
439 | 439 | Processes::mwExec("{$rmPath} -rf {$phpSessionDir}/*"); |
440 | 440 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | // Создание больщого файла для тестов. |
451 | 451 | // head -c 1500MB /dev/urandom > /storage/usbdisk1/big_file.mp3 |
452 | 452 | foreach ($hdd as $disk) { |
453 | - if ($disk['sys_disk'] === true && ! self::isStorageDiskMounted("{$disk['id']}4")) { |
|
453 | + if ($disk['sys_disk'] === true && !self::isStorageDiskMounted("{$disk['id']}4")) { |
|
454 | 454 | // Это системный диск (4ый раздел). Он не смонтирован. |
455 | 455 | continue; |
456 | 456 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | Processes::processPHPWorker(WorkerRemoveOldRecords::class); |
475 | 475 | } |
476 | 476 | |
477 | - if ( ! $need_alert) { |
|
477 | + if (!$need_alert) { |
|
478 | 478 | continue; |
479 | 479 | } |
480 | 480 | |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | $m_size = round(($disk_data[1] + $disk_data[2]) / 1024, 1); |
515 | 515 | $res_disks[] = [ |
516 | 516 | 'id' => $disk_data[0], |
517 | - 'size' => "" . $m_size, |
|
518 | - 'size_text' => "" . $m_size . " Mb", |
|
517 | + 'size' => "".$m_size, |
|
518 | + 'size_text' => "".$m_size." Mb", |
|
519 | 519 | 'vendor' => 'Debian', |
520 | 520 | 'mounted' => '/storage/usbdisk1', |
521 | 521 | 'free_space' => round($disk_data[2] / 1024, 1), |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | |
538 | 538 | $cf_disk = ''; |
539 | 539 | $varEtcDir = $this->config->path('core.varEtcDir'); |
540 | - if (file_exists($varEtcDir . '/cfdevice')) { |
|
541 | - $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice')); |
|
540 | + if (file_exists($varEtcDir.'/cfdevice')) { |
|
541 | + $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice')); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | foreach ($disks as $disk) { |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | $sys_disk = ($cf_disk == $disk); |
555 | 555 | |
556 | 556 | $mb_size = 0; |
557 | - if (is_file("/sys/block/" . $disk . "/size")) { |
|
558 | - $original_size = trim(file_get_contents("/sys/block/" . $disk . "/size")); |
|
557 | + if (is_file("/sys/block/".$disk."/size")) { |
|
558 | + $original_size = trim(file_get_contents("/sys/block/".$disk."/size")); |
|
559 | 559 | $original_size = ($original_size * 512 / 1024 / 1024); |
560 | 560 | $mb_size = $original_size; |
561 | 561 | } |
@@ -662,14 +662,14 @@ discard block |
||
662 | 662 | private function getVendorDisk($disk): string |
663 | 663 | { |
664 | 664 | $temp_vendor = []; |
665 | - if (is_file("/sys/block/" . $disk . "/device/vendor")) { |
|
666 | - $data = trim(file_get_contents("/sys/block/" . $disk . "/device/vendor")); |
|
665 | + if (is_file("/sys/block/".$disk."/device/vendor")) { |
|
666 | + $data = trim(file_get_contents("/sys/block/".$disk."/device/vendor")); |
|
667 | 667 | if ($data != '') { |
668 | 668 | $temp_vendor[] = trim(str_replace(',', ' ', $data)); |
669 | 669 | } |
670 | 670 | } |
671 | - if (is_file("/sys/block/" . $disk . "/device/model")) { |
|
672 | - $data = trim(file_get_contents("/sys/block/" . $disk . "/device/model")); |
|
671 | + if (is_file("/sys/block/".$disk."/device/model")) { |
|
672 | + $data = trim(file_get_contents("/sys/block/".$disk."/device/model")); |
|
673 | 673 | if ($data != '') { |
674 | 674 | $temp_vendor[] = trim(str_replace(',', ' ', $data)); |
675 | 675 | } |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | if (count($temp_vendor) == 0) { |
678 | 678 | $temp_vendor[] = $disk; |
679 | 679 | } |
680 | - if (is_file("/sys/block/" . $disk . "/device/type")) { |
|
681 | - $data = trim(file_get_contents("/sys/block/" . $disk . "/device/type")); |
|
680 | + if (is_file("/sys/block/".$disk."/device/type")) { |
|
681 | + $data = trim(file_get_contents("/sys/block/".$disk."/device/type")); |
|
682 | 682 | if ($data != '') { |
683 | 683 | $temp_vendor[] = trim(str_replace(',', ' ', $data)); |
684 | 684 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | Processes::mwExec("{$dfPath} -m | {$grepPath} {$hdd} | {$awkPath} '{print $4}'", $out); |
705 | 705 | $result = 0; |
706 | 706 | foreach ($out as $res) { |
707 | - if ( ! is_numeric($res)) { |
|
707 | + if (!is_numeric($res)) { |
|
708 | 708 | continue; |
709 | 709 | } |
710 | 710 | $result += (1 * $res); |
@@ -741,19 +741,19 @@ discard block |
||
741 | 741 | $path_size_info = $tmp_path; |
742 | 742 | } |
743 | 743 | if (empty($path_size_info)) { |
744 | - $tmp_path = "/sys/block/" . substr($dev, 0, 3) . "/{$dev}/size"; |
|
744 | + $tmp_path = "/sys/block/".substr($dev, 0, 3)."/{$dev}/size"; |
|
745 | 745 | if (file_exists($tmp_path)) { |
746 | 746 | $path_size_info = $tmp_path; |
747 | 747 | } |
748 | 748 | } |
749 | 749 | |
750 | - if ( ! empty($path_size_info)) { |
|
750 | + if (!empty($path_size_info)) { |
|
751 | 751 | $original_size = trim(file_get_contents($path_size_info)); |
752 | 752 | $original_size = ($original_size * 512 / 1024 / 1024); |
753 | 753 | $mb_size = $original_size; |
754 | 754 | } |
755 | 755 | |
756 | - $tmp_dir = "/tmp/{$dev}_" . time(); |
|
756 | + $tmp_dir = "/tmp/{$dev}_".time(); |
|
757 | 757 | $out = []; |
758 | 758 | |
759 | 759 | $fs = null; |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | } |
811 | 811 | Util::mwMkdir($dir); |
812 | 812 | |
813 | - if ( ! file_exists($dir)) { |
|
813 | + if (!file_exists($dir)) { |
|
814 | 814 | Util::sysLogMsg('Storage', "Unable mount $dev $format to $dir. Unable create dir."); |
815 | 815 | |
816 | 816 | return false; |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | Processes::mwExec("{$mountNtfs3gPath} /dev/{$dev} {$dir}", $out); |
822 | 822 | } else { |
823 | 823 | $storage = new Storage(); |
824 | - $uid_part = 'UUID=' . $storage->getUuid("/dev/{$dev}") . ''; |
|
824 | + $uid_part = 'UUID='.$storage->getUuid("/dev/{$dev}").''; |
|
825 | 825 | $mountPath = Util::which('mount'); |
826 | 826 | Processes::mwExec("{$mountPath} -t {$format} {$uid_part} {$dir}", $out); |
827 | 827 | } |
@@ -841,8 +841,8 @@ discard block |
||
841 | 841 | unlink($storage_dev_file); |
842 | 842 | } |
843 | 843 | |
844 | - if (file_exists($varEtcDir . '/cfdevice')) { |
|
845 | - $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice')); |
|
844 | + if (file_exists($varEtcDir.'/cfdevice')) { |
|
845 | + $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice')); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | $disks = $this->getDiskSettings(); |
@@ -856,18 +856,18 @@ discard block |
||
856 | 856 | // Если это системный диск, то пытаемся подключить раздел 4. |
857 | 857 | $dev = "{$disk['device']}4"; |
858 | 858 | } |
859 | - if ( ! $this->hddExists($dev)) { |
|
859 | + if (!$this->hddExists($dev)) { |
|
860 | 860 | // Диск не существует. |
861 | 861 | continue; |
862 | 862 | } |
863 | - if ($disk['media'] === '1' || ! file_exists($storage_dev_file)) { |
|
863 | + if ($disk['media'] === '1' || !file_exists($storage_dev_file)) { |
|
864 | 864 | file_put_contents($storage_dev_file, "/storage/usbdisk{$disk['id']}"); |
865 | 865 | $this->updateConfigWithNewMountPoint("/storage/usbdisk{$disk['id']}"); |
866 | 866 | } |
867 | 867 | |
868 | - $str_uid = 'UUID=' . $this->getUuid($dev) . ''; |
|
868 | + $str_uid = 'UUID='.$this->getUuid($dev).''; |
|
869 | 869 | $format_p4 = $this->getFsType($dev); |
870 | - $conf .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n"; |
|
870 | + $conf .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n"; |
|
871 | 871 | $mount_point = "/storage/usbdisk{$disk['id']}"; |
872 | 872 | Util::mwMkdir($mount_point); |
873 | 873 | } |
@@ -979,11 +979,11 @@ discard block |
||
979 | 979 | Util::mwMkdir('/storage'); |
980 | 980 | $chmodPath = Util::which('chmod'); |
981 | 981 | Processes::mwExec("{$chmodPath} 755 /storage"); |
982 | - if ( ! file_exists($varEtcDir . '/cfdevice')) { |
|
982 | + if (!file_exists($varEtcDir.'/cfdevice')) { |
|
983 | 983 | return; |
984 | 984 | } |
985 | 985 | $fstab = ''; |
986 | - $file_data = file_get_contents($varEtcDir . '/cfdevice'); |
|
986 | + $file_data = file_get_contents($varEtcDir.'/cfdevice'); |
|
987 | 987 | $cf_disk = trim($file_data); |
988 | 988 | if ('' == $cf_disk) { |
989 | 989 | return; |
@@ -993,9 +993,9 @@ discard block |
||
993 | 993 | $part3 = (strpos($cf_disk, 'mmcblk') !== false) ? "{$cf_disk}p3" : "{$cf_disk}3"; // Conf |
994 | 994 | |
995 | 995 | |
996 | - $uid_part2 = 'UUID=' . $this->getUuid("/dev/{$part2}") . ''; |
|
996 | + $uid_part2 = 'UUID='.$this->getUuid("/dev/{$part2}").''; |
|
997 | 997 | $format_p2 = $this->getFsType($part2); |
998 | - $uid_part3 = 'UUID=' . $this->getUuid("/dev/{$part3}") . ''; |
|
998 | + $uid_part3 = 'UUID='.$this->getUuid("/dev/{$part3}").''; |
|
999 | 999 | $format_p3 = $this->getFsType($part3); |
1000 | 1000 | |
1001 | 1001 | // $fstab .= "/dev/{$part1} /cf msdos ro 1 1\n"; // НЕ МОНТИРУЕМ! |
@@ -1040,12 +1040,12 @@ discard block |
||
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - if ( ! empty($path)) { |
|
1043 | + if (!empty($path)) { |
|
1044 | 1044 | Util::mwMkdir($path); |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | $downloadCacheDir = appPath('sites/pbxcore/files/cache'); |
1048 | - if ( ! $isLiveCd) { |
|
1048 | + if (!$isLiveCd) { |
|
1049 | 1049 | Util::mwMkdir($downloadCacheDir); |
1050 | 1050 | Util::createUpdateSymlink($this->config->path('www.downloadCacheDir'), $downloadCacheDir); |
1051 | 1051 | } |
@@ -1083,13 +1083,13 @@ discard block |
||
1083 | 1083 | public function createAssetsSymlinks(): void |
1084 | 1084 | { |
1085 | 1085 | $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache'); |
1086 | - Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/js', $jsCacheDir); |
|
1086 | + Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/js', $jsCacheDir); |
|
1087 | 1087 | |
1088 | 1088 | $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache'); |
1089 | - Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/css', $cssCacheDir); |
|
1089 | + Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/css', $cssCacheDir); |
|
1090 | 1090 | |
1091 | 1091 | $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache'); |
1092 | - Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/img', $imgCacheDir); |
|
1092 | + Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/img', $imgCacheDir); |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | /** |
@@ -1100,13 +1100,13 @@ discard block |
||
1100 | 1100 | $cacheDirs = []; |
1101 | 1101 | $cacheDirs[] = $this->config->path('www.uploadDir'); |
1102 | 1102 | $cacheDirs[] = $this->config->path('www.downloadCacheDir'); |
1103 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/js'; |
|
1104 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/css'; |
|
1105 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/img'; |
|
1103 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/js'; |
|
1104 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/css'; |
|
1105 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/img'; |
|
1106 | 1106 | $cacheDirs[] = $this->config->path('adminApplication.voltCacheDir'); |
1107 | 1107 | $rmPath = Util::which('rm'); |
1108 | 1108 | foreach ($cacheDirs as $cacheDir) { |
1109 | - if ( ! empty($cacheDir)) { |
|
1109 | + if (!empty($cacheDir)) { |
|
1110 | 1110 | Processes::mwExec("{$rmPath} -rf {$cacheDir}/*"); |
1111 | 1111 | } |
1112 | 1112 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | $countBlock = $swapSize * $bs; |
1217 | 1217 | $ddCmd = Util::which('dd'); |
1218 | 1218 | |
1219 | - Util::sysLogMsg('Swap', 'make swap ' . $swapFile, LOG_INFO, LOG_INFO); |
|
1219 | + Util::sysLogMsg('Swap', 'make swap '.$swapFile, LOG_INFO, LOG_INFO); |
|
1220 | 1220 | Processes::mwExec("{$ddCmd} if=/dev/zero of={$swapFile} bs={$bs} count={$countBlock}"); |
1221 | 1221 | |
1222 | 1222 | $mkSwapCmd = Util::which('mkswap'); |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | |
1225 | 1225 | $swapOnCmd = Util::which('swapon'); |
1226 | 1226 | $result = Processes::mwExec("{$swapOnCmd} {$swapFile}"); |
1227 | - Util::sysLogMsg('Swap', 'connect swap result: ' . $result, LOG_INFO, LOG_INFO); |
|
1227 | + Util::sysLogMsg('Swap', 'connect swap result: '.$result, LOG_INFO, LOG_INFO); |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | /** |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | $size = 0; |
1238 | 1238 | $mntDir = ''; |
1239 | 1239 | $mounted = self::isStorageDiskMounted('', $mntDir); |
1240 | - if ( ! $mounted) { |
|
1240 | + if (!$mounted) { |
|
1241 | 1241 | return 0; |
1242 | 1242 | } |
1243 | 1243 | $hd = $this->getAllHdd(true); |
@@ -1258,12 +1258,12 @@ discard block |
||
1258 | 1258 | */ |
1259 | 1259 | public function saveDiskSettings($data, $id = '1'): void |
1260 | 1260 | { |
1261 | - if ( ! is_array($data)) { |
|
1261 | + if (!is_array($data)) { |
|
1262 | 1262 | return; |
1263 | 1263 | } |
1264 | 1264 | $disk_data = $this->getDiskSettings($id); |
1265 | 1265 | if (count($disk_data) === 0) { |
1266 | - $uniqid = strtoupper('STORAGE-DISK-' . md5(time())); |
|
1266 | + $uniqid = strtoupper('STORAGE-DISK-'.md5(time())); |
|
1267 | 1267 | $storage_settings = new StorageModel(); |
1268 | 1268 | foreach ($data as $key => $val) { |
1269 | 1269 | $storage_settings->writeAttribute($key, $val); |
@@ -460,17 +460,17 @@ |
||
460 | 460 | $test_alert = ''; |
461 | 461 | if ($free < 5) { |
462 | 462 | $need_alert = true; |
463 | - $test_alert = "The {$disk['id']} has less than 5% of free space available."; |
|
463 | + $test_alert = "the {$disk['id']} has less than 5% of free space available."; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | if ($disk['free_space'] < 500) { |
467 | 467 | $need_alert = true; |
468 | - $test_alert = "The {$disk['id']} has less than 500MB of free space available."; |
|
468 | + $test_alert = "the {$disk['id']} has less than 500MB of free space available."; |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | if ($disk['free_space'] < 100) { |
472 | 472 | $need_alert = true; |
473 | - $test_alert = "The {$disk['id']} has less than 100MB of free space available. Old call records will be deleted."; |
|
473 | + $test_alert = "the {$disk['id']} has less than 100MB of free space available. Old call records will be deleted."; |
|
474 | 474 | Processes::processPHPWorker(WorkerRemoveOldRecords::class); |
475 | 475 | } |
476 | 476 |