Passed
Push — develop ( 48ed7a...f087ba )
by Nikolay
05:31
created
src/Modules/Setup/PbxExtensionSetupBase.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
         $this->messages = [];
115 115
         $this->db      = $this->di->getShared('db');
116 116
         $this->config  = $this->di->getShared('config');
117
-        $this->license =  $this->di->getShared('license');
118
-        $this->moduleDir = $this->config->path('core.modulesDir') . '/' . $this->moduleUniqueID;
117
+        $this->license = $this->di->getShared('license');
118
+        $this->moduleDir = $this->config->path('core.modulesDir').'/'.$this->moduleUniqueID;
119 119
         $settings_file = "{$this->moduleDir}/module.json";
120 120
         if (file_exists($settings_file)) {
121 121
             $module_settings = json_decode(file_get_contents($settings_file), true);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             }
140 140
         }
141 141
 
142
-        $this->messages  = [];
142
+        $this->messages = [];
143 143
 
144 144
 
145 145
     }
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $result = true;
156 156
         try {
157
-            if ( ! $this->activateLicense()) {
157
+            if (!$this->activateLicense()) {
158 158
                 $this->messages[] = 'License activate error';
159 159
                 $result           = false;
160 160
             }
161
-            if ( ! $this->installFiles()) {
161
+            if (!$this->installFiles()) {
162 162
                 $this->messages[] = ' installFiles error';
163 163
                 $result           = false;
164 164
             }
165
-            if ( ! $this->installDB()) {
165
+            if (!$this->installDB()) {
166 166
                 $this->messages[] = ' installDB error';
167 167
                 $result           = false;
168 168
             }
169 169
             $this->fixFilesRights();
170 170
         } catch (\Exception $exception) {
171
-            $result         = false;
171
+            $result = false;
172 172
             $this->messages[] = $exception->getMessage();
173 173
         }
174 174
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         PbxExtensionUtils::createAgiBinSymlinks($this->moduleUniqueID);
200 200
 
201 201
         // Restore database settings
202
-        $modulesDir          = $this->config->path('core.modulesDir');
202
+        $modulesDir = $this->config->path('core.modulesDir');
203 203
         $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}";
204 204
         if (is_dir($backupPath)) {
205 205
             $cpPath = Util::which('cp');
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         // Add executable right to module's binary
222 222
         $binDir = $this->moduleDir.'/bin';
223
-        if (is_dir($binDir)){
223
+        if (is_dir($binDir)) {
224 224
             Util::addExecutableRights($binDir);
225 225
         }
226 226
 
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
     {
254 254
         $result = true;
255 255
         try {
256
-            if ( ! $this->unInstallDB($keepSettings)) {
256
+            if (!$this->unInstallDB($keepSettings)) {
257 257
                 $this->messages[] = ' unInstallDB error';
258 258
                 $result           = false;
259 259
             }
260
-            if ($result && ! $this->unInstallFiles($keepSettings)) {
260
+            if ($result && !$this->unInstallFiles($keepSettings)) {
261 261
                 $this->messages[] = ' unInstallFiles error';
262 262
                 $result           = false;
263 263
             }
264 264
         } catch (\Exception $exception) {
265
-            $result         = false;
265
+            $result = false;
266 266
             $this->messages[] = $exception->getMessage();
267 267
         }
268 268
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     {
311 311
         $cpPath = Util::which('cp');
312 312
         $rmPath = Util::which('rm');
313
-        $modulesDir          = $this->config->path('core.modulesDir');
313
+        $modulesDir = $this->config->path('core.modulesDir');
314 314
         $backupPath = "{$modulesDir}/Backup/{$this->moduleUniqueID}";
315 315
         Util::mwExec("{$rmPath} -rf {$backupPath}");
316 316
         if ($keepSettings) {
@@ -323,21 +323,21 @@  discard block
 block discarded – undo
323 323
         // IMG
324 324
         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
325 325
         $moduleImageCacheDir = "{$imgCacheDir}/{$this->moduleUniqueID}";
326
-        if (file_exists($moduleImageCacheDir)){
326
+        if (file_exists($moduleImageCacheDir)) {
327 327
             unlink($moduleImageCacheDir);
328 328
         }
329 329
 
330 330
         // CSS
331 331
         $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache');
332 332
         $moduleCSSCacheDir = "{$cssCacheDir}/{$this->moduleUniqueID}";
333
-        if (file_exists($moduleCSSCacheDir)){
333
+        if (file_exists($moduleCSSCacheDir)) {
334 334
             unlink($moduleCSSCacheDir);
335 335
         }
336 336
 
337 337
         // JS
338 338
         $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache');
339 339
         $moduleJSCacheDir = "{$jsCacheDir}/{$this->moduleUniqueID}";
340
-        if (file_exists($moduleJSCacheDir)){
340
+        if (file_exists($moduleJSCacheDir)) {
341 341
             unlink($moduleJSCacheDir);
342 342
         }
343 343
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         }
372 372
 
373 373
         $module = PbxExtensionModules::findFirstByUniqid($this->moduleUniqueID);
374
-        if ( ! $module) {
374
+        if (!$module) {
375 375
             $module           = new PbxExtensionModules();
376 376
             $module->name     = $this->locString("Breadcrumb{$this->moduleUniqueID}");
377 377
             $module->disabled = '1';
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         $language             = substr(PbxSettings::getValueByKey('WebAdminLanguage'), 0, 2);
398 398
         $translates           = [];
399 399
         $extensionsTranslates = [[]];
400
-        $results              = glob($this->moduleDir . '/{Messages}/en.php', GLOB_BRACE);
400
+        $results              = glob($this->moduleDir.'/{Messages}/en.php', GLOB_BRACE);
401 401
         foreach ($results as $path) {
402 402
             $langArr = require $path;
403 403
             if (is_array($langArr)) {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         }
410 410
         if ($language !== 'en') {
411 411
             $additionalTranslates = [[]];
412
-            $results              = glob($this->moduleDir . "/{Messages}/{$language}.php", GLOB_BRACE);
412
+            $results              = glob($this->moduleDir."/{Messages}/{$language}.php", GLOB_BRACE);
413 413
             foreach ($results as $path) {
414 414
                 $langArr = require $path;
415 415
                 if (is_array($langArr)) {
@@ -440,13 +440,13 @@  discard block
 block discarded – undo
440 440
         // Add new connection for this module after add new Models folder
441 441
         RegisterDIServices::recreateModulesDBConnections();
442 442
 
443
-        $results = glob($this->moduleDir . '/Models/*.php', GLOB_NOSORT);
443
+        $results = glob($this->moduleDir.'/Models/*.php', GLOB_NOSORT);
444 444
         $dbUpgrade = new UpdateDatabase();
445 445
         foreach ($results as $file) {
446 446
             $className        = pathinfo($file)['filename'];
447 447
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
448 448
             $upgradeResult = $dbUpgrade->createUpdateDbTableByAnnotations($moduleModelClass);
449
-            if (!$upgradeResult){
449
+            if (!$upgradeResult) {
450 450
                 return false;
451 451
             }
452 452
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
             $menuSettings      = new PbxSettings();
473 473
             $menuSettings->key = $menuSettingsKey;
474 474
         }
475
-        $value               = [
475
+        $value = [
476 476
             'uniqid'        => $this->moduleUniqueID,
477 477
             'href'          => "/admin-cabinet/$unCamelizedControllerName",
478 478
             'group'         => 'maintenance',
Please login to merge, or discard this patch.
src/Modules/PbxExtensionUtils.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public static function isEnabled(string $moduleUniqueID):bool
28 28
     {
29
-        $result        = PbxExtensionModules::findFirstByUniqid($moduleUniqueID);
30
-        return ($result!==false && $result->disabled !== '1');
29
+        $result = PbxExtensionModules::findFirstByUniqid($moduleUniqueID);
30
+        return ($result !== false && $result->disabled !== '1');
31 31
     }
32 32
 
33 33
     /**
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public static function getModuleDir(string $moduleUniqueID):string
41 41
     {
42
-        $di      = Di::getDefault();
43
-        if ($di === null){
42
+        $di = Di::getDefault();
43
+        if ($di === null) {
44 44
             return "/tmp/{$moduleUniqueID}";
45 45
         }
46
-        $config  = $di->getShared('config');
47
-        $modulesDir    = $config->path('core.modulesDir');
46
+        $config = $di->getShared('config');
47
+        $modulesDir = $config->path('core.modulesDir');
48 48
 
49 49
         return"{$modulesDir}/{$moduleUniqueID}";
50 50
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param string $moduleUniqueID
56 56
      */
57
-    public static function  createAssetsSymlinks (string $moduleUniqueID):void
57
+    public static function  createAssetsSymlinks(string $moduleUniqueID):void
58 58
     {
59 59
         $moduleDir = self::getModuleDir($moduleUniqueID);
60 60
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $moduleImageDir      = "{$moduleDir}/public/assets/img";
63 63
         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
64 64
         $moduleImageCacheDir = "{$imgCacheDir}/{$moduleUniqueID}";
65
-        if (file_exists($moduleImageCacheDir)){
65
+        if (file_exists($moduleImageCacheDir)) {
66 66
             unlink($moduleImageCacheDir);
67 67
         }
68 68
         if (file_exists($moduleImageDir)) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $moduleCSSDir      = "{$moduleDir}/public/assets/css";
73 73
         $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache');
74 74
         $moduleCSSCacheDir = "{$cssCacheDir}/{$moduleUniqueID}";
75
-        if (file_exists($moduleCSSCacheDir)){
75
+        if (file_exists($moduleCSSCacheDir)) {
76 76
             unlink($moduleCSSCacheDir);
77 77
         }
78 78
         if (file_exists($moduleCSSDir)) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $moduleJSDir      = "{$moduleDir}/public/assets/js";
83 83
         $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache');
84 84
         $moduleJSCacheDir = "{$jsCacheDir}/{$moduleUniqueID}";
85
-        if (file_exists($moduleJSCacheDir)){
85
+        if (file_exists($moduleJSCacheDir)) {
86 86
             unlink($moduleJSCacheDir);
87 87
         }
88 88
         if (file_exists($moduleJSDir)) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $moduleAgiBinDir = "{$moduleDir}/agi-bin";
111 111
         $files           = glob("$moduleAgiBinDir/*.{php}", GLOB_BRACE);
112 112
         foreach ($files as $file) {
113
-            $newFilename = $agiBinDir . '/' . pathinfo($file)['filename'];
113
+            $newFilename = $agiBinDir.'/'.pathinfo($file)['filename'];
114 114
             Util::createUpdateSymlink($file, $newFilename);
115 115
         }
116 116
     }
Please login to merge, or discard this patch.
src/Core/System/System.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function timezoneConfigure(): void
187 187
     {
188
-        $timezone = $this->mikoPBXConfig->getGeneralSettings('PBXTimezone');;
188
+        $timezone = $this->mikoPBXConfig->getGeneralSettings('PBXTimezone'); ;
189 189
         if (file_exists('/etc/TZ')) {
190 190
             unlink("/etc/TZ");
191 191
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         }
195 195
         if ($timezone) {
196 196
             $zone_file = "/usr/share/zoneinfo/{$timezone}";
197
-            if ( ! file_exists($zone_file)) {
197
+            if (!file_exists($zone_file)) {
198 198
                 return;
199 199
             }
200 200
             $cpPath = Util::which('cp');
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         $workerSafeScriptsPath = Util::getFilePathByClassName(WorkerSafeScriptsCore::class);
271 271
         $phpPath               = Util::which('php');
272 272
         $WorkerSafeScripts     = "{$phpPath} -f {$workerSafeScriptsPath} restart > /dev/null 2> /dev/null";
273
-        Util::mwExecBg($WorkerSafeScripts,'/dev/null');
273
+        Util::mwExecBg($WorkerSafeScripts, '/dev/null');
274 274
         exit(0);
275 275
     }
276 276
 }
Please login to merge, or discard this patch.
src/Core/System/Storage.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
     public static function isStorageDisk($device): bool
79 79
     {
80 80
         $result = false;
81
-        if ( ! file_exists("{$device}")) {
81
+        if (!file_exists("{$device}")) {
82 82
             return $result;
83 83
         }
84 84
 
85
-        $tmp_dir = '/tmp/mnt_' . time();
85
+        $tmp_dir = '/tmp/mnt_'.time();
86 86
         Util::mwMkdir($tmp_dir);
87 87
         $out = [];
88 88
 
89 89
         $storage  = new Storage();
90
-        $uid_part = 'UUID=' . $storage->getUuid($device) . '';
90
+        $uid_part = 'UUID='.$storage->getUuid($device).'';
91 91
         $format   = $storage->getFsType($device);
92 92
         if ($format === '') {
93 93
             return false;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             Util::mwExec("{$umountPath} {$device}");
107 107
         }
108 108
 
109
-        if ( ! self::isStorageDiskMounted($device)) {
109
+        if (!self::isStorageDiskMounted($device)) {
110 110
             Util::mwExec("{$rmPath} -rf '{$tmp_dir}'");
111 111
         }
112 112
 
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
         $timeoutPath = Util::which('timeout');
237 237
         $sshfsPath   = Util::which('sshfs');
238 238
 
239
-        $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' " .
240
-            "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n" .
241
-            "{$pass}\n" .
239
+        $command = "{$timeoutPath} -t 3 {$sshfsPath} -p {$port} -o nonempty -o password_stdin -o 'StrictHostKeyChecking=no' ".
240
+            "{$user}@{$host}:{$remout_dir} {$local_dir} << EOF\n".
241
+            "{$pass}\n".
242 242
             "EOF\n";
243 243
         // file_put_contents('/tmp/sshfs_'.$host, $command);
244 244
         Util::mwExec($command, $out);
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
 
271 271
         // Собираем строку подключения к ftp.
272 272
         $auth_line = '';
273
-        if ( ! empty($user)) {
274
-            $auth_line .= 'user="' . $user;
275
-            if ( ! empty($pass)) {
273
+        if (!empty($user)) {
274
+            $auth_line .= 'user="'.$user;
275
+            if (!empty($pass)) {
276 276
                 $auth_line .= ":{$pass}";
277 277
             }
278 278
             $auth_line .= '",';
279 279
         }
280 280
 
281
-        $connect_line = 'ftp://' . $host;
282
-        if ( ! empty($port)) {
281
+        $connect_line = 'ftp://'.$host;
282
+        if (!empty($port)) {
283 283
             $connect_line .= ":{$port}";
284 284
         }
285
-        if ( ! empty($remout_dir)) {
285
+        if (!empty($remout_dir)) {
286 286
             $connect_line .= "$remout_dir";
287 287
         }
288 288
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public static function mkfs_disk($dev)
310 310
     {
311
-        if ( ! file_exists($dev)) {
311
+        if (!file_exists($dev)) {
312 312
             $dev = "/dev/{$dev}";
313 313
         }
314
-        if ( ! file_exists($dev)) {
314
+        if (!file_exists($dev)) {
315 315
             return false;
316 316
         }
317 317
         $dir = '';
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             Util::mwExec("/sbin/shell_functions.sh 'killprocesses' '$dir' -TERM 0");
347 347
             Util::mwExec("{$umountPath} {$dir}");
348 348
         }
349
-        $result = ! self::isStorageDiskMounted($dir);
349
+        $result = !self::isStorageDiskMounted($dir);
350 350
         if ($result && file_exists($dir)) {
351 351
             // Если диск не смонтирован, то удаляем каталог.
352 352
             Util::mwExec("{$rmPath} -rf '{$dir}'");
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      */
417 417
     public static function statusMkfs($dev): string
418 418
     {
419
-        if ( ! file_exists($dev)) {
419
+        if (!file_exists($dev)) {
420 420
             $dev = "/dev/{$dev}";
421 421
         }
422 422
         $out      = [];
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         }
440 440
         $config        = $di->getShared('config');
441 441
         $phpSessionDir = $config->path('www.phpSessionDir');
442
-        if ( ! empty($phpSessionDir)) {
442
+        if (!empty($phpSessionDir)) {
443 443
             $rmPath = Util::which('rm');
444 444
             Util::mwExec("{$rmPath} -rf {$phpSessionDir}/*");
445 445
         }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         // Создание больщого файла для тестов.
456 456
         // head -c 1500MB /dev/urandom > /storage/usbdisk1/big_file.mp3
457 457
         foreach ($hdd as $disk) {
458
-            if ($disk['sys_disk'] === true && ! self::isStorageDiskMounted("{$disk['id']}4")) {
458
+            if ($disk['sys_disk'] === true && !self::isStorageDiskMounted("{$disk['id']}4")) {
459 459
                 // Это системный диск (4ый раздел). Он не смонтирован.
460 460
                 continue;
461 461
             }
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
                 Util::restartPHPWorker(WorkerRemoveOldRecords::class);
480 480
             }
481 481
 
482
-            if ( ! $need_alert) {
482
+            if (!$need_alert) {
483 483
                 continue;
484 484
             }
485 485
 
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
                 $m_size      = round(($disk_data[1] + $disk_data[2]) / 1024, 1);
520 520
                 $res_disks[] = [
521 521
                     'id'         => $disk_data[0],
522
-                    'size'       => "" . $m_size,
523
-                    'size_text'  => "" . $m_size . " Mb",
522
+                    'size'       => "".$m_size,
523
+                    'size_text'  => "".$m_size." Mb",
524 524
                     'vendor'     => 'Debian',
525 525
                     'mounted'    => '/storage/usbdisk1',
526 526
                     'free_space' => round($disk_data[2] / 1024, 1),
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 
543 543
         $cf_disk   = '';
544 544
         $varEtcDir = $this->config->path('core.varEtcDir');
545
-        if (file_exists($varEtcDir . '/cfdevice')) {
546
-            $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice'));
545
+        if (file_exists($varEtcDir.'/cfdevice')) {
546
+            $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice'));
547 547
         }
548 548
 
549 549
         foreach ($disks as $disk) {
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
             $sys_disk = ($cf_disk == $disk);
560 560
 
561 561
             $mb_size = 0;
562
-            if (is_file("/sys/block/" . $disk . "/size")) {
563
-                $original_size = trim(file_get_contents("/sys/block/" . $disk . "/size"));
562
+            if (is_file("/sys/block/".$disk."/size")) {
563
+                $original_size = trim(file_get_contents("/sys/block/".$disk."/size"));
564 564
                 $original_size = ($original_size * 512 / 1024 / 1024);
565 565
                 $mb_size       = $original_size;
566 566
             }
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
     private function getVendorDisk($disk): string
668 668
     {
669 669
         $temp_vendor = [];
670
-        if (is_file("/sys/block/" . $disk . "/device/vendor")) {
671
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/vendor"));
670
+        if (is_file("/sys/block/".$disk."/device/vendor")) {
671
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/vendor"));
672 672
             if ($data != '') {
673 673
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
674 674
             }
675 675
         }
676
-        if (is_file("/sys/block/" . $disk . "/device/model")) {
677
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/model"));
676
+        if (is_file("/sys/block/".$disk."/device/model")) {
677
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/model"));
678 678
             if ($data != '') {
679 679
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
680 680
             }
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
         if (count($temp_vendor) == 0) {
683 683
             $temp_vendor[] = $disk;
684 684
         }
685
-        if (is_file("/sys/block/" . $disk . "/device/type")) {
686
-            $data = trim(file_get_contents("/sys/block/" . $disk . "/device/type"));
685
+        if (is_file("/sys/block/".$disk."/device/type")) {
686
+            $data = trim(file_get_contents("/sys/block/".$disk."/device/type"));
687 687
             if ($data != '') {
688 688
                 $temp_vendor[] = trim(str_replace(',', ' ', $data));
689 689
             }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         Util::mwExec("{$dfPath} -m | {$grepPath} {$hdd} | {$awkPath} '{print $4}'", $out);
710 710
         $result = 0;
711 711
         foreach ($out as $res) {
712
-            if ( ! is_numeric($res)) {
712
+            if (!is_numeric($res)) {
713 713
                 continue;
714 714
             }
715 715
             $result += (1 * $res);
@@ -746,19 +746,19 @@  discard block
 block discarded – undo
746 746
                 $path_size_info = $tmp_path;
747 747
             }
748 748
             if (empty($path_size_info)) {
749
-                $tmp_path = "/sys/block/" . substr($dev, 0, 3) . "/{$dev}/size";
749
+                $tmp_path = "/sys/block/".substr($dev, 0, 3)."/{$dev}/size";
750 750
                 if (file_exists($tmp_path)) {
751 751
                     $path_size_info = $tmp_path;
752 752
                 }
753 753
             }
754 754
 
755
-            if ( ! empty($path_size_info)) {
755
+            if (!empty($path_size_info)) {
756 756
                 $original_size = trim(file_get_contents($path_size_info));
757 757
                 $original_size = ($original_size * 512 / 1024 / 1024);
758 758
                 $mb_size       = $original_size;
759 759
             }
760 760
 
761
-            $tmp_dir = "/tmp/{$dev}_" . time();
761
+            $tmp_dir = "/tmp/{$dev}_".time();
762 762
             $out     = [];
763 763
 
764 764
             $fs           = null;
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         }
816 816
         Util::mwMkdir($dir);
817 817
 
818
-        if ( ! file_exists($dir)) {
818
+        if (!file_exists($dir)) {
819 819
             Util::sysLogMsg('Storage', "Unable mount $dev $format to $dir. Unable create dir.");
820 820
 
821 821
             return false;
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
             Util::mwExec("{$mountNtfs3gPath} /dev/{$dev} {$dir}", $out);
827 827
         } else {
828 828
             $storage   = new Storage();
829
-            $uid_part  = 'UUID=' . $storage->getUuid("/dev/{$dev}") . '';
829
+            $uid_part  = 'UUID='.$storage->getUuid("/dev/{$dev}").'';
830 830
             $mountPath = Util::which('mount');
831 831
             Util::mwExec("{$mountPath} -t {$format} {$uid_part} {$dir}", $out);
832 832
         }
@@ -846,8 +846,8 @@  discard block
 block discarded – undo
846 846
             unlink($storage_dev_file);
847 847
         }
848 848
 
849
-        if (file_exists($varEtcDir . '/cfdevice')) {
850
-            $cf_disk = trim(file_get_contents($varEtcDir . '/cfdevice'));
849
+        if (file_exists($varEtcDir.'/cfdevice')) {
850
+            $cf_disk = trim(file_get_contents($varEtcDir.'/cfdevice'));
851 851
         }
852 852
 
853 853
         $disks = $this->getDiskSettings();
@@ -861,18 +861,18 @@  discard block
 block discarded – undo
861 861
                 // Если это системный диск, то пытаемся подключить раздел 4.
862 862
                 $dev = "{$disk['device']}4";
863 863
             }
864
-            if ( ! $this->hddExists($dev)) {
864
+            if (!$this->hddExists($dev)) {
865 865
                 // Диск не существует.
866 866
                 continue;
867 867
             }
868
-            if ($disk['media'] === '1' || ! file_exists($storage_dev_file)) {
868
+            if ($disk['media'] === '1' || !file_exists($storage_dev_file)) {
869 869
                 file_put_contents($storage_dev_file, "/storage/usbdisk{$disk['id']}");
870 870
                 $this->updateConfigWithNewMountPoint("/storage/usbdisk{$disk['id']}");
871 871
             }
872 872
 
873
-            $str_uid     = 'UUID=' . $this->getUuid($dev) . '';
873
+            $str_uid     = 'UUID='.$this->getUuid($dev).'';
874 874
             $format_p4   = $this->getFsType($dev);
875
-            $conf        .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n";
875
+            $conf .= "{$str_uid} /storage/usbdisk{$disk['id']} {$format_p4} async,rw 0 0\n";
876 876
             $mount_point = "/storage/usbdisk{$disk['id']}";
877 877
             Util::mwMkdir($mount_point);
878 878
         }
@@ -974,11 +974,11 @@  discard block
 block discarded – undo
974 974
         Util::mwMkdir('/storage');
975 975
         $chmodPath = Util::which('chmod');
976 976
         Util::mwExec("{$chmodPath} 755 /storage");
977
-        if ( ! file_exists($varEtcDir . '/cfdevice')) {
977
+        if (!file_exists($varEtcDir.'/cfdevice')) {
978 978
             return;
979 979
         }
980 980
         $fstab     = '';
981
-        $file_data = file_get_contents($varEtcDir . '/cfdevice');
981
+        $file_data = file_get_contents($varEtcDir.'/cfdevice');
982 982
         $cf_disk   = trim($file_data);
983 983
         if ('' == $cf_disk) {
984 984
             return;
@@ -988,9 +988,9 @@  discard block
 block discarded – undo
988 988
         $part3 = (strpos($cf_disk, 'mmcblk') !== false) ? "{$cf_disk}p3" : "{$cf_disk}3"; // Conf
989 989
 
990 990
 
991
-        $uid_part2 = 'UUID=' . $this->getUuid("/dev/{$part2}") . '';
991
+        $uid_part2 = 'UUID='.$this->getUuid("/dev/{$part2}").'';
992 992
         $format_p2 = $this->getFsType($part2);
993
-        $uid_part3 = 'UUID=' . $this->getUuid("/dev/{$part3}") . '';
993
+        $uid_part3 = 'UUID='.$this->getUuid("/dev/{$part3}").'';
994 994
         $format_p3 = $this->getFsType($part3);
995 995
 
996 996
         // $fstab .= "/dev/{$part1} /cf msdos ro 1 1\n"; // НЕ МОНТИРУЕМ!
@@ -1035,12 +1035,12 @@  discard block
 block discarded – undo
1035 1035
             }
1036 1036
         }
1037 1037
 
1038
-        if ( ! empty($path)) {
1038
+        if (!empty($path)) {
1039 1039
             Util::mwMkdir($path);
1040 1040
         }
1041 1041
 
1042 1042
         $downloadCacheDir = appPath('sites/pbxcore/files/cache');
1043
-        if ( ! $isLiveCd) {
1043
+        if (!$isLiveCd) {
1044 1044
             Util::mwMkdir($downloadCacheDir);
1045 1045
             Util::createUpdateSymlink($this->config->path('www.downloadCacheDir'), $downloadCacheDir);
1046 1046
         }
@@ -1078,13 +1078,13 @@  discard block
 block discarded – undo
1078 1078
     public function createAssetsSymlinks(): void
1079 1079
     {
1080 1080
         $jsCacheDir = appPath('sites/admin-cabinet/assets/js/cache');
1081
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/js', $jsCacheDir);
1081
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/js', $jsCacheDir);
1082 1082
 
1083 1083
         $cssCacheDir = appPath('sites/admin-cabinet/assets/css/cache');
1084
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/css', $cssCacheDir);
1084
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/css', $cssCacheDir);
1085 1085
 
1086 1086
         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
1087
-        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir') . '/img', $imgCacheDir);
1087
+        Util::createUpdateSymlink($this->config->path('adminApplication.assetsCacheDir').'/img', $imgCacheDir);
1088 1088
     }
1089 1089
 
1090 1090
     /**
@@ -1097,13 +1097,13 @@  discard block
 block discarded – undo
1097 1097
         $cacheDirs[] = $this->config->path('www.downloadCacheDir');
1098 1098
         $cacheDirs[] = $this->config->path('www.managedCacheDir');
1099 1099
         $cacheDirs[] = $this->config->path('www.modelsCacheDir');
1100
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/js';
1101
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/css';
1102
-        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir') . '/img';
1100
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/js';
1101
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/css';
1102
+        $cacheDirs[] = $this->config->path('adminApplication.assetsCacheDir').'/img';
1103 1103
         $cacheDirs[] = $this->config->path('adminApplication.voltCacheDir');
1104 1104
         $rmPath      = Util::which('rm');
1105 1105
         foreach ($cacheDirs as $cacheDir) {
1106
-            if ( ! empty($cacheDir)) {
1106
+            if (!empty($cacheDir)) {
1107 1107
                 Util::mwExec("{$rmPath} -rf {$cacheDir}/*");
1108 1108
             }
1109 1109
         }
@@ -1174,12 +1174,12 @@  discard block
 block discarded – undo
1174 1174
      */
1175 1175
     public function saveDiskSettings($data, $id = '1'): void
1176 1176
     {
1177
-        if ( ! is_array($data)) {
1177
+        if (!is_array($data)) {
1178 1178
             return;
1179 1179
         }
1180 1180
         $disk_data = $this->getDiskSettings($id);
1181 1181
         if (count($disk_data) === 0) {
1182
-            $uniqid           = strtoupper('STORAGE-DISK-' . md5(time()));
1182
+            $uniqid           = strtoupper('STORAGE-DISK-'.md5(time()));
1183 1183
             $storage_settings = new StorageModel();
1184 1184
             foreach ($data as $key => $val) {
1185 1185
                 $storage_settings->writeAttribute($key, $val);
Please login to merge, or discard this patch.
src/Common/Providers/ModelsCacheProvider.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $di->setShared(
47 47
             'modelsCache',
48
-            function () use ($tempDir){
48
+            function() use ($tempDir){
49 49
                 $serializerFactory = new SerializerFactory();
50 50
                 $options = [
51 51
                     'defaultSerializer' => 'php',
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                     'storageDir' => $tempDir
54 54
                 ];
55 55
 
56
-                $adapter = new Stream ($serializerFactory, $options);
56
+                $adapter = new Stream($serializerFactory, $options);
57 57
                 return new Cache($adapter);
58 58
             }
59 59
         );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@
 block discarded – undo
45 45
 
46 46
         $di->setShared(
47 47
             'modelsCache',
48
-            function () use ($tempDir){
48
+            function () use ($tempDir)
49
+            {
49 50
                 $serializerFactory = new SerializerFactory();
50 51
                 $options = [
51 52
                     'defaultSerializer' => 'php',
Please login to merge, or discard this patch.