Passed
Push — master ( a2c24b...6427d5 )
by Nikolay
12:54 queued 08:08
created
src/Modules/PbxExtensionState.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
         $this->moduleUniqueID = $moduleUniqueID;
42 42
         $this->modulesRoot    = $this->getDI()->getShared('config')->path('core.modulesDir');
43 43
         $moduleJson           = "{$this->modulesRoot}/{$this->moduleUniqueID}/module.json";
44
-        if ( ! file_exists($moduleJson)) {
45
-            $this->messages[] = 'module.json not found for module ' . $this->moduleUniqueID;
44
+        if (!file_exists($moduleJson)) {
45
+            $this->messages[] = 'module.json not found for module '.$this->moduleUniqueID;
46 46
 
47 47
             return;
48 48
         }
49 49
 
50 50
         $jsonString            = file_get_contents($moduleJson);
51 51
         $jsonModuleDescription = json_decode($jsonString, true);
52
-        if ( ! is_array($jsonModuleDescription)) {
53
-            $this->messages[] = 'module.json parsing error ' . $this->moduleUniqueID;
52
+        if (!is_array($jsonModuleDescription)) {
53
+            $this->messages[] = 'module.json parsing error '.$this->moduleUniqueID;
54 54
 
55 55
             return;
56 56
         }
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
             }
94 94
         }
95 95
         $success = $this->makeBeforeEnableTest();
