Passed
Push — develop ( 6b6080...6a5f69 )
by Nikolay
05:04 queued 10s
created
src/Core/System/Upgrade/UpdateSystemConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         if ($previous_version !== $current_version) {
44 44
             $upgradeClasses      = [];
45 45
             $upgradeClassesDir   = appPath('src/Core/System/Upgrade/Releases');
46
-            $upgradeClassesFiles = glob($upgradeClassesDir . '/*.php', GLOB_NOSORT);
46
+            $upgradeClassesFiles = glob($upgradeClassesDir.'/*.php', GLOB_NOSORT);
47 47
             foreach ($upgradeClassesFiles as $file) {
48 48
                 $className        = pathinfo($file)['filename'];
49 49
                 $moduleModelClass = "\\MikoPBX\\Core\\System\\Upgrade\\Releases\\{$className}";
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 if (version_compare($previous_version, $releaseNumber, '<')) {
58 58
                     $processor = new $upgradeClass();
59 59
                     $processor->processUpdate();
60
-                    Util::echoWithSyslog(' - UpdateConfigs: Upgrade system up to ' . $releaseNumber . ' ');
60
+                    Util::echoWithSyslog(' - UpdateConfigs: Upgrade system up to '.$releaseNumber.' ');
61 61
                     Util::echoGreenDone();
62 62
                 }
63 63
             }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $modules = PbxExtensionModules::find();
79 79
         $modulesDir = $this->getDI()->getShared('config')->path('core.modulesDir');
80 80
         foreach ($modules as $module) {
81
-            if ( ! is_dir("{$modulesDir}/{$module->uniqid}")) {
81
+            if (!is_dir("{$modulesDir}/{$module->uniqid}")) {
82 82
                 $module->delete();
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
src/Common/Models/PbxSettings.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $cacheKey        = explode('\\', static::class)[3];
45 45
         $parameters      = [
46 46
             'cache' => [
47
-                'key'      => $cacheKey . '-getAllPbxSettings',
47
+                'key'      => $cacheKey.'-getAllPbxSettings',
48 48
                 'lifetime' => 300,
49 49
             ],
50 50
         ];
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         return [
70 70
             'Name'                            => 'PBX system',
71
-            'VirtualHardwareType'             => 'REAL',//VMWARE,HYPERV,AWS,AZURE
71
+            'VirtualHardwareType'             => 'REAL', //VMWARE,HYPERV,AWS,AZURE
72 72
             'Description'                     => '',
73 73
             'RestartEveryNight'               => '0',
74 74
             'SIPPort'                         => '5060',
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
             'MailTplVoicemailSubject'         => 'VoiceMail from PBX',
111 111
             'MailTplVoicemailBody'            => 'See attach',
112 112
             'MailTplVoicemailFooter'          => '',
113
-            'NTPServer'                       => '0.pool.ntp.org' . PHP_EOL . '1.pool.ntp.org' . PHP_EOL,
113
+            'NTPServer'                       => '0.pool.ntp.org'.PHP_EOL.'1.pool.ntp.org'.PHP_EOL,
114 114
             'VoicemailNotificationsEmail'     => '[email protected]',
115 115
             'VoicemailExten'                  => '*001',
116 116
             'PBXLanguage'                     => 'en-en',
117
-            'PBXInternalExtensionLength'      => '3',// Длина внутреннего номера
117
+            'PBXInternalExtensionLength'      => '3', // Длина внутреннего номера
118 118
             'PBXRecordCalls'                  => '1',
119 119
             'PBXSplitAudioThread'             => '0',
120 120
             'PBXCallParkingExt'               => '800',
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $cacheKey        = explode('\\', static::class)[3];
152 152
         $parameters      = [
153 153
             'cache' => [
154
-                'key'      => $cacheKey . '-getValueByKey',
154
+                'key'      => $cacheKey.'-getValueByKey',
155 155
                 'lifetime' => 300,
156 156
             ],
157 157
         ];
Please login to merge, or discard this patch.
src/Core/System/Upgrade/Releases/UpdateConfigsUpToVer20202754.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             'slin'  => 'Signed Linear PCM',
85 85
             'opus'  => 'Opus',
86 86
         ];
87
-        $codecs      = Codecs::find();
87
+        $codecs = Codecs::find();
88 88
         // Удалим лишние кодеки
89 89
         /** @var Codecs $codec */
90 90
         foreach ($codecs as $codec) {
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
                 $this->checkDisabledCodec($codec);
93 93
                 continue;
94 94
             }
95
-            if ( ! $codec->delete()) {
95
+            if (!$codec->delete()) {
96 96
                 Util::sysLogMsg(
97 97
                     __CLASS__,
98
-                    'Can not delete codec ' . $codec->name . ' from MikoPBX\Common\Models\Codecs'
98
+                    'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs'
99 99
                 );
100 100
             }
101 101
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private function checkDisabledCodec(Codecs $codec): void
112 112
     {
113
-        if ( ! in_array($codec->disabled, ['0', '1'], true)) {
113
+        if (!in_array($codec->disabled, ['0', '1'], true)) {
114 114
             $codec->disabled = '0';
115 115
             $codec->save();
116 116
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     private function addNewCodecs(array $availCodecs): void
125 125
     {
126 126
         foreach ($availCodecs as $availCodec => $desc) {
127
-            $codecData = Codecs::findFirst('name="' . $availCodec . '"');
127
+            $codecData = Codecs::findFirst('name="'.$availCodec.'"');
128 128
             if ($codecData === null) {
129 129
                 $codecData = new Codecs();
130 130
             } elseif ($codecData->description === $desc) {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
             }
140 140
             $codecData->type        = $type;
141 141
             $codecData->description = $desc;
142
-            if ( ! $codecData->save()) {
142
+            if (!$codecData->save()) {
143 143
                 Util::sysLogMsg(
144 144
                     __CLASS__,
145
-                    'Can not update codec info ' . $codecData->name . ' from \MikoPBX\Common\Models\Codecs'
145
+                    'Can not update codec info '.$codecData->name.' from \MikoPBX\Common\Models\Codecs'
146 146
                 );
147 147
             }
148 148
         }
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
         $astDbPath = $this->config->path('astDatabase.dbfile');
195 195
         if (file_exists($astDbPath)) {
196 196
             $table = 'astdb';
197
-            $sql   = 'DELETE FROM ' . $table . ' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
197
+            $sql   = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
198 198
             $db    = new SQLite3($astDbPath);
199 199
             try {
200 200
                 $db->exec($sql);
201 201
             } catch (Throwable $e) {
202
-                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...' . $e->getMessage());
202
+                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...'.$e->getMessage());
203 203
                 sleep(2);
204 204
             }
205 205
             $db->close();
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function copyMohFilesToStorage(): void
214 214
     {
215
-        $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh';
216
-        if ( ! file_exists($oldMohDir)) {
215
+        $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh';
216
+        if (!file_exists($oldMohDir)) {
217 217
             return;
218 218
         }
219 219
         $currentMohDir = $this->config->path('asterisk.mohdir');
220
-        if ( ! Util::mwMkdir($currentMohDir)) {
220
+        if (!Util::mwMkdir($currentMohDir)) {
221 221
             return;
222 222
         }
223 223
 
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
             if (in_array($file, ['.', '..'])) {
227 227
                 continue;
228 228
             }
229
-            if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) {
229
+            if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) {
230 230
                 $sound_file           = new SoundFiles();
231
-                $sound_file->path     = $currentMohDir . '/' . $file;
231
+                $sound_file->path     = $currentMohDir.'/'.$file;
232 232
                 $sound_file->category = SoundFiles::CATEGORY_MOH;
233 233
                 $sound_file->name     = $file;
234 234
                 $sound_file->save();
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
             Extensions::TYPE_CONFERENCE,
293 293
 
294 294
         ];
295
-        $parameters=[
295
+        $parameters = [
296 296
             'conditions'=>'show_in_phonebook!=1 and type IN ({ids:array})',
297 297
             'bind'       => [
298 298
                 'ids' => $showInPhonebookTypes,
299 299
             ],
300 300
         ];
301
-        $extensions           = Extensions::find($parameters);
301
+        $extensions = Extensions::find($parameters);
302 302
         foreach ($extensions as $extension) {
303 303
             if (in_array($extension->type, $showInPhonebookTypes)) {
304 304
                 $extension->show_in_phonebook = '1';
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
      */
314 314
     private function moveReadOnlySoundsToStorage(): void
315 315
     {
316
-        $currentMediaDir = $this->config->path('asterisk.customSoundDir') . '/';
317
-        if ( ! is_dir($currentMediaDir)) {
316
+        $currentMediaDir = $this->config->path('asterisk.customSoundDir').'/';
317
+        if (!is_dir($currentMediaDir)) {
318 318
             Util::mwMkdir($currentMediaDir);
319 319
         }
320 320
         $soundFiles = SoundFiles::find();
321 321
         foreach ($soundFiles as $soundFile) {
322 322
             if (stripos($soundFile->path, '/offload/asterisk/sounds/other/') === 0) {
323
-                $newPath = $currentMediaDir . pathinfo($soundFile->path)['basename'];
323
+                $newPath = $currentMediaDir.pathinfo($soundFile->path)['basename'];
324 324
                 if (copy($soundFile->path, $newPath)) {
325 325
                     $soundFile->path = $newPath;
326 326
                     $soundFile->update();
Please login to merge, or discard this patch.
src/Core/System/Configs/IptablesConf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
                 file_put_contents('/etc/iptables/iptables.mikopbx', implode("\n", $arr_command));
87 87
                 file_put_contents(
88 88
                     '/etc/iptables/iptables.mikopbx',
89
-                    "\n" . implode("\n", $arr_commands_custom),
89
+                    "\n".implode("\n", $arr_commands_custom),
90 90
                     FILE_APPEND
91 91
                 );
92 92
                 file_put_contents(
93 93
                     '/etc/iptables/iptables.mikopbx',
94
-                    "\n" . $dropCommand,
94
+                    "\n".$dropCommand,
95 95
                     FILE_APPEND
96 96
                 );
97 97
                 $systemctlPath = Util::which('systemctl');
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $data_port = '';
138 138
         if (trim($dport) !== '') {
139
-            $data_port = '--dport ' . $dport;
139
+            $data_port = '--dport '.$dport;
140 140
         }
141 141
         $other_data = trim($other_data);
142 142
 
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
                 continue;
170 170
             }
171 171
             $other_data = "-p {$rule->protocol}";
172
-            $other_data .= ($network_filter === null) ? '' : ' -s ' . $network_filter->permit;
172
+            $other_data .= ($network_filter === null) ? '' : ' -s '.$network_filter->permit;
173 173
             if ($rule->protocol === 'icmp') {
174
-                $port       = '';
174
+                $port = '';
175 175
                 $other_data .= ' --icmp-type echo-request';
176 176
             }
177 177
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     } else {
219 219
                         $newRule->action = 'block';
220 220
                     }
221
-                    if (key_exists($key, $currentRules[$networkFilter->id])){
221
+                    if (key_exists($key, $currentRules[$networkFilter->id])) {
222 222
                         $newRule->description = $currentRules[$networkFilter->id][$key]['description'];
223 223
                     }
224 224
                     $newRule->save();
Please login to merge, or discard this patch.
src/Core/Workers/WorkerCdr.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             ]
86 86
         ];
87 87
 
88
-        $results   = Users::find($parameters);
88
+        $results = Users::find($parameters);
89 89
         foreach ($results as $record) {
90 90
             if (empty($record->email)) {
91 91
                 continue;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function getActiveIdChannels(): array
152 152
     {
153
-        $am           = Util::getAstManager('off');
153
+        $am = Util::getAstManager('off');
154 154
         return $am->GetChannels(true);
155 155
     }
156 156
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $this->no_answered_calls[$row['linkedid']]['NOANSWER'] = false;
166 166
             return;
167 167
         }
168
-        if ( ! array_key_exists($row['dst_num'], $this->internal_numbers)) {
168
+        if (!array_key_exists($row['dst_num'], $this->internal_numbers)) {
169 169
             // dst_num - не является номером сотрудника. Это исходящий.
170 170
             return;
171 171
         }
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
             if (!empty($row['recordingfile'])) {
231 231
                 // Удаляем файлы
232 232
                 $p_info = pathinfo($row['recordingfile']);
233
-                $fileName = $p_info['dirname'] . '/' . $p_info['filename'];
234
-                $file_list = [$fileName . '.mp3', $fileName . '.wav', $fileName . '_in.wav', $fileName . '_out.wav',];
233
+                $fileName = $p_info['dirname'].'/'.$p_info['filename'];
234
+                $file_list = [$fileName.'.mp3', $fileName.'.wav', $fileName.'_in.wav', $fileName.'_out.wav', ];
235 235
                 foreach ($file_list as $file) {
236 236
                     if (!file_exists($file) || is_dir($file)) {
237 237
                         continue;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 Processes::mwExec("rm -rf {$row['recordingfile']}");
271 271
             }
272 272
         } elseif (!empty($row['recordingfile']) &&
273
-            !file_exists(Util::trimExtensionForFile($row['recordingfile']) . '.wav') &&
273
+            !file_exists(Util::trimExtensionForFile($row['recordingfile']).'.wav') &&
274 274
             !file_exists($row['recordingfile'])) {
275 275
             /** @var CallDetailRecordsTmp $rec_data */
276 276
             $rec_data = CallDetailRecordsTmp::findFirst("linkedid='{$row['linkedid']}' AND dst_chan='{$row['dst_chan']}'");
Please login to merge, or discard this patch.
src/Core/System/Network.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                  */
284 284
                 $pid_file = "/var/run/udhcpc_{$if_name}";
285 285
                 $pid_pcc  = Processes::getPidOfProcess($pid_file);
286
-                if ( ! empty($pid_pcc) && file_exists($pid_file)) {
286
+                if (!empty($pid_pcc) && file_exists($pid_file)) {
287 287
                     // Завершаем старый процесс.
288 288
                     $killPath = Util::which('kill');
289 289
                     $catPath  = Util::which('cat');
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 
413 413
             $result = [''];
414 414
             if (file_exists('/etc/static-routes')) {
415
-                $command = "{$catPath} /etc/static-routes " .
416
-                    "| {$grepPath} '^rout' " .
417
-                    "| {$busyboxPath} awk -F ';' '{print $1}' " .
418
-                    "| {$grepPath} '{$if_name}\$' " .
415
+                $command = "{$catPath} /etc/static-routes ".
416
+                    "| {$grepPath} '^rout' ".
417
+                    "| {$busyboxPath} awk -F ';' '{print $1}' ".
418
+                    "| {$grepPath} '{$if_name}\$' ".
419 419
                     "| {$awkPath} -F 'dev {$if_name}' '{ print $1 }'";
420 420
                 Processes::mwExec($command, $result);
421 421
             }
@@ -425,19 +425,19 @@  discard block
 block discarded – undo
425 425
 
426 426
             if ($if_data['vlanid'] > 0) {
427 427
                 // Пока только статика.
428
-                $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n" .
429
-                    "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n" .
430
-                    "address {$ipaddr}\n" .
431
-                    "netmask {$subnet}\n" .
432
-                    "gateway {$gateway}\n" .
433
-                    "dns-nameservers 127.0.0.1\n" .
434
-                    "vlan_raw_device {$if_data['interface_orign']}\n" .
435
-                    "{$routs_add}\n" .
428
+                $lan_config = "auto {$if_data['interface_orign']}.{$if_data['vlanid']}\n".
429
+                    "iface {$if_data['interface_orign']}.{$if_data['vlanid']} inet static \n".
430
+                    "address {$ipaddr}\n".
431
+                    "netmask {$subnet}\n".
432
+                    "gateway {$gateway}\n".
433
+                    "dns-nameservers 127.0.0.1\n".
434
+                    "vlan_raw_device {$if_data['interface_orign']}\n".
435
+                    "{$routs_add}\n".
436 436
                     "{$routs_rem}\n";
437 437
             } elseif (trim($if_data['dhcp']) === '1') {
438
-                $lan_config = "auto {$if_name}\n" .
439
-                    "iface {$if_name} inet dhcp\n" .
440
-                    "{$routs_add}\n" .
438
+                $lan_config = "auto {$if_name}\n".
439
+                    "iface {$if_name} inet dhcp\n".
440
+                    "{$routs_add}\n".
441 441
                     "{$routs_rem}\n";
442 442
             } else {
443 443
                 if (empty($ipaddr)) {
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
                     echo "Caught exception: $ipaddr $subnet", $e->getMessage(), "\n";
451 451
                     continue;
452 452
                 }
453
-                $lan_config = "auto {$if_name}\n" .
454
-                    "iface {$if_name} inet static\n" .
455
-                    "address {$ipaddr}\n" .
456
-                    "netmask {$subnet}\n" .
457
-                    "gateway {$gateway}\n" .
458
-                    "dns-nameservers 127.0.0.1\n" .
459
-                    "{$routs_add}\n" .
453
+                $lan_config = "auto {$if_name}\n".
454
+                    "iface {$if_name} inet static\n".
455
+                    "address {$ipaddr}\n".
456
+                    "netmask {$subnet}\n".
457
+                    "gateway {$gateway}\n".
458
+                    "dns-nameservers 127.0.0.1\n".
459
+                    "{$routs_add}\n".
460 460
                     "{$routs_rem}\n";
461 461
             }
462 462
             file_put_contents("/etc/network/interfaces.d/{$if_name}", $lan_config);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         $net_mask = explode(".", $net_mask);
548 548
 
549 549
         foreach ($net_mask as $oct_ect) {
550
-            $bits += strlen(str_replace("0", "", decbin((int)$oct_ect)));
550
+            $bits += strlen(str_replace("0", "", decbin((int) $oct_ect)));
551 551
         }
552 552
 
553 553
         return $bits;
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
         $data->hostname  = 'mikopbx';
611 611
         $data->domain    = '';
612 612
         $data->topology  = 'private';
613
-        $data->primarydns= '';
613
+        $data->primarydns = '';
614 614
         $data->save();
615 615
 
616 616
         return $data->toArray();
@@ -631,15 +631,15 @@  discard block
 block discarded – undo
631 631
     public function hostnameConfigure(): void
632 632
     {
633 633
         $data       = Network::getHostName();
634
-        $hosts_conf = "127.0.0.1 localhost\n" .
634
+        $hosts_conf = "127.0.0.1 localhost\n".
635 635
             "127.0.0.1 {$data['hostname']}\n";
636
-        if ( ! empty($data['domain'])) {
636
+        if (!empty($data['domain'])) {
637 637
             $hosts_conf .= "127.0.0.1 {$data['hostname']}.{$data['domain']}\n";
638 638
         }
639 639
         Util::fileWriteContent('/etc/hosts', $hosts_conf);
640 640
 
641 641
         $hostnamePath = Util::which('hostname');
642
-        Processes::mwExec($hostnamePath . ' ' . escapeshellarg("{$data['hostname']}"));
642
+        Processes::mwExec($hostnamePath.' '.escapeshellarg("{$data['hostname']}"));
643 643
     }
644 644
 
645 645
     /**
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 
654 654
         $pidFile = '/var/run/openvpn.pid';
655 655
         $pid     = Processes::getPidOfProcess('openvpn');
656
-        if ( ! empty($pid)) {
656
+        if (!empty($pid)) {
657 657
             // Завершаем процесс.
658 658
             $busyboxPath = Util::which('busybox');
659 659
             Processes::mwExec("{$busyboxPath} kill '$pid'");
660 660
         }
661
-        if ( ! empty($data)) {
661
+        if (!empty($data)) {
662 662
             $openvpnPath = Util::which('openvpn');
663 663
             Processes::mwExecBg("{$openvpnPath} --config /etc/openvpn.ovpn --writepid {$pidFile}", '/dev/null', 5);
664 664
         }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
     {
847 847
         /** @var LanInterfaces $res */
848 848
         $res = LanInterfaces::findFirst("interface = '$name' AND vlanid=0");
849
-        if ($res === null || !$this->settingsIsChange($data, $res->toArray()) ) {
849
+        if ($res === null || !$this->settingsIsChange($data, $res->toArray())) {
850 850
             return;
851 851
         }
852 852
         foreach ($data as $key => $value) {
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
      */
887 887
     private function settingsIsChange(array $data, array $dbData):bool{
888 888
         $isChange = false;
889
-        foreach ($data as $key => $value){
890
-            if(!isset($dbData[$key]) || $value === $dbData[$key]){
889
+        foreach ($data as $key => $value) {
890
+            if (!isset($dbData[$key]) || $value === $dbData[$key]) {
891 891
                 continue;
892 892
             }
893 893
             $isChange = true;
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
     {
933 933
         // Настройка по умолчанию.
934 934
         $interface = trim(getenv('interface'));
935
-        if ( ! Util::isSystemctl()) {
935
+        if (!Util::isSystemctl()) {
936 936
             // Для MIKO LFS Edition.
937 937
             $busyboxPath = Util::which('busybox');
938 938
             Processes::mwExec("{$busyboxPath} ifconfig $interface 192.168.2.1 netmask 255.255.255.0");
Please login to merge, or discard this patch.
src/Core/System/BeanstalkClient.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
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
         $this->queue = Pheanstalk::create($config->host, $port);
55 55
         $this->queue->useTube($this->tube);
56
-        foreach ($this->subscriptions as $tube => $callback){
56
+        foreach ($this->subscriptions as $tube => $callback) {
57 57
             $this->subscribe($tube, $callback);
58 58
         }
59 59
         $this->connected = true;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $this->queue->delete($job);
105 105
             }
106 106
         } catch (Throwable $exception) {
107
-            Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
107
+            Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
108 108
             if ($job !== null) {
109 109
                 $this->queue->bury($job);
110 110
             }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     ): Job {
137 137
         $tube = str_replace("\\", '-', $tube);
138 138
         // Change tube
139
-        if ( ! empty($tube) && $this->tube !== $tube) {
139
+        if (!empty($tube) && $this->tube !== $tube) {
140 140
             $this->queue->useTube($tube);
141 141
         }
142 142
         $job_data = serialize($job_data);
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
                 $queueStats = $this->queue->stats()->getArrayCopy();
162 162
 
163 163
                 // Delete buried jobs
164
-                $countBuried=$queueStats['current-jobs-buried'];
164
+                $countBuried = $queueStats['current-jobs-buried'];
165 165
                 while ($job = $this->queue->peekBuried()) {
166 166
                     $countBuried--;
167
-                    if ($countBuried<0){
167
+                    if ($countBuried < 0) {
168 168
                         break;
169 169
                     }
170 170
                     $id = $job->getId();
@@ -173,23 +173,23 @@  discard block
 block discarded – undo
173 173
                 }
174 174
 
175 175
                 // Delete outdated jobs
176
-                $countReady=$queueStats['current-jobs-ready'];
176
+                $countReady = $queueStats['current-jobs-ready'];
177 177
                 while ($job = $this->queue->peekReady()) {
178 178
                     $countReady--;
179
-                    if ($countReady<0){
179
+                    if ($countReady < 0) {
180 180
                         break;
181 181
                     }
182 182
                     $id = $job->getId();
183 183
                     $jobStats = $this->queue->statsJob($job)->getArrayCopy();
184
-                    $age                   = (int)$jobStats['age'];
185
-                    $expectedTimeToExecute = (int)$jobStats['ttr'] * 2;
184
+                    $age                   = (int) $jobStats['age'];
185
+                    $expectedTimeToExecute = (int) $jobStats['ttr'] * 2;
186 186
                     if ($age > $expectedTimeToExecute) {
187 187
                         $this->queue->delete($job);
188 188
                         Util::sysLogMsg(__METHOD__, "Deleted outdated job with ID {$id} from {$tube}");
189 189
                     }
190 190
                 }
191 191
             } catch (Throwable $exception) {
192
-                Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
192
+                Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
193 193
             }
194 194
         }
195 195
     }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         try {
223 223
             $job = $this->queue->reserveWithTimeout($timeout);
224 224
         } catch (Throwable $exception) {
225
-            Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
225
+            Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
226 226
         }
227 227
 
228 228
         if ($job === null) {
Please login to merge, or discard this patch.