@@ -38,7 +38,7 @@ discard block |
||
| 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 |
||
| 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() |
@@ -38,7 +38,8 @@ |
||
| 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 | |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | $client = new BeanstalkClient(self::class); |
| 35 | 35 | |
| 36 | 36 | $arrayOfClearedModels = $client->getMessagesFromTube(); |
| 37 | - foreach ($arrayOfClearedModels as $clearedModel){ |
|
| 38 | - if (class_exists($clearedModel)){ |
|
| 37 | + foreach ($arrayOfClearedModels as $clearedModel) { |
|
| 38 | + if (class_exists($clearedModel)) { |
|
| 39 | 39 | call_user_func([$clearedModel, 'clearCache'], $clearedModel); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -1100,13 +1100,13 @@ discard block |
||
| 1100 | 1100 | $cacheDirs = []; |
| 1101 | 1101 | $cacheDirs[] = $this->config->path('www.uploadDir'); |
| 1102 | 1102 | $cacheDirs[] = $this->config->path('www.downloadCacheDir'); |
| 1103 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/js'; |
|
| 1104 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/css'; |
|
| 1105 | - $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/img'; |
|
| 1103 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/js'; |
|
| 1104 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/css'; |
|
| 1105 | + $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/img'; |
|
| 1106 | 1106 | $cacheDirs[] = $this->config->path('adminApplication.voltCacheDir'); |
| 1107 | 1107 | $rmPath = Util::which('rm'); |
| 1108 | 1108 | foreach ($cacheDirs as $cacheDir) { |
| 1109 | - if ( ! empty($cacheDir)) { |
|
| 1109 | + if (!empty($cacheDir)) { |
|
| 1110 | 1110 | Util::mwExec("{$rmPath} -rf {$cacheDir}/*"); |
| 1111 | 1111 | } |
| 1112 | 1112 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | $countBlock = $swapSize * $bs; |
| 1217 | 1217 | $ddCmd = Util::which('dd'); |
| 1218 | 1218 | |
| 1219 | - Util::sysLogMsg('Swap', 'make swap ' . $swapFile, LOG_INFO, LOG_INFO); |
|
| 1219 | + Util::sysLogMsg('Swap', 'make swap '.$swapFile, LOG_INFO, LOG_INFO); |
|
| 1220 | 1220 | Util::mwExec("{$ddCmd} if=/dev/zero of={$swapFile} bs={$bs} count={$countBlock}"); |
| 1221 | 1221 | |
| 1222 | 1222 | $mkSwapCmd = Util::which('mkswap'); |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | |
| 1225 | 1225 | $swapOnCmd = Util::which('swapon'); |
| 1226 | 1226 | $result = Util::mwExec("{$swapOnCmd} {$swapFile}"); |
| 1227 | - Util::sysLogMsg('Swap', 'connect swap result: ' . $result, LOG_INFO, LOG_INFO); |
|
| 1227 | + Util::sysLogMsg('Swap', 'connect swap result: '.$result, LOG_INFO, LOG_INFO); |
|
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | /** |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | $size = 0; |
| 1238 | 1238 | $mntDir = ''; |
| 1239 | 1239 | $mounted = self::isStorageDiskMounted('', $mntDir); |
| 1240 | - if ( ! $mounted) { |
|
| 1240 | + if (!$mounted) { |
|
| 1241 | 1241 | return 0; |
| 1242 | 1242 | } |
| 1243 | 1243 | $hd = $this->getAllHdd(true); |
@@ -1258,12 +1258,12 @@ discard block |
||
| 1258 | 1258 | */ |
| 1259 | 1259 | public function saveDiskSettings($data, $id = '1'): void |
| 1260 | 1260 | { |
| 1261 | - if ( ! is_array($data)) { |
|
| 1261 | + if (!is_array($data)) { |
|
| 1262 | 1262 | return; |
| 1263 | 1263 | } |
| 1264 | 1264 | $disk_data = $this->getDiskSettings($id); |
| 1265 | 1265 | if (count($disk_data) === 0) { |
| 1266 | - $uniqid = strtoupper('STORAGE-DISK-' . md5(time())); |
|
| 1266 | + $uniqid = strtoupper('STORAGE-DISK-'.md5(time())); |
|
| 1267 | 1267 | $storage_settings = new StorageModel(); |
| 1268 | 1268 | foreach ($data as $key => $val) { |
| 1269 | 1269 | $storage_settings->writeAttribute($key, $val); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $config = $this->di->get('config')->beanstalk; |
| 51 | 51 | $port = $config->port; |
| 52 | - if ( ! empty($this->port) && is_numeric($this->port)) { |
|
| 52 | + if (!empty($this->port) && is_numeric($this->port)) { |
|
| 53 | 53 | $port = $this->port; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->queue->delete($job); |
| 104 | 104 | } |
| 105 | 105 | } catch (Throwable $exception) { |
| 106 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 106 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 107 | 107 | if ($job !== null) { |
| 108 | 108 | $this->queue->bury($job); |
| 109 | 109 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ): Job { |
| 136 | 136 | $tube = str_replace("\\", '-', $tube); |
| 137 | 137 | // Change tube |
| 138 | - if ( ! empty($tube) && $this->tube !== $tube) { |
|
| 138 | + if (!empty($tube) && $this->tube !== $tube) { |
|
| 139 | 139 | $this->queue->useTube($tube); |
| 140 | 140 | } |
| 141 | 141 | $job_data = serialize($job_data); |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | while ($job = $this->queue->peekReady()) { |
| 169 | 169 | $jobStats = $this->queue->statsJob($job); |
| 170 | 170 | if ( |
| 171 | - ! property_exists($jobStats, 'age') |
|
| 172 | - || ! property_exists($jobStats, 'ttr') |
|
| 171 | + !property_exists($jobStats, 'age') |
|
| 172 | + || !property_exists($jobStats, 'ttr') |
|
| 173 | 173 | ) { |
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | - $age = (int)($jobStats->age); |
|
| 177 | - $expectedTimeToExecute = ((int)($jobStats->ttr)) * 2; |
|
| 176 | + $age = (int) ($jobStats->age); |
|
| 177 | + $expectedTimeToExecute = ((int) ($jobStats->ttr)) * 2; |
|
| 178 | 178 | if ($age > $expectedTimeToExecute) { |
| 179 | 179 | $id = $job->getId(); |
| 180 | 180 | $this->queue->delete($job); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | } catch (Throwable $exception) { |
| 185 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 185 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | try { |
| 216 | 216 | $job = $this->queue->reserveWithTimeout($timeout); |
| 217 | 217 | } catch (Throwable $exception) { |
| 218 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 218 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if ($job === null) { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | } |
| 48 | 48 | $di->setShared( |
| 49 | 49 | self::SERVICE_NAME, |
| 50 | - function () use ($prefix) { |
|
| 50 | + function() use ($prefix) { |
|
| 51 | 51 | $serializerFactory = new SerializerFactory(); |
| 52 | 52 | $adapterFactory = new AdapterFactory($serializerFactory); |
| 53 | 53 | |
@@ -47,7 +47,8 @@ |
||
| 47 | 47 | } |
| 48 | 48 | $di->setShared( |
| 49 | 49 | self::SERVICE_NAME, |
| 50 | - function () use ($prefix) { |
|
| 50 | + function () use ($prefix) |
|
| 51 | + { |
|
| 51 | 52 | $serializerFactory = new SerializerFactory(); |
| 52 | 53 | $adapterFactory = new AdapterFactory($serializerFactory); |
| 53 | 54 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | } |
| 47 | 47 | $di->setShared( |
| 48 | 48 | self::SERVICE_NAME, |
| 49 | - function () use ($prefix){ |
|
| 49 | + function() use ($prefix){ |
|
| 50 | 50 | $serializerFactory = new SerializerFactory(); |
| 51 | 51 | $adapterFactory = new AdapterFactory($serializerFactory); |
| 52 | 52 | |
@@ -46,7 +46,8 @@ |
||
| 46 | 46 | } |
| 47 | 47 | $di->setShared( |
| 48 | 48 | self::SERVICE_NAME, |
| 49 | - function () use ($prefix){ |
|
| 49 | + function () use ($prefix) |
|
| 50 | + { |
|
| 50 | 51 | $serializerFactory = new SerializerFactory(); |
| 51 | 52 | $adapterFactory = new AdapterFactory($serializerFactory); |
| 52 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $moduleDir = PbxExtensionUtils::getModuleDir($module['uniqid']); |
| 71 | 71 | |
| 72 | 72 | $moduleJson = "{$moduleDir}/module.json"; |
| 73 | - if ( ! file_exists($moduleJson)) { |
|
| 73 | + if (!file_exists($moduleJson)) { |
|
| 74 | 74 | continue; |
| 75 | 75 | } |
| 76 | 76 | $jsonString = file_get_contents($moduleJson); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $moduleModelsDir = "{$moduleDir}/Models"; |
| 84 | - $results = glob($moduleModelsDir . '/*.php', GLOB_NOSORT); |
|
| 84 | + $results = glob($moduleModelsDir.'/*.php', GLOB_NOSORT); |
|
| 85 | 85 | foreach ($results as $file) { |
| 86 | 86 | $className = pathinfo($file)['filename']; |
| 87 | 87 | $moduleModelClass = "\\Modules\\{$module['uniqid']}\\Models\\{$className}"; |
@@ -116,16 +116,16 @@ discard block |
||
| 116 | 116 | $newErrorMessage = $this->t('ConstraintViolation'); |
| 117 | 117 | $newErrorMessage .= "<ul class='list'>"; |
| 118 | 118 | if ($relatedRecords === false) { |
| 119 | - throw new Model\Exception('Error on models relationship ' . $errorMessage); |
|
| 119 | + throw new Model\Exception('Error on models relationship '.$errorMessage); |
|
| 120 | 120 | } |
| 121 | 121 | if ($relatedRecords instanceof Resultset) { |
| 122 | 122 | foreach ($relatedRecords as $item) { |
| 123 | 123 | if ($item instanceof ModelsBase) { |
| 124 | - $newErrorMessage .= '<li>' . $item->getRepresent(true) . '</li>'; |
|
| 124 | + $newErrorMessage .= '<li>'.$item->getRepresent(true).'</li>'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } elseif ($relatedRecords instanceof ModelsBase) { |
| 128 | - $newErrorMessage .= '<li>' . $relatedRecords->getRepresent(true) . '</li>'; |
|
| 128 | + $newErrorMessage .= '<li>'.$relatedRecords->getRepresent(true).'</li>'; |
|
| 129 | 129 | } else { |
| 130 | 130 | $newErrorMessage .= '<li>Unknown object</li>'; |
| 131 | 131 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if (empty($this->id)) { |
| 177 | 177 | $name .= $this->t('mo_NewElementCallQueues'); |
| 178 | 178 | } else { |
| 179 | - $name .= $this->t('mo_CallQueueShort4Dropdown') . ': ' . $this->name; |
|
| 179 | + $name .= $this->t('mo_CallQueueShort4Dropdown').': '.$this->name; |
|
| 180 | 180 | } |
| 181 | 181 | break; |
| 182 | 182 | case ConferenceRooms::class: |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if (empty($this->id)) { |
| 185 | 185 | $name .= $this->t('mo_NewElementConferenceRooms'); |
| 186 | 186 | } else { |
| 187 | - $name .= $this->t('mo_ConferenceRoomsShort4Dropdown') . ': ' . $this->name; |
|
| 187 | + $name .= $this->t('mo_ConferenceRoomsShort4Dropdown').': '.$this->name; |
|
| 188 | 188 | } |
| 189 | 189 | break; |
| 190 | 190 | case CustomFiles::class: |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if (empty($this->id)) { |
| 196 | 196 | $name .= $this->t('mo_NewElementDialplanApplications'); |
| 197 | 197 | } else { |
| 198 | - $name .= $this->t('mo_ApplicationShort4Dropdown') . ': ' . $this->name; |
|
| 198 | + $name .= $this->t('mo_ApplicationShort4Dropdown').': '.$this->name; |
|
| 199 | 199 | } |
| 200 | 200 | break; |
| 201 | 201 | case ExtensionForwardingRights::class: |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if (empty($this->id)) { |
| 258 | 258 | $name .= $this->t('mo_NewElementIax'); |
| 259 | 259 | } elseif ($this->disabled === '1') { |
| 260 | - $name .= "{$this->description} ({$this->t( 'mo_Disabled' )})"; |
|
| 260 | + $name .= "{$this->description} ({$this->t('mo_Disabled')})"; |
|
| 261 | 261 | } else { |
| 262 | 262 | $name .= $this->description; |
| 263 | 263 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | if (empty($this->id)) { |
| 268 | 268 | $name .= $this->t('mo_NewElementIvrMenu'); |
| 269 | 269 | } else { |
| 270 | - $name .= $this->t('mo_IVRMenuShort4Dropdown') . ': ' . $this->name; |
|
| 270 | + $name .= $this->t('mo_IVRMenuShort4Dropdown').': '.$this->name; |
|
| 271 | 271 | } |
| 272 | 272 | break; |
| 273 | 273 | case IvrMenuActions::class: |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $name = '<i class="map signs icon"></i> '; |
| 281 | 281 | if (empty($this->id)) { |
| 282 | 282 | $name .= $this->t('mo_NewElementIncomingRoutingTable'); |
| 283 | - } elseif ( ! empty($this->note)) { |
|
| 283 | + } elseif (!empty($this->note)) { |
|
| 284 | 284 | $name .= $this->t('repIncomingRoutingTable', ['represent' => $this->note]); |
| 285 | 285 | } else { |
| 286 | 286 | $name .= $this->t('repIncomingRoutingTableNumber', ['represent' => $this->id]); |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | if (empty($this->id)) { |
| 296 | 296 | $name .= $this->t('mo_NewElementNetworkFilters'); |
| 297 | 297 | } else { |
| 298 | - $name .= $this->description . '(' |
|
| 299 | - . $this->t('fw_PermitNetwork') . ': ' . $this->permit |
|
| 298 | + $name .= $this->description.'(' |
|
| 299 | + . $this->t('fw_PermitNetwork').': '.$this->permit |
|
| 300 | 300 | . ')'; |
| 301 | 301 | } |
| 302 | 302 | break; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $name = '<i class="random icon"></i> '; |
| 305 | 305 | if (empty($this->id)) { |
| 306 | 306 | $name .= $this->t('mo_NewElementOutgoingRoutingTable'); |
| 307 | - } elseif ( ! empty($this->rulename)) { |
|
| 307 | + } elseif (!empty($this->rulename)) { |
|
| 308 | 308 | $name .= $this->t('repOutgoingRoutingTable', ['represent' => $this->rulename]); |
| 309 | 309 | } else { |
| 310 | 310 | $name .= $this->t('repOutgoingRoutingTableNumber', ['represent' => $this->id]); |
@@ -314,24 +314,24 @@ discard block |
||
| 314 | 314 | $name = '<i class="time icon"></i> '; |
| 315 | 315 | if (empty($this->id)) { |
| 316 | 316 | $name .= $this->t('mo_NewElementOutWorkTimes'); |
| 317 | - } elseif ( ! empty($this->description)) { |
|
| 317 | + } elseif (!empty($this->description)) { |
|
| 318 | 318 | $name .= $this->t('repOutWorkTimes', ['represent' => $this->description]); |
| 319 | 319 | } else { |
| 320 | 320 | $represent = ''; |
| 321 | 321 | if (is_numeric($this->date_from)) { |
| 322 | - $represent .= date("d/m/Y", $this->date_from) . '-'; |
|
| 322 | + $represent .= date("d/m/Y", $this->date_from).'-'; |
|
| 323 | 323 | } |
| 324 | 324 | if (is_numeric($this->date_to)) { |
| 325 | - $represent .= date("d/m/Y", $this->date_to) . ' '; |
|
| 325 | + $represent .= date("d/m/Y", $this->date_to).' '; |
|
| 326 | 326 | } |
| 327 | 327 | if (isset($this->weekday_from)) { |
| 328 | - $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_from} days"))) . '-'; |
|
| 328 | + $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_from} days"))).'-'; |
|
| 329 | 329 | } |
| 330 | 330 | if (isset($this->weekday_to)) { |
| 331 | - $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_to} days"))) . ' '; |
|
| 331 | + $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_to} days"))).' '; |
|
| 332 | 332 | } |
| 333 | 333 | if (isset($this->time_from) || isset($this->time_to)) { |
| 334 | - $represent .= $this->time_from . ' - ' . $this->time_to . ' '; |
|
| 334 | + $represent .= $this->time_from.' - '.$this->time_to.' '; |
|
| 335 | 335 | } |
| 336 | 336 | $name .= $this->t('repOutWorkTimes', ['represent' => $represent]); |
| 337 | 337 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | break; |
| 349 | 349 | case PbxExtensionModules::class: |
| 350 | 350 | $name = '<i class="puzzle piece icon"></i> ' |
| 351 | - . $this->t('mo_ModuleShort4Dropdown') . ': ' |
|
| 351 | + . $this->t('mo_ModuleShort4Dropdown').': ' |
|
| 352 | 352 | . $this->name; |
| 353 | 353 | break; |
| 354 | 354 | case Sip::class: |
@@ -356,14 +356,14 @@ discard block |
||
| 356 | 356 | if (empty($this->id)) { |
| 357 | 357 | $name .= $this->t('mo_NewElementSip'); |
| 358 | 358 | } elseif ($this->disabled === '1') { |
| 359 | - $name .= "{$this->description} ({$this->t( 'mo_Disabled' )})"; |
|
| 359 | + $name .= "{$this->description} ({$this->t('mo_Disabled')})"; |
|
| 360 | 360 | } else { |
| 361 | 361 | $name .= $this->description; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | break; |
| 365 | 365 | case Users::class: |
| 366 | - $name = '<i class="user outline icon"></i> ' . $this->username; |
|
| 366 | + $name = '<i class="user outline icon"></i> '.$this->username; |
|
| 367 | 367 | break; |
| 368 | 368 | case SoundFiles::class: |
| 369 | 369 | $name = '<i class="file audio outline icon"></i> '; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $link = $this->getWebInterfaceLink(); |
| 383 | 383 | $category = explode('\\', static::class)[3]; |
| 384 | 384 | $result = $this->t( |
| 385 | - 'rep' . $category, |
|
| 385 | + 'rep'.$category, |
|
| 386 | 386 | [ |
| 387 | 387 | 'represent' => "<a href='{$link}'>{$name}</a>", |
| 388 | 388 | ] |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | if (strlen($s) > $max_length) { |
| 409 | 409 | $offset = ($max_length - 3) - strlen($s); |
| 410 | - $s = substr($s, 0, strrpos($s, ' ', $offset)) . '...'; |
|
| 410 | + $s = substr($s, 0, strrpos($s, ' ', $offset)).'...'; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | return $s; |
@@ -426,80 +426,80 @@ discard block |
||
| 426 | 426 | $link = '#'; |
| 427 | 427 | switch (static::class) { |
| 428 | 428 | case AsteriskManagerUsers::class: |
| 429 | - $link = $url->get('asterisk-managers/modify/' . $this->id, null, null, $baseUri); |
|
| 429 | + $link = $url->get('asterisk-managers/modify/'.$this->id, null, null, $baseUri); |
|
| 430 | 430 | break; |
| 431 | 431 | case CallQueueMembers::class: |
| 432 | - $link = $url->get('call-queues/modify/' . $this->CallQueues->uniqid, null, null, $baseUri); |
|
| 432 | + $link = $url->get('call-queues/modify/'.$this->CallQueues->uniqid, null, null, $baseUri); |
|
| 433 | 433 | break; |
| 434 | 434 | case CallQueues::class: |
| 435 | - $link = $url->get('call-queues/modify/' . $this->uniqid, null, null, $baseUri); |
|
| 435 | + $link = $url->get('call-queues/modify/'.$this->uniqid, null, null, $baseUri); |
|
| 436 | 436 | break; |
| 437 | 437 | case ConferenceRooms::class: |
| 438 | - $link = $url->get('conference-rooms/modify/' . $this->uniqid, null, null, $baseUri); |
|
| 438 | + $link = $url->get('conference-rooms/modify/'.$this->uniqid, null, null, $baseUri); |
|
| 439 | 439 | break; |
| 440 | 440 | case CustomFiles::class: |
| 441 | - $link = $url->get('custom-files/modify/' . $this->id, null, null, $baseUri); |
|
| 441 | + $link = $url->get('custom-files/modify/'.$this->id, null, null, $baseUri); |
|
| 442 | 442 | break; |
| 443 | 443 | case DialplanApplications::class: |
| 444 | - $link = $url->get('dialplan-applications/modify/' . $this->uniqid, null, null, $baseUri); |
|
| 444 | + $link = $url->get('dialplan-applications/modify/'.$this->uniqid, null, null, $baseUri); |
|
| 445 | 445 | break; |
| 446 | 446 | case ExtensionForwardingRights::class: |
| 447 | 447 | |
| 448 | 448 | break; |
| 449 | 449 | case Extensions::class: |
| 450 | - $link = $url->get('extensions/modify/' . $this->id, null, null, $baseUri); |
|
| 450 | + $link = $url->get('extensions/modify/'.$this->id, null, null, $baseUri); |
|
| 451 | 451 | break; |
| 452 | 452 | case ExternalPhones::class: |
| 453 | 453 | if ($this->Extensions->is_general_user_number === "1") { |
| 454 | - $parameters = [ |
|
| 455 | - 'conditions' => 'is_general_user_number="1" AND type="' . Extensions::TYPE_EXTERNAL . '" AND userid=:userid:', |
|
| 454 | + $parameters = [ |
|
| 455 | + 'conditions' => 'is_general_user_number="1" AND type="'.Extensions::TYPE_EXTERNAL.'" AND userid=:userid:', |
|
| 456 | 456 | 'bind' => [ |
| 457 | 457 | 'userid' => $this->Extensions->userid, |
| 458 | 458 | ], |
| 459 | 459 | ]; |
| 460 | 460 | $needExtension = Extensions::findFirst($parameters); |
| 461 | - $link = $url->get('extensions/modify/' . $needExtension->id, null, null, $baseUri); |
|
| 461 | + $link = $url->get('extensions/modify/'.$needExtension->id, null, null, $baseUri); |
|
| 462 | 462 | } else { |
| 463 | - $link = '#';//TODO сделать если будет раздел для допоплнинельных номеров пользователя |
|
| 463 | + $link = '#'; //TODO сделать если будет раздел для допоплнинельных номеров пользователя |
|
| 464 | 464 | } |
| 465 | 465 | break; |
| 466 | 466 | case Fail2BanRules::class: |
| 467 | - $link = '#';//TODO сделать если будет fail2ban |
|
| 467 | + $link = '#'; //TODO сделать если будет fail2ban |
|
| 468 | 468 | break; |
| 469 | 469 | case FirewallRules::class: |
| 470 | - $link = $url->get('firewall/modify/' . $this->NetworkFilters->id, null, null, $baseUri); |
|
| 470 | + $link = $url->get('firewall/modify/'.$this->NetworkFilters->id, null, null, $baseUri); |
|
| 471 | 471 | break; |
| 472 | 472 | case Iax::class: |
| 473 | - $link = $url->get('providers/modifyiax/' . $this->Providers->id, null, null, $baseUri); |
|
| 473 | + $link = $url->get('providers/modifyiax/'.$this->Providers->id, null, null, $baseUri); |
|
| 474 | 474 | break; |
| 475 | 475 | case IvrMenu::class: |
| 476 | - $link = $url->get('ivr-menu/modify/' . $this->uniqid, null, null, $baseUri); |
|
| 476 | + $link = $url->get('ivr-menu/modify/'.$this->uniqid, null, null, $baseUri); |
|
| 477 | 477 | break; |
| 478 | 478 | case IvrMenuActions::class: |
| 479 | - $link = $url->get('ivr-menu/modify/' . $this->IvrMenu->uniqid, null, null, $baseUri); |
|
| 479 | + $link = $url->get('ivr-menu/modify/'.$this->IvrMenu->uniqid, null, null, $baseUri); |
|
| 480 | 480 | break; |
| 481 | 481 | case Codecs::class: |
| 482 | 482 | break; |
| 483 | 483 | case IncomingRoutingTable::class: |
| 484 | - $link = $url->get('incoming-routes/modify/' . $this->id, null, null, $baseUri); |
|
| 484 | + $link = $url->get('incoming-routes/modify/'.$this->id, null, null, $baseUri); |
|
| 485 | 485 | break; |
| 486 | 486 | case LanInterfaces::class: |
| 487 | 487 | $link = $url->get('network/index/', null, null, $baseUri); |
| 488 | 488 | break; |
| 489 | 489 | case NetworkFilters::class: |
| 490 | - $link = $url->get('firewall/modify/' . $this->id, null, null, $baseUri); |
|
| 490 | + $link = $url->get('firewall/modify/'.$this->id, null, null, $baseUri); |
|
| 491 | 491 | break; |
| 492 | 492 | case OutgoingRoutingTable::class: |
| 493 | - $link = $url->get('outbound-routes/modify/' . $this->id, null, null, $baseUri); |
|
| 493 | + $link = $url->get('outbound-routes/modify/'.$this->id, null, null, $baseUri); |
|
| 494 | 494 | break; |
| 495 | 495 | case OutWorkTimes::class: |
| 496 | - $link = $url->get('out-off-work-time/modify/' . $this->id, null, null, $baseUri); |
|
| 496 | + $link = $url->get('out-off-work-time/modify/'.$this->id, null, null, $baseUri); |
|
| 497 | 497 | break; |
| 498 | 498 | case Providers::class: |
| 499 | 499 | if ($this->type === "IAX") { |
| 500 | - $link = $url->get('providers/modifyiax/' . $this->uniqid, null, null, $baseUri); |
|
| 500 | + $link = $url->get('providers/modifyiax/'.$this->uniqid, null, null, $baseUri); |
|
| 501 | 501 | } else { |
| 502 | - $link = $url->get('providers/modifysip/' . $this->uniqid, null, null, $baseUri); |
|
| 502 | + $link = $url->get('providers/modifysip/'.$this->uniqid, null, null, $baseUri); |
|
| 503 | 503 | } |
| 504 | 504 | break; |
| 505 | 505 | case PbxSettings::class: |
@@ -511,26 +511,26 @@ discard block |
||
| 511 | 511 | case Sip::class: |
| 512 | 512 | if ($this->Extensions) { // Это внутренний номер? |
| 513 | 513 | if ($this->Extensions->is_general_user_number === "1") { |
| 514 | - $link = $url->get('extensions/modify/' . $this->Extensions->id, null, null, $baseUri); |
|
| 514 | + $link = $url->get('extensions/modify/'.$this->Extensions->id, null, null, $baseUri); |
|
| 515 | 515 | } else { |
| 516 | - $link = '#';//TODO сделать если будет раздел для допоплнинельных номеров пользователя |
|
| 516 | + $link = '#'; //TODO сделать если будет раздел для допоплнинельных номеров пользователя |
|
| 517 | 517 | } |
| 518 | 518 | } elseif ($this->Providers) { // Это провайдер |
| 519 | - $link = $url->get('providers/modifysip/' . $this->Providers->id, null, null, $baseUri); |
|
| 519 | + $link = $url->get('providers/modifysip/'.$this->Providers->id, null, null, $baseUri); |
|
| 520 | 520 | } |
| 521 | 521 | break; |
| 522 | 522 | case Users::class: |
| 523 | - $parameters = [ |
|
| 523 | + $parameters = [ |
|
| 524 | 524 | 'conditions' => 'userid=:userid:', |
| 525 | 525 | 'bind' => [ |
| 526 | 526 | 'userid' => $this->id, |
| 527 | 527 | ], |
| 528 | 528 | ]; |
| 529 | 529 | $needExtension = Extensions::findFirst($parameters); |
| 530 | - $link = $url->get('extensions/modify/' . $needExtension->id, null, null, $baseUri); |
|
| 530 | + $link = $url->get('extensions/modify/'.$needExtension->id, null, null, $baseUri); |
|
| 531 | 531 | break; |
| 532 | 532 | case SoundFiles::class: |
| 533 | - $link = $url->get('sound-files/modify/' . $this->id, null, null, $baseUri); |
|
| 533 | + $link = $url->get('sound-files/modify/'.$this->id, null, null, $baseUri); |
|
| 534 | 534 | break; |
| 535 | 535 | default: |
| 536 | 536 | } |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $metaData = $this->di->get('modelsMetadata'); |
| 547 | 547 | $defaultValues = $metaData->getDefaultValues($this); |
| 548 | 548 | foreach ($defaultValues as $field => $value) { |
| 549 | - if ( ! isset($this->{$field})) { |
|
| 549 | + if (!isset($this->{$field})) { |
|
| 550 | 550 | $this->{$field} = $value; |
| 551 | 551 | } |
| 552 | 552 | } |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | = $currentDeleteRecord->_modelsManager->getRelations(get_class($currentDeleteRecord)); |
| 681 | 681 | foreach ($relations as $relation) { |
| 682 | 682 | $foreignKey = $relation->getOption('foreignKey'); |
| 683 | - if ( ! array_key_exists('action', $foreignKey)) { |
|
| 683 | + if (!array_key_exists('action', $foreignKey)) { |
|
| 684 | 684 | continue; |
| 685 | 685 | } |
| 686 | 686 | // Check if there are some record which restrict delete current record |
@@ -698,10 +698,10 @@ discard block |
||
| 698 | 698 | ? ' OR ' : ''; |
| 699 | 699 | $parameters['conditions'] .= $referencedField |
| 700 | 700 | . '= :field' |
| 701 | - . $index . ':'; |
|
| 701 | + . $index.':'; |
|
| 702 | 702 | $bindField |
| 703 | 703 | = $mappedFields[$index]; |
| 704 | - $parameters['bind']['field' . $index] = $currentDeleteRecord->$bindField; |
|
| 704 | + $parameters['bind']['field'.$index] = $currentDeleteRecord->$bindField; |
|
| 705 | 705 | } |
| 706 | 706 | $relatedRecords = $relatedModel::find($parameters); |
| 707 | 707 | switch ($foreignKey['action']) { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | if (php_sapi_name() === 'cli') { |
| 776 | 776 | return; |
| 777 | 777 | } |
| 778 | - if ( ! $this->hasSnapshotData()) { |
|
| 778 | + if (!$this->hasSnapshotData()) { |
|
| 779 | 779 | return; |
| 780 | 780 | } // nothing changed |
| 781 | 781 | |