Passed
Pull Request — master (#17)
by Nikolay
05:45
created
src/Core/Workers/WorkerBase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $activeProcesses = Util::getPidOfProcess(static::class, getmypid());
38 38
         if ($this->maxProc === 1) {
39
-            if ( ! empty($activeProcesses)) {
39
+            if (!empty($activeProcesses)) {
40 40
                 $killApp = Util::which('kill');
41 41
                 // Завершаем старый процесс.
42 42
                 Util::mwExec("{$killApp} {$activeProcesses}");
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             // Запустим нехдостающие процессы
49 49
             $countProc = count($processes);
50 50
             while ($countProc < $this->maxProc) {
51
-                Util::processPHPWorker(static::class,'start','multiStart');
51
+                Util::processPHPWorker(static::class, 'start', 'multiStart');
52 52
                 $countProc++;
53 53
             }
54 54
             // Получим количество лишних процессов.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $killApp   = Util::which('kill');
57 57
             // Завершим лишние
58 58
             while ($countProc >= 0) {
59
-                if ( ! isset($processes[$countProc])) {
59
+                if (!isset($processes[$countProc])) {
60 60
                     break;
61 61
                 }
62 62
                 // Завершаем старый процесс.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function pingCallBack(BeanstalkClient $message): void
93 93
     {
94
-        $message->reply(json_encode($message->getBody() . ':pong'));
94
+        $message->reply(json_encode($message->getBody().':pong'));
95 95
     }
96 96
 
97 97
     /**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
     {
106 106
         $pingTube = $this->makePingTubeName(static::class);
107 107
         if ($pingTube === $parameters['UserEvent']) {
108
-            $this->am->UserEvent("{$pingTube}Pong", []);
108
+            $this->am->UserEvent("{$pingTube}pong", []);
109 109
 
110 110
             return true;
111 111
         }
Please login to merge, or discard this patch.
src/Core/System/Storage.php 2 patches
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
             Util::mwExec("{$umountPath} {$device}");
102 102
         }
103 103
 
104
-        if ( ! self::isStorageDiskMounted($device)) {
104
+        if (!self::isStorageDiskMounted($device)) {
105 105
             Util::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
         Util::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
             Util::mwExec("/sbin/shell_functions.sh 'killprocesses' '$dir' -TERM 0");
342 342
             Util::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
             Util::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
             Util::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
                 Util::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
         Util::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
             Util::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
             Util::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
         Util::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
                 Util::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
         Util::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    = Util::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.
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
                 Util::processPHPWorker(WorkerRemoveOldRecords::class);
475 475
             }
476 476
 
Please login to merge, or discard this patch.
src/Core/System/BeanstalkClient.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function __construct($tube = 'default', $port = '')
39 39
     {
40
-        $this->tube        = str_replace("\\", '-', $tube);;
40
+        $this->tube        = str_replace("\\", '-', $tube); ;
41 41
         $this->job_options = ['priority' => 250, 'delay' => 0, 'ttr' => 3600];
42 42
         $this->port = $port;
43 43
         $this->reconnect();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $config = $this->di->get('config')->beanstalk;
52 52
         $port   = $config->port;
53
-        if(!empty($this->port) && is_numeric($this->port)){
53
+        if (!empty($this->port) && is_numeric($this->port)) {
54 54
             $port = $this->port;
55 55
         }
56 56
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $tube = str_replace("\\", '-', $tube);
130 130
         // Change tube
131
-        if ( ! empty($tube) && $this->tube !== $tube) {
131
+        if (!empty($tube) && $this->tube !== $tube) {
132 132
             $this->queue->useTube($tube);
133 133
         }
134 134
         $job_data = serialize($job_data);
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         // Processing job over callable function attached in $this->subscribe
183
-        if(json_decode($job->getData(), true) !==null){
184
-            $mData =  $job->getData();
185
-        }else{
183
+        if (json_decode($job->getData(), true) !== null) {
184
+            $mData = $job->getData();
185
+        } else {
186 186
             $mData = unserialize($job->getData(), [false]);
187 187
         }
188 188
         $this->message = $mData;
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
     /**
263 263
      * Drops orphaned tasks
264 264
      */
265
-    public function cleanTube(){
265
+    public function cleanTube() {
266 266
         $tubes = $this->queue->listTubes();
267
-        foreach ($tubes as $tube){
268
-            if(strpos($tube, "INBOX_") !== 0){
267
+        foreach ($tubes as $tube) {
268
+            if (strpos($tube, "INBOX_") !== 0) {
269 269
                 continue;
270 270
             }
271 271
             try {
272 272
                 $statData = $this->queue->statsTube($tube)->getArrayCopy();
273 273
                 $watching = $statData['current-watching'];
274
-                if($watching !== '0'){
274
+                if ($watching !== '0') {
275 275
                     continue;
276 276
                 }
277 277
                 // Нужно удалить все Jobs.
278 278
                 $this->queue->watch($tube);
279
-                while (true){
279
+                while (true) {
280 280
                     $job = $this->queue->reserveWithTimeout(1);
281
-                    if($job === null){
281
+                    if ($job === null) {
282 282
                         break;
283 283
                     }
284 284
                     $this->queue->delete($job);
285 285
                 }
286
-            }catch (\Exception $e){
286
+            } catch (\Exception $e) {
287 287
                 continue;
288 288
             }
289 289
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
         $job_data,
85 85
         int $timeout = 10,
86 86
         int $priority = PheanstalkInterface::DEFAULT_PRIORITY
87
-    )
88
-    {
87
+    ) {
89 88
         $this->message = false;
90 89
         $inbox_tube    = uniqid('INBOX_', true);
91 90
         $this->queue->watch($inbox_tube);
@@ -186,7 +185,7 @@  discard block
 block discarded – undo
186 185
         // Processing job over callable function attached in $this->subscribe
187 186
         if(json_decode($job->getData(), true) !==null){
188 187
             $mData =  $job->getData();
189
-        }else{
188
+        } else{
190 189
             $mData = unserialize($job->getData(), [false]);
191 190
         }
192 191
         $this->message = $mData;
@@ -266,7 +265,8 @@  discard block
 block discarded – undo
266 265
     /**
267 266
      * Drops orphaned tasks
268 267
      */
269
-    public function cleanTube(){
268
+    public function cleanTube()
269
+    {
270 270
         $tubes = $this->queue->listTubes();
271 271
         foreach ($tubes as $tube){
272 272
             if(strpos($tube, "INBOX_") !== 0){
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                     }
288 288
                     $this->queue->delete($job);
289 289
                 }
290
-            }catch (\Exception $e){
290
+            } catch (\Exception $e){
291 291
                 continue;
292 292
             }
293 293
 
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/NetworkController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $internetInterface = LanInterfaces::findFirstByInternet('1');
38 38
         if ($internetInterface === null) {
39 39
             $internetInterface = new LanInterfaces();
40
-            $internetInterface->id     = 1;
40
+            $internetInterface->id = 1;
41 41
         }
42 42
 
43 43
         // We will find additional interfaces which we can delete
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function saveAction(): void
62 62
     {
63
-        if ( ! $this->request->isPost()) {
63
+        if (!$this->request->isPost()) {
64 64
             return;
65 65
         }
66 66
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
                 case 'extipaddr':
126 126
                     if ($itIsInternetInterfce) {
127 127
                         if (array_key_exists($name, $data)) {
128
-                            $eth->$name = ($data['usenat'] === 'on') ? $data[$name] : $data['ipaddr_' . $eth->id];
128
+                            $eth->$name = ($data['usenat'] === 'on') ? $data[$name] : $data['ipaddr_'.$eth->id];
129 129
                         } else {
130
-                            $eth->$name = $data['ipaddr_' . $eth->id];
130
+                            $eth->$name = $data['ipaddr_'.$eth->id];
131 131
                         }
132 132
                     } else {
133 133
                         $eth->$name = '';
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
                     }
147 147
                     break;
148 148
                 case 'dhcp':
149
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
150
-                        $eth->$name = ($data['dhcp_' . $eth->id]) === 'on' ? '1' : '0';
149
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
150
+                        $eth->$name = ($data['dhcp_'.$eth->id]) === 'on' ? '1' : '0';
151 151
                     }
152 152
                     break;
153 153
                 case 'internet':
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
                 case 'ipaddr':
157 157
                 case 'subnet':
158 158
                     $eth->$name = '';
159
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
160
-                        $eth->$name = ($data['dhcp_' . $eth->id]) === 'on' ? '' : $data[$name . '_' . $eth->id];
159
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
160
+                        $eth->$name = ($data['dhcp_'.$eth->id]) === 'on' ? '' : $data[$name.'_'.$eth->id];
161 161
                     }
162 162
                     break;
163 163
                 case 'interface':
164 164
                     if ($eth->id === 0) {
165
-                        $eth->$name = LanInterfaces::findFirstById($data[$name . '_' . $eth->id])->interface;
165
+                        $eth->$name = LanInterfaces::findFirstById($data[$name.'_'.$eth->id])->interface;
166 166
                     }
167 167
                     break;
168 168
                 case 'domain':
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
                     }
178 178
                     break;
179 179
                 default:
180
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
181
-                        $eth->$name = $data[$name . '_' . $eth->id];
180
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
181
+                        $eth->$name = $data[$name.'_'.$eth->id];
182 182
                     }
183 183
             }
184 184
         }
Please login to merge, or discard this patch.