96
-        if ( ! $success) {
96
+        if (!$success) {
97 97
             return false;
98 98
         }
99 99
 
100 100
         $this->reloadConfigClass();
101 101
         // Если ошибок нет, включаем Firewall и модуль
102
-        if ( ! $this->enableFirewallSettings()) {
102
+        if (!$this->enableFirewallSettings()) {
103 103
             $this->messages[] = 'Error on enable firewall settings';
104 104
 
105 105
             return false;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 if (array_key_exists($network->id, $previousRules)) {
181 181
                     $newRule->action = $previousRules[$network->id];
182 182
                 }
183
-                if ( ! $newRule->save()) {
183
+                if (!$newRule->save()) {
184 184
                     $this->messages[] = $newRule->getMessages();
185 185
                 }
186 186
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         if ($this->configClass !== null
209 209
             && method_exists($this->configClass, 'createNginxLocations')
210
-            && ! empty($this->configClass->createNginxLocations())) {
210
+            && !empty($this->configClass->createNginxLocations())) {
211 211
             $nginxConf = new NginxConf();
212 212
             $nginxConf->generateModulesConf();
213 213
             $nginxConf->reStart();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         if ($this->configClass !== null
226 226
             && method_exists($this->configClass, 'generateFail2BanJails')
227
-            && ! empty($this->configClass->generateFail2BanJails())) {
227
+            && !empty($this->configClass->generateFail2BanJails())) {
228 228
             IptablesConf::reloadFirewall();
229 229
         }
230 230
     }
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
     public function disableModule(): bool
237 237
     {
238 238
         $success = $this->makeBeforeDisableTest();
239
-        if ( ! $success) {
239
+        if (!$success) {
240 240
             return false;
241 241
         }
242 242
         $this->reloadConfigClass();
243 243
         // Если ошибок нет, выключаем Firewall и модуль
244
-        if ( ! $this->disableFirewallSettings()) {
244
+        if (!$this->disableFirewallSettings()) {
245 245
             $this->messages[] = 'Error on disable firewall settings';
246 246
 
247 247
             return false;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             && method_exists($this->configClass, 'onBeforeModuleDisable')
301 301
             && $this->configClass->onBeforeModuleDisable() === false) {
302 302
             $messages = $this->configClass->getMessages();
303
-            if ( ! empty($messages)) {
303
+            if (!empty($messages)) {
304 304
                 $this->messages = $messages;
305 305
             } else {
306 306
                 $this->messages[] = 'Error on the Module enable function at onBeforeModuleDisable';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             $className        = pathinfo($file)['filename'];
319 319
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
320 320
             try {
321
-                if ( ! class_exists($moduleModelClass)) {
321
+                if (!class_exists($moduleModelClass)) {
322 322
                     continue;
323 323
                 }
324 324
                 $reflection = new ReflectionClass($moduleModelClass);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 }
331 331
                 $records = $moduleModelClass::find();
332 332
                 foreach ($records as $record) {
333
-                    if ( ! $record->beforeDelete()) {
333
+                    if (!$record->beforeDelete()) {
334 334
                         foreach ($record->getMessages() as $message) {
335 335
                             $this->messages[] = $message->getMessage();
336 336
                         }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             $savedState[$detailRule->networkfilterid] = $detailRule->action;
383 383
         }
384 384
         $this->db->begin(true);
385
-        if ( ! $currentRules->delete()) {
385
+        if (!$currentRules->delete()) {
386 386
             $this->messages[] = $currentRules->getMessages();
387 387
 
388 388
             return false;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $previousRuleSettings->key = "{$this->moduleUniqueID}FirewallSettings";
395 395
         }
396 396
         $previousRuleSettings->value = json_encode($savedState);
397
-        if ( ! $previousRuleSettings->save()) {
397
+        if (!$previousRuleSettings->save()) {
398 398
             $this->messages[] = $previousRuleSettings->getMessages();
399 399
         }
400 400
         if (count($errors) > 0) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             && method_exists($this->configClass, 'onBeforeModuleEnable')
448 448
             && $this->configClass->onBeforeModuleEnable() === false) {
449 449
             $messages = $this->configClass->getMessages();
450
-            if ( ! empty($messages)) {
450
+            if (!empty($messages)) {
451 451
                 $this->messages = $messages;
452 452
             } else {
453 453
                 $this->messages[] = 'Error on the enableModule function at onBeforeModuleEnable';
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
468 468
 
469 469
             try {
470
-                if ( ! class_exists($moduleModelClass)) {
470
+                if (!class_exists($moduleModelClass)) {
471 471
                     continue;
472 472
                 }
473 473
                 $reflection = new ReflectionClass($moduleModelClass);
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                                     'modulename' => $record->getRepresent(true),
498 498
                                 ]
499 499
                             );
500
-                            $success          = false;
500
+                            $success = false;
501 501
                         }
502 502
                     }
503 503
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     private function reloadConfigClass(): void
70 70
     {
71 71
         $class_name      = str_replace('Module', '', $this->moduleUniqueID);
72
-        $configClassName = "\\Modules\\{$this->moduleUniqueID}\\Lib\\{$class_name}Conf";
72
+        $configClassName = "\\Modules\\{$this->moduleUniqueID}\\Lib\\{$class_name}conf";
73 73
         if (class_exists($configClassName)) {
74 74
             $this->configClass = new $configClassName();
75 75
         } else {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         $this->db->begin(true);
153 153
         $defaultRules         = $this->configClass->getDefaultFirewallRules();
154
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}FirewallSettings");
154
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}firewallsettings");
155 155
         $previousRules        = [];
156 156
         if ($previousRuleSettings !== null) {
157 157
             $previousRules = json_decode($previousRuleSettings->value, true);
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
             return false;
389 389
         }
390 390
 
391
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}FirewallSettings");
391
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}firewallsettings");
392 392
         if ($previousRuleSettings === null) {
393 393
             $previousRuleSettings      = new PbxSettings();
394
-            $previousRuleSettings->key = "{$this->moduleUniqueID}FirewallSettings";
394
+            $previousRuleSettings->key = "{$this->moduleUniqueID}firewallsettings";
395 395
         }
396 396
         $previousRuleSettings->value = json_encode($savedState);
397 397
         if ( ! $previousRuleSettings->save()) {
Please login to merge, or discard this patch.
src/Modules/PbxExtensionUtils.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $moduleAgiBinDir = "{$moduleDir}/agi-bin";
115 115
         $files           = glob("$moduleAgiBinDir/*.{php}", GLOB_BRACE);
116 116
         foreach ($files as $file) {
117
-            $newFilename = $agiBinDir . '/' . basename($file);
117
+            $newFilename = $agiBinDir.'/'.basename($file);
118 118
             Util::createUpdateSymlink($file, $newFilename);
119 119
         }
120 120
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $needDisable = false;
136 136
             $moduleDir   = PbxExtensionUtils::getModuleDir($module['uniqid']);
137 137
             $moduleJson  = "{$moduleDir}/module.json";
138
-            if ( ! file_exists($moduleJson)) {
138
+            if (!file_exists($moduleJson)) {
139 139
                 $needDisable = true;
140 140
             }
141 141
             $jsonString            = file_get_contents($moduleJson);
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
                 } catch (ErrorAlias $exception) {
152 152
                     Util::sysLogMsg(__CLASS__, "Can not disable module {$module['uniqid']} Message: {$exception}");
153 153
                 } finally {
154
-                    $currentModule           = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
155
-                    if ($currentModule->disabled==='0'){
154
+                    $currentModule = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
155
+                    if ($currentModule->disabled === '0') {
156 156
                         $currentModule->disabled = '1';
157 157
                         $currentModule->update();
158 158
                     }
Please login to merge, or discard this patch.
src/PBXCoreREST/Workers/WorkerApiCommands.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
         } catch (Error $exception) {
109 109
             $res             = new PBXApiResult();
110 110
             $res->processor  = __METHOD__;
111
-            $res->messages[] = 'Exception on WorkerApiCommands - ' . $exception->getMessage();
111
+            $res->messages[] = 'Exception on WorkerApiCommands - '.$exception->getMessage();
112 112
         }
113 113
         $message->reply(json_encode($res->getResult(), JSON_THROW_ON_ERROR));
114 114
         $this->checkNeedReload($res->data);
Please login to merge, or discard this patch.
src/PBXCoreREST/Controllers/System/PostController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,10 +109,10 @@
 block discarded – undo
109 109
         $mohDir                = $di->getShared('config')->path('asterisk.mohdir');
110 110
         switch ($category) {
111 111
             case SoundFiles::CATEGORY_MOH:
112
-                $data['filename'] = "{$mohDir}/" . basename($data['temp_filename']);
112
+                $data['filename'] = "{$mohDir}/".basename($data['temp_filename']);
113 113
                 break;
114 114
             case SoundFiles::CATEGORY_CUSTOM:
115
-                $data['filename'] = "{$mediaDir}/" . basename($data['temp_filename']);
115
+                $data['filename'] = "{$mediaDir}/".basename($data['temp_filename']);
116 116
                 break;
117 117
             default:
118 118
                 $this->sendError(400, 'Category not set');
Please login to merge, or discard this patch.
src/PBXCoreREST/Controllers/Files/PostController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         if ($response !== false) {
98 98
             $response = json_decode($response, true);
99 99
             $filename = $response['data']['filename'] ?? '';
100
-            if ( ! file_exists($filename)) {
100
+            if (!file_exists($filename)) {
101 101
                 $response['messages'][] = 'Config file not found';
102 102
             } else {
103 103
                 $response['data']['filename'] = $filename;
104
-                $response['data']['content']  = mb_convert_encoding('' . file_get_contents($filename), 'UTF-8', 'UTF-8');
104
+                $response['data']['content']  = mb_convert_encoding(''.file_get_contents($filename), 'UTF-8', 'UTF-8');
105 105
                 unlink($filename);
106 106
             }
107 107
             $this->response->setPayloadSuccess($response);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function uploadResumableAction(): void
117 117
     {
118
-        $data   = $this->request->getPost();
118
+        $data = $this->request->getPost();
119 119
         $data['result'] = 'ERROR';
120 120
 
121 121
         if ($this->request->hasFiles() > 0) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 'resumableTotalSize'   => $this->request->getPost('resumableTotalSize'),
128 128
             ];
129 129
             foreach ($this->request->getUploadedFiles() as $file) {
130
-                $data['files'][]= [
130
+                $data['files'][] = [
131 131
                     'file_path' => $file->getTempName(),
132 132
                     'file_size' => $file->getSize(),
133 133
                     'file_error'=> $file->getError(),
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
                     'file_type' => $file->getType()
136 136
                 ];
137 137
                 if ($file->getError()) {
138
-                    $data['data'] = 'error ' . $file->getError() . ' in file ' . $file->getTempName();
138
+                    $data['data'] = 'error '.$file->getError().' in file '.$file->getTempName();
139 139
                     $this->sendError(400, $data['data']);
140
-                    Util::sysLogMsg('UploadFile', 'error ' . $file->getError() . ' in file ' . $file->getTempName());
140
+                    Util::sysLogMsg('UploadFile', 'error '.$file->getError().' in file '.$file->getTempName());
141 141
                     return;
142 142
                 }
143 143
             }
Please login to merge, or discard this patch.
src/PBXCoreREST/Lib/SysLogsManagementProcessor.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -76,35 +76,35 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $res            = new PBXApiResult();
78 78
         $res->processor = __METHOD__;
79
-        $filename       = System::getLogDir() . '/' . $filename;
80
-        if ( ! file_exists($filename)) {
79
+        $filename       = System::getLogDir().'/'.$filename;
80
+        if (!file_exists($filename)) {
81 81
             $res->success    = false;
82
-            $res->messages[] = 'No access to the file ' . $filename;
82
+            $res->messages[] = 'No access to the file '.$filename;
83 83
         } else {
84 84
             $res->success = true;
85 85
             $head         = Util::which('head');
86 86
             $grep         = Util::which('grep');
87 87
             $tail         = Util::which('tail');
88 88
             $filter       = escapeshellarg($filter);
89
-            $offset       = (int)$offset;
90
-            $lines        = (int)$lines;
91
-            $linesPlusOffset = $lines+$offset;
89
+            $offset       = (int) $offset;
90
+            $lines        = (int) $lines;
91
+            $linesPlusOffset = $lines + $offset;
92 92
 
93 93
             $di          = Di::getDefault();
94 94
             $dirsConfig  = $di->getShared('config');
95
-            $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.log';
96
-            if (empty($filter)){
95
+            $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.log';
96
+            if (empty($filter)) {
97 97
                 $cmd         = "{$tail} -n {$linesPlusOffset} {$filename}";
98 98
             } else {
99 99
                 $cmd         = "{$grep} -F {$filter} {$filename} | $tail -n {$linesPlusOffset}";
100 100
             }
101
-            if ($offset>0){
101
+            if ($offset > 0) {
102 102
                 $cmd .= " | {$head} -n {$lines}";
103 103
             }
104 104
             $cmd .= " > $filenameTmp";
105 105
 
106 106
             Util::mwExec("$cmd; chown www:www $filenameTmp");
107
-            $res->data['cmd']=$cmd;
107
+            $res->data['cmd'] = $cmd;
108 108
             $res->data['filename'] = $filenameTmp;
109 109
         }
110 110
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $systemInfoFile = "{$logDir}/system-information.log";
163 163
         file_put_contents($systemInfoFile, SysinfoManagementProcessor::prepareSysyinfoContent());
164 164
 
165
-        $futureFileName        = $temp_dir . '/temp-all-log-' . time() . '.zip';
165
+        $futureFileName        = $temp_dir.'/temp-all-log-'.time().'.zip';
166 166
         $res->data['filename'] = $futureFileName;
167 167
         $res->success          = true;
168 168
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $res->processor = __METHOD__;
199 199
 
200 200
         $progress_file = "{$resultFile}.progress";
201
-        if ( ! file_exists($progress_file)) {
201
+        if (!file_exists($progress_file)) {
202 202
             $res->messages[] = 'Archive does not exist. Try again!';
203 203
         } elseif (file_exists($progress_file) && file_get_contents($progress_file) === '100') {
204 204
             $uid          = Util::generateRandomString(36);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             $downloadLink = $di->getShared('config')->path('www.downloadCacheDir');
207 207
             $result_dir   = "{$downloadLink}/{$uid}";
208 208
             Util::mwMkdir($result_dir);
209
-            $link_name = 'MikoPBXLogs_' . basename($resultFile);
209
+            $link_name = 'MikoPBXLogs_'.basename($resultFile);
210 210
             Util::createUpdateSymlink($resultFile, "{$result_dir}/{$link_name}");
211 211
             Util::addRegularWWWRights("{$result_dir}/{$link_name}");
212 212
             $res->success          = true;
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $res            = new PBXApiResult();
234 234
         $res->processor = __METHOD__;
235
-        $filename       = System::getLogDir() . '/' . $filename;
236
-        if ( ! file_exists($filename)) {
235
+        $filename       = System::getLogDir().'/'.$filename;
236
+        if (!file_exists($filename)) {
237 237
             $res->success    = false;
238
-            $res->messages[] = 'File does not exist ' . $filename;
238
+            $res->messages[] = 'File does not exist '.$filename;
239 239
         } else {
240 240
             $uid          = Util::generateRandomString(36);
241 241
             $di           = Di::getDefault();
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                 continue;
277 277
             }
278 278
 
279
-            $relativePath             = str_ireplace($logDir . '/', '', $entry);
279
+            $relativePath             = str_ireplace($logDir.'/', '', $entry);
280 280
             $fileSizeKB               = ceil($fileSize / 1024);
281 281
             $filesList[$relativePath] =
282 282
                 [
@@ -313,11 +313,11 @@  discard block
 block discarded – undo
313 313
                 continue;
314 314
             }
315 315
             //if current file ($d) is a directory, call scanDirRecursively
316
-            if (is_dir($dir . '/' . $d)) {
317
-                $list[] = self::scanDirRecursively($dir . '/' . $d);
316
+            if (is_dir($dir.'/'.$d)) {
317
+                $list[] = self::scanDirRecursively($dir.'/'.$d);
318 318
                 //otherwise, add the file to the list
319
-            } elseif (is_file($dir . '/' . $d) || is_link($dir . '/' . $d)) {
320
-                $list[] = $dir . '/' . $d;
319
+            } elseif (is_file($dir.'/'.$d) || is_link($dir.'/'.$d)) {
320
+                $list[] = $dir.'/'.$d;
321 321
             }
322 322
         }
323 323
 
Please login to merge, or discard this patch.
src/Core/System/Upgrade/Releases/UpdateConfigsUpToVer20202754.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             'slin'  => 'Signed Linear PCM',
82 82
             'opus'  => 'Opus',
83 83
         ];
84
-        $codecs      = Codecs::find();
84
+        $codecs = Codecs::find();
85 85
         // Удалим лишние кодеки
86 86
         /** @var Codecs $codec */
87 87
         foreach ($codecs as $codec) {
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
                 $this->checkDisabledCodec($codec);
90 90
                 continue;
91 91
             }
92
-            if ( ! $codec->delete()) {
92
+            if (!$codec->delete()) {
93 93
                 Util::sysLogMsg(
94 94
                     __CLASS__,
95
-                    'Can not delete codec ' . $codec->name . ' from MikoPBX\Common\Models\Codecs'
95
+                    'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs'
96 96
                 );
97 97
             }
98 98
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     private function checkDisabledCodec(Codecs $codec): void
109 109
     {
110
-        if ( ! in_array($codec->disabled, ['0', '1'], true)) {
110
+        if (!in_array($codec->disabled, ['0', '1'], true)) {
111 111
             $codec->disabled = '0';
112 112
             $codec->save();
113 113
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     private function addNewCodecs(array $availCodecs): void
122 122
     {
123 123
         foreach ($availCodecs as $availCodec => $desc) {
124
-            $codecData = Codecs::findFirst('name="' . $availCodec . '"');
124
+            $codecData = Codecs::findFirst('name="'.$availCodec.'"');
125 125
             if ($codecData === null) {
126 126
                 $codecData = new Codecs();
127 127
             } elseif ($codecData->description === $desc) {
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
             }
137 137
             $codecData->type        = $type;
138 138
             $codecData->description = $desc;
139
-            if ( ! $codecData->save()) {
139
+            if (!$codecData->save()) {
140 140
                 Util::sysLogMsg(
141 141
                     __CLASS__,
142
-                    'Can not update codec info ' . $codecData->name . ' from \MikoPBX\Common\Models\Codecs'
142
+                    'Can not update codec info '.$codecData->name.' from \MikoPBX\Common\Models\Codecs'
143 143
                 );
144 144
             }
145 145
         }
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
         $astDbPath = $this->config->path('astDatabase.dbfile');
192 192
         if (file_exists($astDbPath)) {
193 193
             $table = 'astdb';
194
-            $sql   = 'DELETE FROM ' . $table . ' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
194
+            $sql   = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
195 195
             $db    = new \SQLite3($astDbPath);
196 196
             try {
197 197
                 $db->exec($sql);
198 198
             } catch (\Error $e) {
199
-                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...' . $e->getMessage());
199
+                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...'.$e->getMessage());
200 200
                 sleep(2);
201 201
             }
202 202
             $db->close();
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
      */
210 210
     private function copyMohFilesToStorage(): void
211 211
     {
212
-        $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh';
213
-        if ( ! file_exists($oldMohDir)) {
212
+        $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh';
213
+        if (!file_exists($oldMohDir)) {
214 214
             return;
215 215
         }
216 216
         $currentMohDir = $this->config->path('asterisk.mohdir');
217
-        if ( ! Util::mwMkdir($currentMohDir)) {
217
+        if (!Util::mwMkdir($currentMohDir)) {
218 218
             return;
219 219
         }
220 220
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
             if (in_array($file, ['.', '..'])) {
224 224
                 continue;
225 225
             }
226
-            if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) {
226
+            if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) {
227 227
                 $sound_file           = new SoundFiles();
228
-                $sound_file->path     = $currentMohDir . '/' . $file;
228
+                $sound_file->path     = $currentMohDir.'/'.$file;
229 229
                 $sound_file->category = SoundFiles::CATEGORY_MOH;
230 230
                 $sound_file->name     = $file;
231 231
                 $sound_file->save();
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             Extensions::TYPE_CONFERENCE,
290 290
 
291 291
         ];
292
-        $extensions           = Extensions::find();
292
+        $extensions = Extensions::find();
293 293
         foreach ($extensions as $extension) {
294 294
             if (in_array($extension->type, $showInPhonebookTypes)) {
295 295
                 $extension->show_in_phonebook = '1';
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
      */
305 305
     private function moveReadOnlySoundsToStorage(): void
306 306
     {
307
-        $currentMediaDir = $this->config->path('asterisk.customSoundDir') . '/';
308
-        if ( ! is_dir($currentMediaDir)) {
307
+        $currentMediaDir = $this->config->path('asterisk.customSoundDir').'/';
308
+        if (!is_dir($currentMediaDir)) {
309 309
             Util::mwMkdir($currentMediaDir);
310 310
         }
311 311
         $soundFiles = SoundFiles::find();
312 312
         foreach ($soundFiles as $soundFile) {
313 313
             if (stripos($soundFile->path, '/offload/asterisk/sounds/other/') === 0) {
314
-                $newPath = $currentMediaDir . pathinfo($soundFile->path)['basename'];
314
+                $newPath = $currentMediaDir.pathinfo($soundFile->path)['basename'];
315 315
                 if (copy($soundFile->path, $newPath)) {
316 316
                     $soundFile->path = $newPath;
317 317
                     $soundFile->update();
Please login to merge, or discard this patch.
src/Core/System/Notifications.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 $from_name = $settings['MailSMTPFromUsername'];
78 78
             }
79 79
 
80
-            $mail->Port    = (integer)$settings['MailSMTPPort'];
80
+            $mail->Port    = (integer) $settings['MailSMTPPort'];
81 81
             $mail->CharSet = 'UTF-8';
82 82
 
83 83
             $mail->setFrom($from_address, $from_name);
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
             $mail->Subject = $subject;
90 90
             $mail->Body    = $message;
91 91
 
92
-            if ( ! $mail->send()) {
92
+            if (!$mail->send()) {
93 93
                 $messages[] = $mail->ErrorInfo;
94 94
             }
95 95
         } catch (\Exception $e) {
96 96
             $messages[] = $e->getMessage();
97 97
         }
98 98
 
99
-        if (count($messages)>0) {
99
+        if (count($messages) > 0) {
100 100
             Util::sysLogMsg('PHPMailer', implode(' ', $messages), LOG_ERR);
101 101
             return false;
102 102
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $settings             = $mikoPBXConfig->getGeneralSettings();
109 109
         $systemNotificationsEmail = $settings['SystemNotificationsEmail'];
110 110
         $result = self::sendMail($systemNotificationsEmail, 'Test mail from MIKO PBX', '<b>Test message</b><hr>');
111
-        return ($result===true);
111
+        return ($result === true);
112 112
     }
113 113
 
114 114
     /**
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         $mikoPBXConfig = new MikoPBXConfig();
122 122
         $settings      = $mikoPBXConfig->getGeneralSettings();
123 123
 
124
-        $conf = "defaults\n" .
125
-            "auth       on\n" .
124
+        $conf = "defaults\n".
125
+            "auth       on\n".
126 126
             // "logfile    /var/log/msmtp.log\n".
127
-            "timeout    10\n" .
127
+            "timeout    10\n".
128 128
             "syslog     LOG_LOCAL0\n\n";
129 129
 
130 130
         if (isset($settings["MailSMTPUseTLS"]) && $settings["MailSMTPUseTLS"] == "1") {
Please login to merge, or discard this patch.
src/Core/Workers/WorkerNotifyByEmail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 class WorkerNotifyByEmail extends WorkerBase
16 16
 {
17
-    protected int $maxProc=1;
17
+    protected int $maxProc = 1;
18 18
     /**
19 19
      * Entry point
20 20
      *
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $tmpArray = [];
51 51
         foreach ($data as $call) {
52 52
             $keyHash = $call['email'].$call['start'].$call['from_number'].$call['to_number'];
53
-            if(in_array($keyHash, $tmpArray, true)){
53
+            if (in_array($keyHash, $tmpArray, true)) {
54 54
                 continue;
55 55
             }
56 56
             $tmpArray[] = $keyHash;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
              * 'language'
59 59
              * 'is_internal'
60 60
              */
61
-            if ( ! isset($emails[$call['email']])) {
61
+            if (!isset($emails[$call['email']])) {
62 62
                 $emails[$call['email']] = '';
63 63
             }
64 64
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 // Start worker process
98 98
 $workerClassname = WorkerNotifyByEmail::class;
99
-$action = $argv[1]??'';
99
+$action = $argv[1] ?? '';
100 100
 if ($action === 'start') {
101 101
     cli_set_process_title($workerClassname);
102 102
     while (true) {
Please login to merge, or discard this patch.