Passed
Push — develop ( 852f92...19d490 )
by Nikolay
06:03
created
src/PBXCoreREST/Lib/SystemManagementProcessor.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
         $res->data['message'] = 'In progress...';
163 163
 
164 164
 
165
-        if ( ! file_exists($tempFilename)) {
165
+        if (!file_exists($tempFilename)) {
166 166
             $res->success    = false;
167 167
             $res->messages[] = "Update file '{$tempFilename}' not found.";
168 168
 
169 169
             return $res;
170 170
         }
171 171
 
172
-        if ( ! file_exists('/var/etc/cfdevice')) {
172
+        if (!file_exists('/var/etc/cfdevice')) {
173 173
             $res->success    = false;
174 174
             $res->messages[] = "The system is not installed";
175 175
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $res            = new PBXApiResult();
199 199
         $res->processor = __METHOD__;
200 200
         $moduleMetadata = FilesManagementProcessor::getMetadataFromModuleFile($filePath);
201
-        if ( ! $moduleMetadata->success) {
201
+        if (!$moduleMetadata->success) {
202 202
             return $moduleMetadata;
203 203
         } else {
204 204
             $moduleUniqueID = $moduleMetadata->data['uniqid'];
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         if (class_exists($pbxExtensionSetupClass)
238 238
             && method_exists($pbxExtensionSetupClass, 'installModule')) {
239 239
             $setup = new $pbxExtensionSetupClass($moduleUniqueID);
240
-            if ( ! $setup->installModule()) {
240
+            if (!$setup->installModule()) {
241 241
                 $res->success    = false;
242 242
                 $res->messages[] = $setup->getMessages();
243 243
             }
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
             [IncomingRoutingTable::class => ''],
385 385
             [OutWorkTimes::class => ''],
386 386
             [AsteriskManagerUsers::class => ''],
387
-            [Extensions::class => 'type="' . Extensions::TYPE_IVR_MENU . '"'],  // IVR Menu
388
-            [Extensions::class => 'type="' . Extensions::TYPE_CONFERENCE . '"'],  // CONFERENCE
389
-            [Extensions::class => 'type="' . Extensions::TYPE_QUEUE . '"'],  // QUEUE
387
+            [Extensions::class => 'type="'.Extensions::TYPE_IVR_MENU.'"'], // IVR Menu
388
+            [Extensions::class => 'type="'.Extensions::TYPE_CONFERENCE.'"'], // CONFERENCE
389
+            [Extensions::class => 'type="'.Extensions::TYPE_QUEUE.'"'], // QUEUE
390 390
         ];
391 391
 
392 392
         foreach ($clearThisModels as $modelParams) {
393 393
             foreach ($modelParams as $key => $value) {
394 394
                 $records = call_user_func([$key, 'find'], $value);
395
-                if ( ! $records->delete()) {
395
+                if (!$records->delete()) {
396 396
                     $res->messages[] = $records->getMessages();
397 397
                     $res->success    = false;
398 398
                 }
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         // Other extensions
403
-        $parameters     = [
403
+        $parameters = [
404 404
             'conditions' => 'not number IN ({ids:array})',
405 405
             'bind'       => [
406 406
                 'ids' => [
407 407
                     '000063', // Reads back the extension
408 408
                     '000064', // 0000MILLI
409
-                    '10003246',// Echo test
409
+                    '10003246', // Echo test
410 410
                     '10000100' // Voicemail
411 411
                 ],
412 412
             ],
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
                 $stopDeleting = true;
421 421
                 continue;
422 422
             }
423
-            if ( ! $record->delete()) {
423
+            if (!$record->delete()) {
424 424
                 $deleteAttempts += 1;
425 425
             }
426 426
             if ($deleteAttempts > $countRecords * 10) {
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
                 'custom' => SoundFiles::CATEGORY_CUSTOM,
437 437
             ],
438 438
         ];
439
-        $records    = SoundFiles::find($parameters);
439
+        $records = SoundFiles::find($parameters);
440 440
 
441 441
         foreach ($records as $record) {
442 442
             if (stripos($record->path, '/storage/usbdisk1/mikopbx') !== false) {
443 443
                 Util::mwExec("{$rm} -rf {$record->path}");
444
-                if ( ! $record->delete()) {
444
+                if (!$record->delete()) {
445 445
                     $res->messages[] = $record->getMessages();
446 446
                     $res->success    = false;
447 447
                 }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         foreach ($records as $record) {
454 454
             $moduleDir = PbxExtensionUtils::getModuleDir($record->uniqid);
455 455
             Util::mwExec("{$rm} -rf {$moduleDir}");
456
-            if ( ! $record->delete()) {
456
+            if (!$record->delete()) {
457 457
                 $res->messages[] = $record->getMessages();
458 458
                 $res->success    = false;
459 459
             }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 
462 462
         // Delete CallRecords
463 463
         $records = CallDetailRecords::find();
464
-        if ( ! $records->delete()) {
464
+        if (!$records->delete()) {
465 465
             $res->messages[] = $records->getMessages();
466 466
             $res->success    = false;
467 467
         }
@@ -486,14 +486,14 @@  discard block
 block discarded – undo
486 486
     {
487 487
         $res            = new PBXApiResult();
488 488
         $res->processor = __METHOD__;
489
-        if ( ! file_exists($filename)) {
489
+        if (!file_exists($filename)) {
490 490
             $res->success    = false;
491 491
             $res->messages[] = "File '{$filename}' not found.";
492 492
 
493 493
             return $res;
494 494
         }
495 495
         $out          = [];
496
-        $tmp_filename = '/tmp/' . time() . "_" . basename($filename);
496
+        $tmp_filename = '/tmp/'.time()."_".basename($filename);
497 497
         if (false === copy($filename, $tmp_filename)) {
498 498
             $res->success    = false;
499 499
             $res->messages[] = "Unable to create temporary file '{$tmp_filename}'.";
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
         }
503 503
 
504 504
         // Принудительно устанавливаем расширение файла в wav.
505
-        $n_filename     = Util::trimExtensionForFile($filename) . ".wav";
506
-        $n_filename_mp3 = Util::trimExtensionForFile($filename) . ".mp3";
505
+        $n_filename     = Util::trimExtensionForFile($filename).".wav";
506
+        $n_filename_mp3 = Util::trimExtensionForFile($filename).".mp3";
507 507
         // Конвертируем файл.
508 508
         $tmp_filename = escapeshellcmd($tmp_filename);
509 509
         $n_filename   = escapeshellcmd($n_filename);
Please login to merge, or discard this patch.