@@ -64,7 +64,7 @@ |
||
64 | 64 | continue; |
65 | 65 | } |
66 | 66 | if (Util::isJson($text_error)) { |
67 | - $data = json_decode($text_error, true); |
|
67 | + $data = json_decode($text_error, true); |
|
68 | 68 | $test_email .= "<hr>"; |
69 | 69 | $test_email .= "{$section}"; |
70 | 70 | $test_email .= "<hr>"; |
@@ -241,7 +241,8 @@ |
||
241 | 241 | |
242 | 242 | /** |
243 | 243 | */ |
244 | - private function getCheckResult(){ |
|
244 | + private function getCheckResult() |
|
245 | + { |
|
245 | 246 | $result_data = $this->client_queue->getBody(); |
246 | 247 | // Получаем результат. |
247 | 248 | $result = json_decode($result_data, true); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ] |
90 | 90 | ]; |
91 | 91 | |
92 | - $results = Users::find($parameters); |
|
92 | + $results = Users::find($parameters); |
|
93 | 93 | foreach ($results as $record) { |
94 | 94 | if (empty($record->email)) { |
95 | 95 | continue; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function getActiveIdChannels(): array |
160 | 160 | { |
161 | - $am = Util::getAstManager('off'); |
|
161 | + $am = Util::getAstManager('off'); |
|
162 | 162 | return $am->GetChannels(true); |
163 | 163 | } |
164 | 164 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $this->no_answered_calls[$row['linkedid']]['NOANSWER'] = false; |
174 | 174 | return; |
175 | 175 | } |
176 | - if ( ! array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
176 | + if (!array_key_exists($row['dst_num'], $this->internal_numbers)) { |
|
177 | 177 | // dst_num - не является номером сотрудника. Это исходящий. |
178 | 178 | return; |
179 | 179 | } |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | if (!empty($row['recordingfile'])) { |
239 | 239 | // Удаляем файлы |
240 | 240 | $p_info = pathinfo($row['recordingfile']); |
241 | - $fileName = $p_info['dirname'] . '/' . $p_info['filename']; |
|
242 | - $file_list = [$fileName . '.mp3', $fileName . '.wav', $fileName . '_in.wav', $fileName . '_out.wav',]; |
|
241 | + $fileName = $p_info['dirname'].'/'.$p_info['filename']; |
|
242 | + $file_list = [$fileName.'.mp3', $fileName.'.wav', $fileName.'_in.wav', $fileName.'_out.wav', ]; |
|
243 | 243 | foreach ($file_list as $file) { |
244 | 244 | if (!file_exists($file) || is_dir($file)) { |
245 | 245 | continue; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | /** |
263 | 263 | */ |
264 | - private function getCheckResult(){ |
|
264 | + private function getCheckResult() { |
|
265 | 265 | $result_data = $this->client_queue->getBody(); |
266 | 266 | // Получаем результат. |
267 | 267 | $result = json_decode($result_data, true); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | $result = $file_data; |
274 | 274 | } |
275 | - if ( ! is_array($result) && ! is_object($result)) { |
|
275 | + if (!is_array($result) && !is_object($result)) { |
|
276 | 276 | $result = []; |
277 | 277 | } |
278 | 278 | return $result; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | Processes::mwExec("rm -rf {$row['recordingfile']}"); |
298 | 298 | } |
299 | 299 | } elseif (!empty($row['recordingfile']) && |
300 | - !file_exists(Util::trimExtensionForFile($row['recordingfile']) . '.wav') && |
|
300 | + !file_exists(Util::trimExtensionForFile($row['recordingfile']).'.wav') && |
|
301 | 301 | !file_exists($row['recordingfile'])) { |
302 | 302 | /** @var CallDetailRecordsTmp $rec_data */ |
303 | 303 | $rec_data = CallDetailRecordsTmp::findFirst("linkedid='{$row['linkedid']}' AND dst_chan='{$row['dst_chan']}'"); |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function generateConfigProtected(): void |
21 | 21 | { |
22 | - $conf = "[general]\n" . |
|
23 | - "featuredigittimeout = {$this->generalSettings['PBXFeatureDigitTimeout']}\n" . |
|
24 | - "atxfernoanswertimeout = {$this->generalSettings['PBXFeatureAtxferNoAnswerTimeout']}\n" . |
|
25 | - "transferdigittimeout = {$this->generalSettings['PBXFeatureTransferDigitTimeout']}\n" . |
|
26 | - "pickupexten = {$this->generalSettings['PBXFeaturePickupExten']}\n" . |
|
27 | - "atxferabort = *0\n" . |
|
28 | - "\n" . |
|
29 | - "[featuremap]\n" . |
|
30 | - "atxfer => {$this->generalSettings['PBXFeatureAttendedTransfer']}\n" . |
|
31 | - "disconnect = *0\n" . |
|
22 | + $conf = "[general]\n". |
|
23 | + "featuredigittimeout = {$this->generalSettings['PBXFeatureDigitTimeout']}\n". |
|
24 | + "atxfernoanswertimeout = {$this->generalSettings['PBXFeatureAtxferNoAnswerTimeout']}\n". |
|
25 | + "transferdigittimeout = {$this->generalSettings['PBXFeatureTransferDigitTimeout']}\n". |
|
26 | + "pickupexten = {$this->generalSettings['PBXFeaturePickupExten']}\n". |
|
27 | + "atxferabort = *0\n". |
|
28 | + "\n". |
|
29 | + "[featuremap]\n". |
|
30 | + "atxfer => {$this->generalSettings['PBXFeatureAttendedTransfer']}\n". |
|
31 | + "disconnect = *0\n". |
|
32 | 32 | "blindxfer => {$this->generalSettings['PBXFeatureBlindTransfer']}\n"; |
33 | 33 | |
34 | 34 | $additionalModules = $this->di->getShared('pbxConfModules'); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $conf .= $appClass->getFeatureMap(); |
37 | 37 | } |
38 | 38 | |
39 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/features.conf', $conf); |
|
39 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/features.conf', $conf); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Секция global для extensions.conf. |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $moduleAgiBinDir = "{$moduleDir}/agi-bin"; |
116 | 116 | $files = glob("$moduleAgiBinDir/*.{php}", GLOB_BRACE); |
117 | 117 | foreach ($files as $file) { |
118 | - $newFilename = $agiBinDir . '/' . basename($file); |
|
118 | + $newFilename = $agiBinDir.'/'.basename($file); |
|
119 | 119 | Util::createUpdateSymlink($file, $newFilename); |
120 | 120 | } |
121 | 121 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $needDisable = false; |
137 | 137 | $moduleDir = PbxExtensionUtils::getModuleDir($module['uniqid']); |
138 | 138 | $moduleJson = "{$moduleDir}/module.json"; |
139 | - if ( ! file_exists($moduleJson)) { |
|
139 | + if (!file_exists($moduleJson)) { |
|
140 | 140 | $needDisable = true; |
141 | 141 | } |
142 | 142 | $jsonString = file_get_contents($moduleJson); |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | } catch (Throwable $exception) { |
153 | 153 | Util::sysLogMsg(__CLASS__, "Can not disable module {$module['uniqid']} Message: {$exception}"); |
154 | 154 | } finally { |
155 | - $currentModule = PbxExtensionModules::findFirstByUniqid($module['uniqid']); |
|
156 | - if ($currentModule->disabled==='0'){ |
|
155 | + $currentModule = PbxExtensionModules::findFirstByUniqid($module['uniqid']); |
|
156 | + if ($currentModule->disabled === '0') { |
|
157 | 157 | $currentModule->disabled = '1'; |
158 | 158 | $currentModule->update(); |
159 | 159 | } |
@@ -52,20 +52,20 @@ |
||
52 | 52 | $this->config = $this->getDI()->getShared('config'); |
53 | 53 | $modulesDir = $this->config->path('core.modulesDir'); |
54 | 54 | |
55 | - if (empty($this->moduleUniqueId)){ |
|
55 | + if (empty($this->moduleUniqueId)) { |
|
56 | 56 | // Get child class parameters and define module Dir and UniqueID |
57 | 57 | $reflector = new ReflectionClassAlias(static::class); |
58 | 58 | $partsOfNameSpace = explode('\\', $reflector->getNamespaceName()); |
59 | - if (count($partsOfNameSpace)===3 && $partsOfNameSpace[0]==='Modules'){ |
|
59 | + if (count($partsOfNameSpace) === 3 && $partsOfNameSpace[0] === 'Modules') { |
|
60 | 60 | $this->moduleUniqueId = $partsOfNameSpace[1]; |
61 | - $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
61 | + $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
62 | 62 | } |
63 | 63 | } else { |
64 | - $this->moduleDir = "{$modulesDir}{$this->moduleUniqueId}"; |
|
64 | + $this->moduleDir = "{$modulesDir}{$this->moduleUniqueId}"; |
|
65 | 65 | } |
66 | 66 | |
67 | - $className = basename(str_replace('\\', '/', static::class)); |
|
68 | - $this->logger = new Logger($className, $this->moduleUniqueId); |
|
67 | + $className = basename(str_replace('\\', '/', static::class)); |
|
68 | + $this->logger = new Logger($className, $this->moduleUniqueId); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $res = new PBXApiResult(); |
58 | 58 | $res->processor = __METHOD__; |
59 | 59 | $res->success = true; |
60 | - $filter = [ |
|
60 | + $filter = [ |
|
61 | 61 | 'order' => 'id', |
62 | 62 | 'columns' => 'start,answer,endtime,src_num,dst_num,did,linkedid', |
63 | 63 | 'miko_tmp_db' => true, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $message = $client->request(json_encode($filter), 2); |
67 | 67 | if ($message === false) { |
68 | 68 | $res->data = []; |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | $res->data[] = $message; |
71 | 71 | } |
72 | 72 | return $res; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $res->processor = __METHOD__; |
84 | 84 | $res->success = true; |
85 | 85 | |
86 | - $filter = [ |
|
86 | + $filter = [ |
|
87 | 87 | 'endtime IS NULL', |
88 | 88 | 'order' => 'id', |
89 | 89 | 'columns' => 'start,answer,src_chan,dst_chan,src_num,dst_num,did,linkedid', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $data = json_decode(file_get_contents($result), true); |
105 | 105 | unlink($result); |
106 | 106 | foreach ($data as $row) { |
107 | - if ( ! isset($active_chans[$row['linkedid']])) { |
|
107 | + if (!isset($active_chans[$row['linkedid']])) { |
|
108 | 108 | // Вызов уже не существует. |
109 | 109 | continue; |
110 | 110 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $message = $client->request(json_encode($filter), 2); |
67 | 67 | if ($message === false) { |
68 | 68 | $res->data = []; |
69 | - }else{ |
|
69 | + } else{ |
|
70 | 70 | $res->data[] = $message; |
71 | 71 | } |
72 | 72 | return $res; |
@@ -80,22 +80,22 @@ |
||
80 | 80 | return $res; |
81 | 81 | } |
82 | 82 | |
83 | - public static function getDbConnection(){ |
|
84 | - if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){ |
|
85 | - return null; |
|
86 | - } |
|
87 | - try { |
|
88 | - $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH); |
|
89 | - }catch (Throwable $e){ |
|
90 | - return null; |
|
91 | - } |
|
92 | - $db->busyTimeout(5000); |
|
93 | - $fail2ban = new Fail2BanConf(); |
|
94 | - if (false === $fail2ban->tableBanExists($db)) { |
|
95 | - return null; |
|
96 | - } |
|
83 | + public static function getDbConnection(){ |
|
84 | + if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){ |
|
85 | + return null; |
|
86 | + } |
|
87 | + try { |
|
88 | + $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH); |
|
89 | + }catch (Throwable $e){ |
|
90 | + return null; |
|
91 | + } |
|
92 | + $db->busyTimeout(5000); |
|
93 | + $fail2ban = new Fail2BanConf(); |
|
94 | + if (false === $fail2ban->tableBanExists($db)) { |
|
95 | + return null; |
|
96 | + } |
|
97 | 97 | |
98 | - return $db; |
|
98 | + return $db; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -80,13 +80,14 @@ |
||
80 | 80 | return $res; |
81 | 81 | } |
82 | 82 | |
83 | - public static function getDbConnection(){ |
|
83 | + public static function getDbConnection() |
|
84 | + { |
|
84 | 85 | if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){ |
85 | 86 | return null; |
86 | 87 | } |
87 | 88 | try { |
88 | 89 | $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH); |
89 | - }catch (Throwable $e){ |
|
90 | + } catch (Throwable $e){ |
|
90 | 91 | return null; |
91 | 92 | } |
92 | 93 | $db->busyTimeout(5000); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function fail2banUnbanAll(string $ip): PBXApiResult |
32 | 32 | { |
33 | - $ip = trim($ip); |
|
33 | + $ip = trim($ip); |
|
34 | 34 | $res = new PBXApiResult(); |
35 | 35 | $res->processor = __METHOD__; |
36 | 36 | $res->success = true; |
37 | - if ( ! Verify::isIpAddress($ip)) { |
|
37 | + if (!Verify::isIpAddress($ip)) { |
|
38 | 38 | $res->success = false; |
39 | - $res->messages[]="Not valid ip '{$ip}'."; |
|
39 | + $res->messages[] = "Not valid ip '{$ip}'."; |
|
40 | 40 | } |
41 | - $fail2ban = new Fail2BanConf(); |
|
41 | + $fail2ban = new Fail2BanConf(); |
|
42 | 42 | if ($fail2ban->fail2ban_enable) { |
43 | 43 | $fail2ban = Util::which('fail2ban-client'); |
44 | - $res->success = (Processes::mwExec("{$fail2ban} unban {$ip}") === 0); |
|
44 | + $res->success = (Processes::mwExec("{$fail2ban} unban {$ip}") === 0); |
|
45 | 45 | } else { |
46 | 46 | $res = self::fail2banUnbanDb($ip); |
47 | 47 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $res->processor = __METHOD__; |
63 | 63 | |
64 | 64 | $db = self::getDbConnection(); |
65 | - if(!$db){ |
|
65 | + if (!$db) { |
|
66 | 66 | // Таблица не существует. Бана нет. |
67 | 67 | $res->success = false; |
68 | 68 | $res->messages[] = 'DB '.Fail2BanConf::FAIL2BAN_DB_PATH.' not found'; |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | return $res; |
82 | 82 | } |
83 | 83 | |
84 | - public static function getDbConnection(){ |
|
85 | - if(!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)){ |
|
84 | + public static function getDbConnection() { |
|
85 | + if (!file_exists(Fail2BanConf::FAIL2BAN_DB_PATH)) { |
|
86 | 86 | return null; |
87 | 87 | } |
88 | 88 | try { |
89 | - $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH); |
|
90 | - }catch (Throwable $e){ |
|
89 | + $db = new SQLite3(Fail2BanConf::FAIL2BAN_DB_PATH); |
|
90 | + } catch (Throwable $e) { |
|
91 | 91 | return null; |
92 | 92 | } |
93 | 93 | $db->busyTimeout(5000); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $ban_time = '43800'; |
113 | 113 | } |
114 | 114 | // Добавленн фильтр по времени бана. возвращаем только адреса, которые еще НЕ разбанены. |
115 | - $q = 'SELECT' . ' DISTINCT jail,ip,MAX(timeofban) AS timeofban, MAX(timeofban+' . $ban_time . ') AS timeunban FROM bans where (timeofban+' . $ban_time . ')>' . time(); |
|
115 | + $q = 'SELECT'.' DISTINCT jail,ip,MAX(timeofban) AS timeofban, MAX(timeofban+'.$ban_time.') AS timeunban FROM bans where (timeofban+'.$ban_time.')>'.time(); |
|
116 | 116 | if ($ip !== null) { |
117 | 117 | $q .= " AND ip='{$ip}'"; |
118 | 118 | } |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | |
136 | 136 | $jail_q = ($jail === '') ? '' : "AND jail = '{$jail}'"; |
137 | 137 | $path_db = Fail2BanConf::FAIL2BAN_DB_PATH; |
138 | - if(!file_exists($path_db)){ |
|
138 | + if (!file_exists($path_db)) { |
|
139 | 139 | // Таблица не существует. Бана нет. |
140 | 140 | $res->success = false; |
141 | 141 | $res->messages[] = "DB {$path_db} not found"; |
142 | 142 | return $res; |
143 | 143 | } |
144 | - $db = new SQLite3($path_db); |
|
144 | + $db = new SQLite3($path_db); |
|
145 | 145 | $db->busyTimeout(3000); |
146 | 146 | $fail2ban = new Fail2BanConf(); |
147 | 147 | if (false === $fail2ban->tableBanExists($db)) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $res->success = true; |
150 | 150 | return $res; |
151 | 151 | } |
152 | - $q = 'DELETE' . " FROM bans WHERE ip = '{$ip}' {$jail_q}"; |
|
152 | + $q = 'DELETE'." FROM bans WHERE ip = '{$ip}' {$jail_q}"; |
|
153 | 153 | $db->query($q); |
154 | 154 | |
155 | 155 | $err = $db->lastErrorMsg(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $from_name = $settings['MailSMTPFromUsername']; |
79 | 79 | } |
80 | 80 | |
81 | - $mail->Port = (integer)$settings['MailSMTPPort']; |
|
81 | + $mail->Port = (integer) $settings['MailSMTPPort']; |
|
82 | 82 | $mail->CharSet = 'UTF-8'; |
83 | 83 | |
84 | 84 | $mail->setFrom($from_address, $from_name); |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $mail->Subject = $subject; |
91 | 91 | $mail->Body = $message; |
92 | 92 | |
93 | - if ( ! $mail->send()) { |
|
93 | + if (!$mail->send()) { |
|
94 | 94 | $messages[] = $mail->ErrorInfo; |
95 | 95 | } |
96 | 96 | } catch (Throwable $e) { |
97 | 97 | $messages[] = $e->getMessage(); |
98 | 98 | } |
99 | 99 | |
100 | - if (count($messages)>0) { |
|
100 | + if (count($messages) > 0) { |
|
101 | 101 | Util::sysLogMsg('PHPMailer', implode(' ', $messages), LOG_ERR); |
102 | 102 | return false; |
103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $settings = $mikoPBXConfig->getGeneralSettings(); |
110 | 110 | $systemNotificationsEmail = $settings['SystemNotificationsEmail']; |
111 | 111 | $result = self::sendMail($systemNotificationsEmail, 'Test mail from MIKO PBX', '<b>Test message</b><hr>'); |
112 | - return ($result===true); |
|
112 | + return ($result === true); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $mikoPBXConfig = new MikoPBXConfig(); |
123 | 123 | $settings = $mikoPBXConfig->getGeneralSettings(); |
124 | 124 | |
125 | - $conf = "defaults\n" . |
|
126 | - "auth on\n" . |
|
125 | + $conf = "defaults\n". |
|
126 | + "auth on\n". |
|
127 | 127 | // "logfile /var/log/msmtp.log\n". |
128 | - "timeout 10\n" . |
|
128 | + "timeout 10\n". |
|
129 | 129 | "syslog LOG_LOCAL0\n\n"; |
130 | 130 | |
131 | 131 | if (isset($settings["MailSMTPUseTLS"]) && $settings["MailSMTPUseTLS"] == "1") { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'slin' => 'Signed Linear PCM', |
84 | 84 | 'opus' => 'Opus', |
85 | 85 | ]; |
86 | - $codecs = Codecs::find(); |
|
86 | + $codecs = Codecs::find(); |
|
87 | 87 | // Удалим лишние кодеки |
88 | 88 | /** @var Codecs $codec */ |
89 | 89 | foreach ($codecs as $codec) { |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | $this->checkDisabledCodec($codec); |
92 | 92 | continue; |
93 | 93 | } |
94 | - if ( ! $codec->delete()) { |
|
94 | + if (!$codec->delete()) { |
|
95 | 95 | Util::sysLogMsg( |
96 | 96 | __CLASS__, |
97 | - 'Can not delete codec ' . $codec->name . ' from MikoPBX\Common\Models\Codecs' |
|
97 | + 'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs' |
|
98 | 98 | ); |
99 | 99 | } |
100 | 100 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | private function checkDisabledCodec(Codecs $codec): void |
111 | 111 | { |
112 | - if ( ! in_array($codec->disabled, ['0', '1'], true)) { |
|
112 | + if (!in_array($codec->disabled, ['0', '1'], true)) { |
|
113 | 113 | $codec->disabled = '0'; |
114 | 114 | $codec->save(); |
115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | private function addNewCodecs(array $availCodecs): void |
124 | 124 | { |
125 | 125 | foreach ($availCodecs as $availCodec => $desc) { |
126 | - $codecData = Codecs::findFirst('name="' . $availCodec . '"'); |
|
126 | + $codecData = Codecs::findFirst('name="'.$availCodec.'"'); |
|
127 | 127 | if ($codecData === null) { |
128 | 128 | $codecData = new Codecs(); |
129 | 129 | } elseif ($codecData->description === $desc) { |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | } |
139 | 139 | $codecData->type = $type; |
140 | 140 | $codecData->description = $desc; |
141 | - if ( ! $codecData->save()) { |
|
141 | + if (!$codecData->save()) { |
|
142 | 142 | Util::sysLogMsg( |
143 | 143 | __CLASS__, |
144 | - 'Can not update codec info ' . $codecData->name . ' from \MikoPBX\Common\Models\Codecs' |
|
144 | + 'Can not update codec info '.$codecData->name.' from \MikoPBX\Common\Models\Codecs' |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | } |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | $astDbPath = $this->config->path('astDatabase.dbfile'); |
194 | 194 | if (file_exists($astDbPath)) { |
195 | 195 | $table = 'astdb'; |
196 | - $sql = 'DELETE FROM ' . $table . ' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"'; |
|
196 | + $sql = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"'; |
|
197 | 197 | $db = new SQLite3($astDbPath); |
198 | 198 | try { |
199 | 199 | $db->exec($sql); |
200 | 200 | } catch (Throwable $e) { |
201 | - Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...' . $e->getMessage()); |
|
201 | + Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...'.$e->getMessage()); |
|
202 | 202 | sleep(2); |
203 | 203 | } |
204 | 204 | $db->close(); |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | */ |
212 | 212 | private function copyMohFilesToStorage(): void |
213 | 213 | { |
214 | - $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh'; |
|
215 | - if ( ! file_exists($oldMohDir)) { |
|
214 | + $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh'; |
|
215 | + if (!file_exists($oldMohDir)) { |
|
216 | 216 | return; |
217 | 217 | } |
218 | 218 | $currentMohDir = $this->config->path('asterisk.mohdir'); |
219 | - if ( ! Util::mwMkdir($currentMohDir)) { |
|
219 | + if (!Util::mwMkdir($currentMohDir)) { |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | if (in_array($file, ['.', '..'])) { |
226 | 226 | continue; |
227 | 227 | } |
228 | - if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) { |
|
228 | + if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) { |
|
229 | 229 | $sound_file = new SoundFiles(); |
230 | - $sound_file->path = $currentMohDir . '/' . $file; |
|
230 | + $sound_file->path = $currentMohDir.'/'.$file; |
|
231 | 231 | $sound_file->category = SoundFiles::CATEGORY_MOH; |
232 | 232 | $sound_file->name = $file; |
233 | 233 | $sound_file->save(); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | Extensions::TYPE_CONFERENCE, |
292 | 292 | |
293 | 293 | ]; |
294 | - $extensions = Extensions::find(); |
|
294 | + $extensions = Extensions::find(); |
|
295 | 295 | foreach ($extensions as $extension) { |
296 | 296 | if (in_array($extension->type, $showInPhonebookTypes)) { |
297 | 297 | $extension->show_in_phonebook = '1'; |
@@ -306,14 +306,14 @@ discard block |
||
306 | 306 | */ |
307 | 307 | private function moveReadOnlySoundsToStorage(): void |
308 | 308 | { |
309 | - $currentMediaDir = $this->config->path('asterisk.customSoundDir') . '/'; |
|
310 | - if ( ! is_dir($currentMediaDir)) { |
|
309 | + $currentMediaDir = $this->config->path('asterisk.customSoundDir').'/'; |
|
310 | + if (!is_dir($currentMediaDir)) { |
|
311 | 311 | Util::mwMkdir($currentMediaDir); |
312 | 312 | } |
313 | 313 | $soundFiles = SoundFiles::find(); |
314 | 314 | foreach ($soundFiles as $soundFile) { |
315 | 315 | if (stripos($soundFile->path, '/offload/asterisk/sounds/other/') === 0) { |
316 | - $newPath = $currentMediaDir . pathinfo($soundFile->path)['basename']; |
|
316 | + $newPath = $currentMediaDir.pathinfo($soundFile->path)['basename']; |
|
317 | 317 | if (copy($soundFile->path, $newPath)) { |
318 | 318 | $soundFile->path = $newPath; |
319 | 319 | $soundFile->update(); |