Passed
Push — develop ( 6b6080...6a5f69 )
by Nikolay
05:04 queued 10s
created
src/PBXCoreREST/Controllers/System/PostController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                 $data = $this->request->getPost();
102 102
                 $this->sendRequestToBackendWorker('system', $actionName, $data);
103 103
                 // Clear WWW models cache after successfully install or remove module
104
-                if ($this->response->getStatusCode()===200){
104
+                if ($this->response->getStatusCode() === 200) {
105 105
                     PbxExtensionModules::clearCache(Extensions::class);
106 106
                     PbxExtensionModules::clearCache(PbxExtensionModules::class);
107 107
                     PbxExtensionModules::clearCache(PbxSettings::class);
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
         $mohDir                = $di->getShared('config')->path('asterisk.mohdir');
127 127
         switch ($category) {
128 128
             case SoundFiles::CATEGORY_MOH:
129
-                $data['filename'] = "{$mohDir}/" . basename($data['temp_filename']);
129
+                $data['filename'] = "{$mohDir}/".basename($data['temp_filename']);
130 130
                 break;
131 131
             case SoundFiles::CATEGORY_CUSTOM:
132
-                $data['filename'] = "{$mediaDir}/" . basename($data['temp_filename']);
132
+                $data['filename'] = "{$mediaDir}/".basename($data['temp_filename']);
133 133
                 break;
134 134
             default:
135 135
                 $this->sendError(400, 'Category not set');
Please login to merge, or discard this patch.
src/Core/Workers/WorkerBeanstalkdTidyUp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $managedCache = $this->di->get('managedCache');
30 30
         $lastTubesCheck = $managedCache->get('lastTubesCheck');
31
-        if ($lastTubesCheck === null){
31
+        if ($lastTubesCheck === null) {
32 32
             $client = new BeanstalkClient();
33 33
             $client->cleanTubes();
34 34
             $managedCache->set('lastTubesCheck', time(), 300);
Please login to merge, or discard this patch.
src/AdminCabinet/Providers/DispatcherProvider.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $di->setShared(
40 40
             self::SERVICE_NAME,
41
-            function () {
41
+            function() {
42 42
                 $eventsManager = new EventsManager();
43 43
 
44 44
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 /**
62 62
                  * Handle exceptions and not-found exceptions using NotFoundPlugin
63 63
                  */
64
-                if (! class_exists(PrettyPageHandler::class)) {
64
+                if (!class_exists(PrettyPageHandler::class)) {
65 65
                     $eventsManager->attach(
66 66
                         'dispatch:beforeException',
67 67
                         new NotFoundPlugin()
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         $di->setShared(
40 40
             self::SERVICE_NAME,
41
-            function () {
41
+            function ()
42
+            {
42 43
                 $eventsManager = new EventsManager();
43 44
 
44 45
 
Please login to merge, or discard this patch.
src/Common/Providers/BeanstalkConnectionCacheProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $di->setShared(
34 34
             self::SERVICE_NAME,
35
-            function () {
35
+            function() {
36 36
                 return new BeanstalkClient(CacheCleanerPlugin::class);
37 37
             }
38 38
         );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@
 block discarded – undo
32 32
     {
33 33
         $di->setShared(
34 34
             self::SERVICE_NAME,
35
-            function () {
35
+            function ()
36
+            {
36 37
                 return new BeanstalkClient(CacheCleanerPlugin::class);
37 38
             }
38 39
         );
Please login to merge, or discard this patch.
src/Common/Providers/BeanstalkConnectionModelsProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $di->setShared(
34 34
             self::SERVICE_NAME,
35
-            function () {
35
+            function() {
36 36
                 return new BeanstalkClient(WorkerModelsEvents::class);
37 37
             }
38 38
         );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@
 block discarded – undo
32 32
     {
33 33
         $di->setShared(
34 34
             self::SERVICE_NAME,
35
-            function () {
35
+            function ()
36
+            {
36 37
                 return new BeanstalkClient(WorkerModelsEvents::class);
37 38
             }
38 39
         );
Please login to merge, or discard this patch.
src/Core/Asterisk/Configs/ConferenceConf.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     protected function generateConfigProtected(): void
20 20
     {
21 21
         $conf = "";
22
-        file_put_contents($this->config->path('asterisk.astetcdir') . '/confbridge.conf', $conf);
22
+        file_put_contents($this->config->path('asterisk.astetcdir').'/confbridge.conf', $conf);
23 23
     }
24 24
 
25 25
     /**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $conf = '';
33 33
         $data = self::getConferenceExtensions();
34 34
         foreach ($data as $conference) {
35
-            $conf .= "exten => {$conference},1,Goto(conference-rooms,{$conference},1)" . "\n";
35
+            $conf .= "exten => {$conference},1,Goto(conference-rooms,{$conference},1)"."\n";
36 36
         }
37 37
         $conf .= "\n";
38 38
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $conf = '';
48 48
         $data = self::getConferenceExtensions();
49 49
         foreach ($data as $conference) {
50
-            $conf .= "exten => {$conference},1,Goto(conference-rooms,{$conference},1)" . "\n";
50
+            $conf .= "exten => {$conference},1,Goto(conference-rooms,{$conference},1)"."\n";
51 51
         }
52 52
         $conf .= "\n";
53 53
 
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
         $conf .= "[conference-rooms] \n";
73 73
         $data = self::getConferenceExtensions();
74 74
         foreach ($data as $conference) {
75
-            $conf .= 'exten => ' . $conference . ',1,NoOp(---)' . "\n\t";
76
-            $conf .= 'same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Hangup())' . "\n\t";
77
-            $conf .= 'same => n,AGI(cdr_connector.php,meetme_dial)' . "\n\t";
78
-            $conf .= 'same => n,Answer()' . "\n\t";
79
-            $conf .= 'same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler_meetme,s,1)' . "\n\t";
80
-            $conf .= 'same => n,Meetme(${EXTEN},qdMT' . $rec_options . ')' . "\n\t";
81
-            $conf .= 'same => n,Hangup()' . "\n\n";
75
+            $conf .= 'exten => '.$conference.',1,NoOp(---)'."\n\t";
76
+            $conf .= 'same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Hangup())'."\n\t";
77
+            $conf .= 'same => n,AGI(cdr_connector.php,meetme_dial)'."\n\t";
78
+            $conf .= 'same => n,Answer()'."\n\t";
79
+            $conf .= 'same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler_meetme,s,1)'."\n\t";
80
+            $conf .= 'same => n,Meetme(${EXTEN},qdMT'.$rec_options.')'."\n\t";
81
+            $conf .= 'same => n,Hangup()'."\n\n";
82 82
         }
83 83
 
84 84
         return $conf;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     public static function getConferenceExtensions():array{
108 108
         $confExtensions = [];
109 109
         $conferences = ConferenceRooms::find(['order' => 'extension', 'columns' => 'extension'])->toArray();
110
-        foreach ($conferences as $conference){
110
+        foreach ($conferences as $conference) {
111 111
             $confExtensions[] = $conference['extension'];
112 112
         }
113 113
         return $confExtensions;
Please login to merge, or discard this patch.
src/Core/System/PBX.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             return;
91 91
         }
92 92
         $max_size    = 2;
93
-        $log_dir     = System::getLogDir() . '/asterisk/';
93
+        $log_dir     = System::getLogDir().'/asterisk/';
94 94
         $text_config = "{$log_dir}{$f_name} {
95 95
     nocreate
96 96
     nocopytruncate
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
         {$asteriskPath} -rx 'logger reload' > /dev/null 2> /dev/null
106 106
     endscript
107 107
 }";
108
-        $varEtcDir  = $di->getShared('config')->path('core.varEtcDir');
109
-        $path_conf   = $varEtcDir . '/asterisk_logrotate_' . $f_name . '.conf';
108
+        $varEtcDir = $di->getShared('config')->path('core.varEtcDir');
109
+        $path_conf = $varEtcDir.'/asterisk_logrotate_'.$f_name.'.conf';
110 110
         file_put_contents($path_conf, $text_config);
111 111
         $mb10 = $max_size * 1024 * 1024;
112 112
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
     public static function checkCodec($name, $desc, $type): void
205 205
     {
206
-        $codec = Codecs::findFirst('name="' . $name . '"');
206
+        $codec = Codecs::findFirst('name="'.$name.'"');
207 207
         if ($codec === null) {
208 208
             /** @var \MikoPBX\Common\Models\Codecs $codec_g722 */
209 209
             $codec              = new Codecs();
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public static function sipReload():void
221 221
     {
222
-        $di     = Di::getDefault();
222
+        $di = Di::getDefault();
223 223
         if ($di === null) {
224 224
             return;
225 225
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             Processes::mwExec("{$asteriskPath} -rx 'module reload acl'");
236 236
             Processes::mwExec("{$asteriskPath} -rx 'core reload'");
237 237
         } else {
238
-            Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk',LOG_INFO, LOG_INFO);
238
+            Util::sysLogMsg('SIP RELOAD', 'Need reload asterisk', LOG_INFO, LOG_INFO);
239 239
             // Завершаем каналы.
240 240
             Processes::mwExec("{$asteriskPath} -rx 'channel request hangup all'");
241 241
             usleep(500000);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public static function iaxReload(): void
250 250
     {
251
-        $iax    = new IAXConf();
251
+        $iax = new IAXConf();
252 252
         $iax->generateConfig();
253 253
         $asteriskPath = Util::which('asterisk');
254 254
         Processes::mwExec("{$asteriskPath} -rx 'iax2 reload'");
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             'result' => 'ERROR',
306 306
         ];
307 307
 
308
-        if ( ! $this->di->getShared('registry')->booting) {
308
+        if (!$this->di->getShared('registry')->booting) {
309 309
             $this->stop();
310 310
         }
311 311
         /**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         // Создание базы данных истории звонков.
322 322
         /** @var \Phalcon\Db\Adapter\Pdo\Sqlite $connection */
323 323
         $connection = $this->di->get('dbCDR');
324
-        if ( ! $connection->tableExists('cdr')) {
324
+        if (!$connection->tableExists('cdr')) {
325 325
             RegisterDIServices::recreateDBConnections();
326 326
         } else {
327 327
             CdrDb::checkDb();
Please login to merge, or discard this patch.
src/Core/System/Storage.php 2 patches
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -460,17 +460,17 @@
 block discarded – undo
460 460
             $test_alert = '';
461 461
             if ($free < 5) {
462 462
                 $need_alert = true;
463
-                $test_alert = "The {$disk['id']} has less than 5% of free space available.";
463
+                $test_alert = "the {$disk['id']} has less than 5% of free space available.";
464 464
             }
465 465
 
466 466
             if ($disk['free_space'] < 500) {
467 467
                 $need_alert = true;
468
-                $test_alert = "The {$disk['id']} has less than 500MB of free space available.";
468
+                $test_alert = "the {$disk['id']} has less than 500MB of free space available.";
469 469
             }
470 470
 
471 471
             if ($disk['free_space'] < 100) {
472 472
                 $need_alert = true;
473
-                $test_alert = "The {$disk['id']} has less than 100MB of free space available. Old call records will be deleted.";
473
+                $test_alert = "the {$disk['id']} has less than 100MB of free space available. Old call records will be deleted.";
474 474
                 Processes::processPHPWorker(WorkerRemoveOldRecords::class);
475 475
             }
476 476
 
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
     public static function isStorageDisk($device): bool
74 74
     {
75 75
         $result = false;
76
-        if ( ! file_exists("{$device}")) {
76
+        if (!file_exists("{$device}")) {
77 77
             return $result;
78 78
         }
79 79
 
80
-        $tmp_dir = '/tmp/mnt_' . time();
80
+        $tmp_dir = '/tmp/mnt_'.time();
81 81
         Util::mwMkdir($tmp_dir);
82 82
         $out = [];
83 83
 
84 84
         $storage  = new Storage();
85
-        $uid_part = 'UUID=' . $storage->getUuid($device) . '';
85
+        $uid_part = 'UUID='.$storage->getUuid($device).'';
86 86
         $format   = $storage->getFsType($device);
87 87
         if ($format === '') {
88 88
             return false;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             Processes::mwExec("{$umountPath} {$device}");
102 102
         }
103 103
 
104
-        if ( ! self::isStorageDiskMounted($device)) {
104
+        if (!self::isStorageDiskMounted($device)) {
105 105
             Processes::mwExec("{$rmPath} -rf '{$tmp_dir}'");
106 106
         }
107 107
 
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
         $timeoutPath = Util::which('timeout');
232 232
         $sshfsPath   = Util::which('sshfs');
233 233
 
234
-        $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' " .
235
-            "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n" .
236
-            "{$pass}\n" .
234
+        $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' ".
235
+            "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n".
236
+            "{$pass}\n".
237 237
             "EOF\n";
238 238
         // file_put_contents('/tmp/sshfs_'.$host, $command);
239 239
         Processes::mwExec($command, $out);
@@ -265,19 +265,19 @@  discard block
 block discarded – undo
265 265
 
266 266
         // Собираем строку подключения к ftp.
267 267
         $auth_line = '';
268
-        if ( ! empty($user)) {
269
-            $auth_line .= 'user="' . $user;
270
-            if ( ! empty($pass)) {
268
+        if (!empty($user)) {
269
+            $auth_line .= 'user="'.$user;
270
+            if (!empty($pass)) {
271 271
                 $auth_line .= ":{$pass}";
272 272
             }
273 273
             $auth_line .= '",';
274 274
         }
275 275
 
276
-        $connect_line = 'ftp://' . $host;
277
-        if ( ! empty($port)) {
276
+        $connect_line = 'ftp://'.$host;
277
+        if (!empty($port)) {
278 278
             $connect_line .= ":{$port}";
279 279
         }
280
-        if ( ! empty($remout_dir)) {
280
+        if (!empty($remout_dir)) {
281 281
             $connect_line .= "$remout_dir";
282 282
         }
283 283
 
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
      */
304 304
     public static function mkfs_disk($dev)
305 305
     {
306
-        if ( ! file_exists($dev)) {
306
+        if (!file_exists($dev)) {
307 307
             $dev = "/dev/{$dev}";
308 308
         }
309
-        if ( ! file_exists($dev)) {
309
+        if (!file_exists($dev)) {
310 310
             return false;
311 311
         }
312 312
         $dir = '';
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             Processes::mwExec("/sbin/shell_functions.sh 'killprocesses' '$dir' -TERM 0");
342 342
             Processes::mwExec("{$umountPath} {$dir}");
343 343
         }
344
-        $result = ! self::isStorageDiskMounted($dir);
344
+        $result = !self::isStorageDiskMounted($dir);
345 345
         if ($result && file_exists($dir)) {
346 346
             // Если диск не смонтирован, то удаляем каталог.
347 347
             Processes::mwExec("{$rmPath} -rf '{$dir}'");
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public static function statusMkfs($dev): string
413 413
     {
414
-        if ( ! file_exists($dev)) {
414
+        if (!file_exists($dev)) {
415 415
             $dev = "/dev/{$dev}";
416 416
         }
417 417
         $out      = [];
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         }
435 435
         $config        = $di->getShared('config');
436 436
         $phpSessionDir = $config->path('www.phpSessionDir');
437
-        if ( ! empty($phpSessionDir)) {
437
+        if (!empty($phpSessionDir)) {
438 438
             $rmPath = Util::which('rm');
439 439
             Processes::mwExec("{$rmPath} -rf {$phpSessionDir}/*");
440 440
         }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         // Создание больщого файла для тестов.
451 451
         // head -c 1500MB /dev/urandom > /storage/usbdisk1/big_file.mp3
452 452
         foreach ($hdd as $disk) {
453
-            if ($disk['sys_disk'] === true && ! self::isStorageDiskMounted("{$disk['id']}4")) {
453
+            if ($disk['sys_disk'] === true && !self::isStorageDiskMounted("{$disk['id']}4")) {
454 454
                 // Это системный диск (4ый раздел). Он не смонтирован.
455 455
                 continue;
456 456
             }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 Processes::processPHPWorker(WorkerRemoveOldRecords::class);
475 475
             }
476 476
 
477
-            if ( ! $need_alert) {
477
+            if (!$need_alert) {
478 478
                 continue;
479 479
             }
480 480
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
                 $m_size      = round(($disk_data[1] + $disk_data[2]) / 1024, 1);
515 515
                 $res_disks[] = [
516 516
                     'id'         => $disk_data[0],
517
-                    'size'       => "" . $m_size,
518
-                    'size_text'  => "" . $m_size . " Mb",
517
+                    'size'       => "".$m_size,
518
+                    'size_text'  => "".$m_size." Mb",
519 519
                     'vendor'     => 'Debian',
520 520
                     'mounted'    => '/storage/usbdisk1',
521 521
                     'free_space' => round($disk_data[2] / 1024, 1),
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 
538 538
         $cf_disk   = '';
539 539
         $varEtcDir = $this->config->path('core.varEtcDir');
540
-        if (file_exists($varEtcDir . '/cfdevice')) {
541
-            $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice'));
540
+        if (file_exists($varEtcDir.'/cfdevice')) {
541
+            $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice'));
542 542
         }
543 543
 
544 544
         foreach ($disks as $disk) {
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
             $sys_disk = ($cf_disk == $disk);
555 555
 
556 556
             $mb_size = 0;
557
-            if (is_file("/sys/block/" . $disk . "/size")) {
558
-                $original_size = trim(file_get_contents("/sys/block/" . $disk . "/size"));
557
+            if (is_file("/sys/block/".$disk."/size")) {
558
+                $original_size = trim(file_get_contents("/sys/block/".$disk."/size"));
559 559
                 $original_size = ($original_size * 512 / 1024 / 1024);
560 560
                 $mb_size       = $original_size;
561 561
             }
@@ -662,14 +662,14 @@  discard block
 block discarded – undo
662 662
     private function getVendorDisk($disk): string
663 663
     {
664 664
         $temp_vendor = [];
665
-        if (is_file("/sys/block/" . $disk . "/device/vendor")) {
666
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/vendor"));
665
+        if (is_file("/sys/block/".$disk."/device/vendor")) {
666
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/vendor"));
667 667
             if ($data != '') {
668 668
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
669 669
             }
670 670
         }
671
-        if (is_file("/sys/block/" . $disk . "/device/model")) {
672
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/model"));
671
+        if (is_file("/sys/block/".$disk."/device/model")) {
672
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/model"));
673 673
             if ($data != '') {
674 674
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
675 675
             }
@@ -677,8 +677,8 @@  discard block
 block discarded – undo
677 677
         if (count($temp_vendor) == 0) {
678 678
             $temp_vendor[] = $disk;
679 679
         }
680
-        if (is_file("/sys/block/" . $disk . "/device/type")) {
681
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/type"));
680
+        if (is_file("/sys/block/".$disk."/device/type")) {
681
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/type"));
682 682
             if ($data != '') {
683 683
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
684 684
             }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         Processes::mwExec("{$dfPath} -m | {$grepPath} {$hdd} | {$awkPath} '{print $4}'", $out);
705 705
         $result = 0;
706 706
         foreach ($out as $res) {
707
-            if ( ! is_numeric($res)) {
707
+            if (!is_numeric($res)) {
708 708
                 continue;
709 709
             }
710 710
             $result += (1 * $res);
@@ -741,19 +741,19 @@  discard block
 block discarded – undo
741 741
                 $path_size_info = $tmp_path;
742 742
             }
743 743
             if (empty($path_size_info)) {
744
-                $tmp_path = "/sys/block/" . substr($dev, 0, 3) . "/{$dev}/size";
744
+                $tmp_path = "/sys/block/".substr($dev, 0, 3)."/{$dev}/size";
745 745
                 if (file_exists($tmp_path)) {
746 746
                     $path_size_info = $tmp_path;
747 747
                 }
748 748
             }
749 749
 
750
-            if ( ! empty($path_size_info)) {
750
+            if (!empty($path_size_info)) {
751 751
                 $original_size = trim(file_get_contents($path_size_info));
752 752
                 $original_size = ($original_size * 512 / 1024 / 1024);
753 753
                 $mb_size       = $original_size;
754 754
             }
755 755
 
756
-            $tmp_dir = "/tmp/{$dev}_" . time();
756
+            $tmp_dir = "/tmp/{$dev}_".time();
757 757
             $out     = [];
758 758
 
759 759
             $fs           = null;
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         }
811 811
         Util::mwMkdir($dir);
812 812
 
813
-        if ( ! file_exists($dir)) {
813
+        if (!file_exists($dir)) {
814 814
             Util::sysLogMsg('Storage', "Unable mount $dev $format to $dir. Unable create dir.");
815 815
 
816 816
             return false;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
             Processes::mwExec("{$mountNtfs3gPath} /dev/{$dev} {$dir}", $out);
822 822
         } else {
823 823
             $storage   = new Storage();
824
-            $uid_part  = 'UUID=' . $storage->getUuid("/dev/{$dev}") . '';
824
+            $uid_part  = 'UUID='.$storage->getUuid("/dev/{$dev}").'';
825 825
             $mountPath = Util::which('mount');
826 826
             Processes::mwExec("{$mountPath} -t {$format} {$uid_part} {$dir}", $out);
827 827
         }
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
             unlink($storage_dev_file);
842 842
         }
843 843
 
844
-        if (file_exists($varEtcDir . '/cfdevice')) {
845
-            $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice'));
844
+        if (file_exists($varEtcDir.'/cfdevice')) {
845
+            $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice'));
846 846
         }
847 847
 
848 848
         $disks = $this->getDiskSettings();
@@ -856,18 +856,18 @@  discard block
 block discarded – undo
856 856
                 // Если это системный диск, то пытаемся подключить раздел 4.
857 857
                 $dev = "{$disk['device']}4";
858 858
             }
859
-            if ( ! $this->hddExists($dev)) {
859
+            if (!$this->hddExists($dev)) {
860 860
                 // Диск не существует.
861 861
                 continue;
862 862
             }
863
-            if ($disk['media'] === '1' || ! file_exists($storage_dev_file)) {
863
+            if ($disk['media'] === '1' || !file_exists($storage_dev_file)) {
864 864
                 file_put_contents($storage_dev_file, "/storage/usbdisk{$disk['id']}");
865 865
                 $this->updateConfigWithNewMountPoint("/storage/usbdisk{$disk['id']}");
866 866
             }
867 867
 
868
-            $str_uid     = 'UUID=' . $this->getUuid($dev) . '';
868
+            $str_uid     = 'UUID='.$this->getUuid($dev).'';
869 869
             $format_p4   = $this->getFsType($dev);
870
-            $conf        .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n";
870
+            $conf .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n";
871 871
             $mount_point = "/storage/usbdisk{$disk['id']}";
872 872
             Util::mwMkdir($mount_point);
873 873
         }
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
         Util::mwMkdir('/storage');
980 980
         $chmodPath = Util::which('chmod');
981 981
         Processes::mwExec("{$chmodPath} 755 /storage");
982
-        if ( ! file_exists($varEtcDir . '/cfdevice')) {
982
+        if (!file_exists($varEtcDir.'/cfdevice')) {
983 983
             return;
984 984
         }
985 985
         $fstab     = '';
986
-        $file_data = file_get_contents($varEtcDir . '/cfdevice');
986
+        $file_data = file_get_contents($varEtcDir.'/cfdevice');
987 987
         $cf_disk   = trim($file_data);
988 988
         if ('' == $cf_disk) {
989 989
             return;
@@ -993,9 +993,9 @@  discard block
 block discarded – undo
993 993
         $part3 = (strpos($cf_disk, 'mmcblk') !== false) ? "{$cf_disk}p3" : "{$cf_disk}3"; // Conf
994 994
 
995 995
 
996
-        $uid_part2 = 'UUID=' . $this->getUuid("/dev/{$part2}") . '';
996
+        $uid_part2 = 'UUID='.$this->getUuid("/dev/{$part2}").'';
997 997
         $format_p2 = $this->getFsType($part2);
998
-        $uid_part3 = 'UUID=' . $this->getUuid("/dev/{$part3}") . '';
998
+        $uid_part3 = 'UUID='.$this->getUuid("/dev/{$part3}").'';
999 999
         $format_p3 = $this->getFsType($part3);
1000 1000
 
1001 1001
         // $fstab .= "/dev/{$part1} /cf msdos ro 1 1\n"; // НЕ МОНТИРУЕМ!
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
             }
1041 1041
         }
1042 1042
 
1043
-        if ( ! empty($path)) {
1043
+        if (!empty($path)) {
1044 1044
             Util::mwMkdir($path);
1045 1045
         }
1046 1046
 
1047 1047
         $downloadCacheDir = appPath('sites/pbxcore/files/cache');
1048
-        if ( ! $isLiveCd) {
1048
+        if (!$isLiveCd) {
1049 1049
             Util::mwMkdir($downloadCacheDir);
1050 1050
             Util::createUpdateSymlink($this->config->path('www.downloadCacheDir'), $downloadCacheDir);
1051 1051
         }
@@ -1083,13 +1083,13 @@  discard block
 block discarded – undo
1083 1083
     public function createAssetsSymlinks(): void
1084 1084
     {
1085 1085
         $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache');
1086
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/js', $jsCacheDir);
1086
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/js', $jsCacheDir);
1087 1087
 
1088 1088
         $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache');
1089
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/css', $cssCacheDir);
1089
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/css', $cssCacheDir);
1090 1090
 
1091 1091
         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
1092
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/img', $imgCacheDir);
1092
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/img', $imgCacheDir);
1093 1093
     }
1094 1094
 
1095 1095
     /**
@@ -1102,13 +1102,13 @@  discard block
 block discarded – undo
1102 1102
         $cacheDirs[] = $this->config->path('www.downloadCacheDir');
1103 1103
         $cacheDirs[] = $this->config->path('www.managedCacheDir');
1104 1104
         $cacheDirs[] = $this->config->path('www.modelsCacheDir');
1105
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/js';
1106
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/css';
1107
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/img';
1105
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/js';
1106
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/css';
1107
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/img';
1108 1108
         $cacheDirs[] = $this->config->path('adminApplication.voltCacheDir');
1109 1109
         $rmPath      = Util::which('rm');
1110 1110
         foreach ($cacheDirs as $cacheDir) {
1111
-            if ( ! empty($cacheDir)) {
1111
+            if (!empty($cacheDir)) {
1112 1112
                 Processes::mwExec("{$rmPath} -rf {$cacheDir}/*");
1113 1113
             }
1114 1114
         }
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
         $countBlock = $swapSize * $bs;
1219 1219
         $ddCmd      = Util::which('dd');
1220 1220
 
1221
-        Util::sysLogMsg('Swap', 'make swap ' . $swapFile, LOG_INFO, LOG_INFO);
1221
+        Util::sysLogMsg('Swap', 'make swap '.$swapFile, LOG_INFO, LOG_INFO);
1222 1222
         Processes::mwExec("{$ddCmd} if=/dev/zero of={$swapFile} bs={$bs} count={$countBlock}");
1223 1223
 
1224 1224
         $mkSwapCmd = Util::which('mkswap');
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
         $swapOnCmd = Util::which('swapon');
1228 1228
         $result    = Processes::mwExec("{$swapOnCmd} {$swapFile}");
1229
-        Util::sysLogMsg('Swap', 'connect swap result: ' . $result, LOG_INFO, LOG_INFO);
1229
+        Util::sysLogMsg('Swap', 'connect swap result: '.$result, LOG_INFO, LOG_INFO);
1230 1230
     }
1231 1231
 
1232 1232
     /**
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
         $size    = 0;
1240 1240
         $mntDir  = '';
1241 1241
         $mounted = self::isStorageDiskMounted('', $mntDir);
1242
-        if ( ! $mounted) {
1242
+        if (!$mounted) {
1243 1243
             return 0;
1244 1244
         }
1245 1245
         $hd = $this->getAllHdd(true);
@@ -1260,12 +1260,12 @@  discard block
 block discarded – undo
1260 1260
      */
1261 1261
     public function saveDiskSettings($data, $id = '1'): void
1262 1262
     {
1263
-        if ( ! is_array($data)) {
1263
+        if (!is_array($data)) {
1264 1264
             return;
1265 1265
         }
1266 1266
         $disk_data = $this->getDiskSettings($id);
1267 1267
         if (count($disk_data) === 0) {
1268
-            $uniqid           = strtoupper('STORAGE-DISK-' . md5(time()));
1268
+            $uniqid           = strtoupper('STORAGE-DISK-'.md5(time()));
1269 1269
             $storage_settings = new StorageModel();
1270 1270
             foreach ($data as $key => $val) {
1271 1271
                 $storage_settings->writeAttribute($key, $val);
Please login to merge, or discard this patch.
src/Core/System/Util.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             }
48 48
             if (is_array($value)) {
49 49
                 array_unshift($value, ' ');
50
-                $result_config .= trim(implode("\n{$key} = ", $value)) . "\n";
50
+                $result_config .= trim(implode("\n{$key} = ", $value))."\n";
51 51
             } else {
52 52
                 $result_config .= "{$key} = {$value}\n";
53 53
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public static function amiOriginate($peer_number, $peer_mobile, $dest_number): array
70 70
     {
71 71
         $am       = self::getAstManager('off');
72
-        $channel  = 'Local/' . $peer_number . '@internal-originate';
72
+        $channel  = 'Local/'.$peer_number.'@internal-originate';
73 73
         $context  = 'all_peers';
74 74
         $IS_ORGNT = self::generateRandomString();
75 75
         $variable = "_IS_ORGNT={$IS_ORGNT},pt1c_cid={$dest_number},_extenfrom1c={$peer_number},__peer_mobile={$peer_mobile},_FROM_PEER={$peer_number}";
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
     public static function trimExtensionForFile($filename, $delimiter = '.'): string
337 337
     {
338 338
         // Отсечем расширение файла.
339
-        $tmp_arr = explode((string)$delimiter, $filename);
339
+        $tmp_arr = explode((string) $delimiter, $filename);
340 340
         if (count($tmp_arr) > 1) {
341 341
             unset($tmp_arr[count($tmp_arr) - 1]);
342
-            $filename = implode((string)$delimiter, $tmp_arr);
342
+            $filename = implode((string) $delimiter, $tmp_arr);
343 343
         }
344 344
 
345 345
         return $filename;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      */
419 419
     public static function mwExec($command, &$outArr = null, &$retVal = null): int
420 420
     {
421
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
421
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
422 422
 
423 423
         return Processes::mwExec($command, $outArr, $retVal);
424 424
     }
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
             $objects = scandir($dir);
464 464
             foreach ($objects as $object) {
465 465
                 if ($object != "." && $object != "..") {
466
-                    if (filetype($dir . "/" . $object) == "dir") {
467
-                        self::rRmDir($dir . "/" . $object);
466
+                    if (filetype($dir."/".$object) == "dir") {
467
+                        self::rRmDir($dir."/".$object);
468 468
                     } else {
469
-                        unlink($dir . "/" . $object);
469
+                        unlink($dir."/".$object);
470 470
                     }
471 471
                 }
472 472
             }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     public static function generateSslCert($options = null, $config_args_pkey = null, $config_args_csr = null): array
490 490
     {
491 491
         // Инициализация настроек.
492
-        if ( ! $options) {
492
+        if (!$options) {
493 493
             $options = [
494 494
                 "countryName"            => 'RU',
495 495
                 "stateOrProvinceName"    => 'Moscow',
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
             ];
502 502
         }
503 503
 
504
-        if ( ! $config_args_csr) {
504
+        if (!$config_args_csr) {
505 505
             $config_args_csr = ['digest_alg' => 'sha256'];
506 506
         }
507 507
 
508
-        if ( ! $config_args_pkey) {
508
+        if (!$config_args_pkey) {
509 509
             $config_args_pkey = [
510 510
                 "private_key_bits" => 2048,
511 511
                 "private_key_type" => OPENSSL_KEYTYPE_RSA,
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
             $arrPaths = explode(' ', $parameters);
594 594
             if (count($arrPaths) > 0) {
595 595
                 foreach ($arrPaths as $path) {
596
-                    if ( ! empty($path)
597
-                        && ! file_exists($path)
598
-                        && ! mkdir($path, 0755, true)
599
-                        && ! is_dir($path)) {
596
+                    if (!empty($path)
597
+                        && !file_exists($path)
598
+                        && !mkdir($path, 0755, true)
599
+                        && !is_dir($path)) {
600 600
                         $result = false;
601
-                        self::sysLogMsg('Util', 'Error on create folder ' . $path);
601
+                        self::sysLogMsg('Util', 'Error on create folder '.$path);
602 602
                     }
603 603
                     if ($addWWWRights) {
604 604
                         self::addRegularWWWRights($path);
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
             $row = trim($row);
673 673
             $pos = strpos($row, ']');
674 674
             if ($pos !== false && strpos($row, '[') === 0) {
675
-                $row = "\n" . substr($row, 0, $pos);
675
+                $row = "\n".substr($row, 0, $pos);
676 676
             }
677 677
         }
678 678
         unset($row);
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
         foreach ($sections as $section) {
685 685
             $data_rows    = explode("\n", trim($section));
686 686
             $section_name = trim($data_rows[0] ?? '');
687
-            if ( ! empty($section_name)) {
687
+            if (!empty($section_name)) {
688 688
                 unset($data_rows[0]);
689 689
                 $manual_data[$section_name] = [];
690 690
                 foreach ($data_rows as $row) {
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
             $reflection = new ReflectionClass($className);
745 745
             $filename   = $reflection->getFileName();
746 746
         } catch (ReflectionException $exception) {
747
-            self::sysLogMsg('Util', 'Error ' . $exception->getMessage());
747
+            self::sysLogMsg('Util', 'Error '.$exception->getMessage());
748 748
         }
749 749
 
750 750
         return $filename;
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
      */
762 762
     public static function getPidOfProcess($name, $exclude = ''): string
763 763
     {
764
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
764
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
765 765
 
766 766
         return Processes::getPidOfProcess($name, $exclude);
767 767
     }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
      */
782 782
     public static function processWorker($cmd, $param, $proc_name, $action, $out_file = '/dev/null')
783 783
     {
784
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
784
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
785 785
 
786 786
         return Processes::processWorker($cmd, $param, $proc_name, $action, $out_file);
787 787
     }
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         string $param = 'start',
800 800
         string $action = 'restart'
801 801
     ): void {
802
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
802
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
803 803
         Processes::processPHPWorker($className, $param, $action);
804 804
     }
805 805
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
      */
814 814
     public static function killByName($procName): ?int
815 815
     {
816
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
816
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
817 817
 
818 818
         return Processes::killByName($procName);
819 819
     }
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
      */
829 829
     public static function mwExecBg($command, $out_file = '/dev/null', $sleep_time = 0): void
830 830
     {
831
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
831
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
832 832
         Processes::mwExecBg($command, $out_file, $sleep_time);
833 833
     }
834 834
 
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
      */
843 843
     public static function mwExecBgWithTimeout($command, $timeout = 4, $logname = '/dev/null'): void
844 844
     {
845
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
845
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
846 846
         Processes::mwExecBgWithTimeout($command, $timeout, $logname);
847 847
     }
848 848
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
      */
857 857
     public static function mwExecCommands($arr_cmds, &$out = [], $logname = ''): void
858 858
     {
859
-        self::sysLogMsg('Util', 'Deprecated call ' . __METHOD__ . ' from ' . static::class);
859
+        self::sysLogMsg('Util', 'Deprecated call '.__METHOD__.' from '.static::class);
860 860
         Processes::mwExecCommands($arr_cmds, $out, $logname);
861 861
     }
862 862
 
Please login to merge, or discard this patch.