@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function generateConfigProtected(): void |
21 | 21 | { |
22 | - $logDir = System::getLogDir() . '/asterisk/'; |
|
22 | + $logDir = System::getLogDir().'/asterisk/'; |
|
23 | 23 | Util::mwMkdir($logDir); |
24 | 24 | $conf = "[general]\n"; |
25 | 25 | $conf .= "queue_log = no\n"; |
@@ -33,6 +33,6 @@ discard block |
||
33 | 33 | $conf .= "{$logDir}verbose => verbose(3),dtmf,fax\n"; |
34 | 34 | $conf .= "\n"; |
35 | 35 | |
36 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/logger.conf', $conf); |
|
36 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/logger.conf', $conf); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | |
15 | 15 | class WorkerRemoveOldRecords extends WorkerBase |
16 | 16 | { |
17 | - protected int $maxProc=1; |
|
17 | + protected int $maxProc = 1; |
|
18 | 18 | |
19 | 19 | public function start($argv): void |
20 | 20 | { |
21 | 21 | $varEtcDir = $this->di->getShared('config')->path('core.varEtcDir'); |
22 | - $filename = "{$varEtcDir}/storage_device"; |
|
22 | + $filename = "{$varEtcDir}/storage_device"; |
|
23 | 23 | if (file_exists($filename)) { |
24 | 24 | $mount_point = file_get_contents($filename); |
25 | 25 | } else { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $out |
55 | 55 | ); |
56 | 56 | foreach ($out as $dir_info) { |
57 | - if ( ! is_dir($dir_info)) { |
|
57 | + if (!is_dir($dir_info)) { |
|
58 | 58 | echo 'error'; |
59 | 59 | continue; |
60 | 60 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setConnectionService("{$this->moduleUniqueId}_module_db"); |
34 | 34 | } |
35 | 35 | parent::initialize(); |
36 | - $this->initialized=true; |
|
36 | + $this->initialized = true; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getRepresent($needLink = false): string |
47 | 47 | { |
48 | - if (!$this->initialized){ |
|
48 | + if (!$this->initialized) { |
|
49 | 49 | $this->initialize(); |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | if (isset($this->moduleUniqueId)) { |
57 | 57 | $name = '<i class="puzzle piece icon"></i> ' |
58 | - . $this->t('mo_' . $this->moduleUniqueId); |
|
58 | + . $this->t('mo_'.$this->moduleUniqueId); |
|
59 | 59 | } else { |
60 | 60 | $name = 'Unknown'; |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $link = $this->getWebInterfaceLink(); |
68 | 68 | |
69 | 69 | $result = $this->t( |
70 | - 'rep' . $this->moduleUniqueId, |
|
70 | + 'rep'.$this->moduleUniqueId, |
|
71 | 71 | [ |
72 | 72 | 'represent' => "<a href='{$link}'>{$name}</a>", |
73 | 73 | ] |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getWebInterfaceLink(): string |
88 | 88 | { |
89 | - if (!$this->initialized){ |
|
89 | + if (!$this->initialized) { |
|
90 | 90 | $this->initialize(); |
91 | 91 | } |
92 | 92 | if (isset($this->moduleUniqueId)) { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | 3 | /** |
4 | - * Copyright © MIKO LLC - All Rights Reserved |
|
5 | - * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | - * Proprietary and confidential |
|
7 | - * Written by Alexey Portnov, 8 2020 |
|
8 | - */ |
|
4 | + * Copyright © MIKO LLC - All Rights Reserved |
|
5 | + * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | + * Proprietary and confidential |
|
7 | + * Written by Alexey Portnov, 8 2020 |
|
8 | + */ |
|
9 | 9 | 'January' => 'January', |
10 | 10 | 'February' => 'February', |
11 | 11 | 'March' => 'March', |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $conf .= $this->generateGeneral(); |
31 | 31 | $conf .= $this->generateProviders(); |
32 | 32 | |
33 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/iax.conf', $conf); |
|
34 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
33 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/iax.conf', $conf); |
|
34 | + file_put_contents($this->config->path('asterisk.astetcdir').'/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function getProviders(): array |
42 | 42 | { |
43 | - $data_providers =[]; |
|
43 | + $data_providers = []; |
|
44 | 44 | // Получим настройки всех аккаунтов. |
45 | - $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
45 | + $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
46 | 46 | foreach ($arrIaxProviders as $peer) { |
47 | 47 | /** @var \MikoPBX\Common\Models\Iax $peer */ |
48 | 48 | $arr_data = $peer->toArray(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'conditions'=>'disabled="0"', |
57 | 57 | 'order' => 'type, priority', |
58 | 58 | ]; |
59 | - $codecs = Codecs::find($filter); |
|
59 | + $codecs = Codecs::find($filter); |
|
60 | 60 | foreach ($codecs as $ob_codec) { |
61 | 61 | $arr_data['codecs'][] = $ob_codec->name; |
62 | 62 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | private function generateGeneral(): string |
93 | 93 | { |
94 | 94 | $iax_port = (trim($this->generalSettings['IAXPort']) !== '') ? $this->generalSettings['IAXPort'] : '4569'; |
95 | - $conf = '[general]' . "\n"; |
|
95 | + $conf = '[general]'."\n"; |
|
96 | 96 | // $conf .= "context=public-direct-dial \n"; |
97 | 97 | $conf .= "bindport={$iax_port}\n"; |
98 | 98 | $conf .= "bindaddr=0.0.0.0\n"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $secret = (trim($provider['secret']) == '') ? '' : ":{$provider['secret']}"; |
153 | 153 | $host = $provider['host']; |
154 | 154 | // $port = (trim($provider['port']) =='')?'':":{$provider['port']}"; |
155 | - $port = ''; |
|
155 | + $port = ''; |
|
156 | 156 | $reg_strings .= "register => {$user}{$secret}@{$host}{$port} \n"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - return $reg_strings . "\n" . $prov_config; |
|
160 | + return $reg_strings."\n".$prov_config; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -91,10 +91,10 @@ |
||
91 | 91 | |
92 | 92 | $codecs = json_decode($data['codecs'], true); |
93 | 93 | foreach ($codecs as $codec){ |
94 | - $record = Codecs::findFirstById($codec['codecId']); |
|
95 | - $record->priority = $codec['priority']; |
|
96 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | - $record->update(); |
|
94 | + $record = Codecs::findFirstById($codec['codecId']); |
|
95 | + $record->priority = $codec['priority']; |
|
96 | + $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | + $record->update(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->flash->success($this->translation->_('ms_SuccessfulSaved')); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function saveAction(): void |
41 | 41 | { |
42 | - if ( ! $this->request->isPost()) { |
|
42 | + if (!$this->request->isPost()) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | $data = $this->request->getPost(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->session->set('SendMetrics', $record->value); |
77 | 77 | break; |
78 | 78 | case 'PBXFeatureTransferDigitTimeout': |
79 | - $record->value = ceil((int)$data['PBXFeatureDigitTimeout']/1000); |
|
79 | + $record->value = ceil((int) $data['PBXFeatureDigitTimeout'] / 1000); |
|
80 | 80 | break; |
81 | 81 | default: |
82 | 82 | if (array_key_exists($key, $data)) { |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $codecs = json_decode($data['codecs'], true); |
97 | - foreach ($codecs as $codec){ |
|
97 | + foreach ($codecs as $codec) { |
|
98 | 98 | $record = Codecs::findFirstById($codec['codecId']); |
99 | 99 | $record->priority = $codec['priority']; |
100 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
100 | + $record->disabled = $codec['disabled'] === true ? '1' : '0'; |
|
101 | 101 | $record->update(); |
102 | 102 | } |
103 | 103 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | if ($this->request->isAjax()) { |
37 | 37 | if ($controller !== 'SESSION') { |
38 | 38 | $sessionRo = $this->di->getShared('sessionRO'); |
39 | - if ( ! is_array($sessionRo) |
|
40 | - || ! array_key_exists('auth', $sessionRo) |
|
39 | + if (!is_array($sessionRo) |
|
40 | + || !array_key_exists('auth', $sessionRo) |
|
41 | 41 | ) { |
42 | 42 | $this->response->setStatusCode(403, 'Forbidden') |
43 | 43 | ->sendHeaders(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } else { // не AJAX запрос |
51 | 51 | $auth = $this->session->get('auth'); |
52 | - if ( ! $auth && $controller !== 'SESSION') { |
|
52 | + if (!$auth && $controller !== 'SESSION') { |
|
53 | 53 | $dispatcher->forward( |
54 | 54 | [ |
55 | 55 | 'controller' => 'session', |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $arrWorkers = $this->prepareWorkersList(); |
54 | 54 | ReactKernel::start( |
55 | - function () use ($arrWorkers) { |
|
55 | + function () use ($arrWorkers) |
|
56 | + { |
|
56 | 57 | // Parallel execution https://github.com/recoilphp/recoil |
57 | 58 | foreach ($arrWorkers as $workersWithCurrentType) { |
58 | 59 | foreach ($workersWithCurrentType as $worker) { |
@@ -132,7 +133,8 @@ discard block |
||
132 | 133 | PBX::waitFullyBooted(); |
133 | 134 | $arrWorkers = $this->prepareWorkersList(); |
134 | 135 | ReactKernel::start( |
135 | - function () use ($arrWorkers) { |
|
136 | + function () use ($arrWorkers) |
|
137 | + { |
|
136 | 138 | // Parallel execution https://github.com/recoilphp/recoil |
137 | 139 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
138 | 140 | foreach ($workersWithCurrentType as $worker) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | if (false === $result) { |
164 | 164 | Util::processPHPWorker($workerClassName); |
165 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
165 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
166 | 166 | } |
167 | 167 | $time_elapsed_secs = microtime(true) - $start; |
168 | 168 | if ($time_elapsed_secs > 10) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | if ($res_ping === false && $level < 10) { |
234 | 234 | Util::processPHPWorker($workerClassName); |
235 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
235 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
236 | 236 | // Wait 1 second while service will be ready to listen requests |
237 | 237 | sleep(1); |
238 | 238 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $arrWorkers = $this->prepareWorkersList(); |
45 | 45 | ReactKernel::start( |
46 | - function () use ($arrWorkers) { |
|
46 | + function() use ($arrWorkers) { |
|
47 | 47 | // Parallel execution https://github.com/recoilphp/recoil |
48 | 48 | foreach ($arrWorkers as $workersWithCurrentType) { |
49 | 49 | foreach ($workersWithCurrentType as $worker) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private function prepareWorkersList(): array |
64 | 64 | { |
65 | - $arrWorkers = [ |
|
65 | + $arrWorkers = [ |
|
66 | 66 | self::CHECK_BY_AMI => |
67 | 67 | [ |
68 | 68 | WorkerAmiListener::class, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | PBX::waitFullyBooted(); |
125 | 125 | $arrWorkers = $this->prepareWorkersList(); |
126 | 126 | ReactKernel::start( |
127 | - function () use ($arrWorkers) { |
|
127 | + function() use ($arrWorkers) { |
|
128 | 128 | // Parallel execution https://github.com/recoilphp/recoil |
129 | 129 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
130 | 130 | foreach ($workersWithCurrentType as $worker) { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } catch (Throwable $e) { |
176 | 176 | global $errorLogger; |
177 | 177 | $errorLogger->captureException($e); |
178 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
178 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
179 | 179 | } |
180 | 180 | yield; |
181 | 181 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } catch (Throwable $e) { |
249 | 249 | global $errorLogger; |
250 | 250 | $errorLogger->captureException($e); |
251 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
251 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
252 | 252 | } |
253 | 253 | yield; |
254 | 254 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | $managedCache = $this->di->get('managedCache'); |
21 | 21 | $lastLicenseCheck = $managedCache->get('lastLicenseCheck'); |
22 | - if ($lastLicenseCheck===null){ |
|
23 | - $lic = $this->di->getShared('license'); |
|
22 | + if ($lastLicenseCheck === null) { |
|
23 | + $lic = $this->di->getShared('license'); |
|
24 | 24 | $lic->checkPBX(); |
25 | 25 | $lic->checkModules(); |
26 | 26 | $managedCache->set('lastLicenseCheck', time(), 3600); |