Completed
Pull Request — master (#489)
by Helpful
03:51
created
code/control/CheckPipelineStatus.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function index()
14 14
     {
15 15
         // @TODO Check that we have been called via the daemon
16
-        if (php_sapi_name() != "cli") {
16
+        if(php_sapi_name() != "cli") {
17 17
             throw new Exception("CheckPipelineStatus must be run from the command-line.");
18 18
         }
19 19
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             $runningPipelines->count()
32 32
         );
33 33
 
34
-        foreach ($runningPipelines as $pipeline) {
34
+        foreach($runningPipelines as $pipeline) {
35 35
             $pipeline->checkPipelineStatus();
36 36
         }
37 37
 
Please login to merge, or discard this patch.
code/control/DNRoot.php 1 patch
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
         Requirements::javascript('deploynaut/javascript/material.js');
192 192
 
193 193
         // Load the buildable dependencies only if not loaded centrally.
194
-        if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
195
-            if (\Director::isDev()) {
194
+        if(!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
195
+            if(\Director::isDev()) {
196 196
                 \Requirements::javascript('deploynaut/static/bundle-debug.js');
197 197
             } else {
198 198
                 \Requirements::javascript('deploynaut/static/bundle.js');
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public static function FlagSnapshotsEnabled()
213 213
     {
214
-        if (defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) {
214
+        if(defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) {
215 215
             return true;
216 216
         }
217
-        if (defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) {
217
+        if(defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) {
218 218
             $allowedMembers = explode(';', FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS);
219 219
             $member = Member::currentUser();
220
-            if ($allowedMembers && $member && in_array($member->Email, $allowedMembers)) {
220
+            if($allowedMembers && $member && in_array($member->Email, $allowedMembers)) {
221 221
                 return true;
222 222
             }
223 223
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public static function get_support_links()
231 231
     {
232 232
         $supportLinks = self::config()->support_links;
233
-        if ($supportLinks) {
233
+        if($supportLinks) {
234 234
             return new ArrayList($supportLinks);
235 235
         }
236 236
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         parent::init();
256 256
 
257
-        if (!Member::currentUser() && !Session::get('AutoLoginHash')) {
257
+        if(!Member::currentUser() && !Session::get('AutoLoginHash')) {
258 258
             return Security::permissionFailure();
259 259
         }
260 260
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 
342 342
         // Performs canView permission check by limiting visible projects
343 343
         $project = $this->getCurrentProject();
344
-        if (!$project) {
344
+        if(!$project) {
345 345
             return $this->project404Response();
346 346
         }
347 347
 
348
-        if (!$project->canBackup()) {
348
+        if(!$project->canBackup()) {
349 349
             return new SS_HTTPResponse("Not allowed to create snapshots on any environments", 401);
350 350
         }
351 351
 
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 
369 369
         // Performs canView permission check by limiting visible projects
370 370
         $project = $this->getCurrentProject();
371
-        if (!$project) {
371
+        if(!$project) {
372 372
             return $this->project404Response();
373 373
         }
374 374
 
375
-        if (!$project->canUploadArchive()) {
375
+        if(!$project->canUploadArchive()) {
376 376
             return new SS_HTTPResponse("Not allowed to upload", 401);
377 377
         }
378 378
 
@@ -405,22 +405,22 @@  discard block
 block discarded – undo
405 405
     {
406 406
         // Performs canView permission check by limiting visible projects
407 407
         $project = $this->getCurrentProject();
408
-        if (!$project) {
408
+        if(!$project) {
409 409
             return $this->project404Response();
410 410
         }
411 411
 
412
-        if (!$project->canUploadArchive()) {
412
+        if(!$project->canUploadArchive()) {
413 413
             return new SS_HTTPResponse("Not allowed to upload", 401);
414 414
         }
415 415
 
416 416
         // Framing an environment as a "group of people with download access"
417 417
         // makes more sense to the user here, while still allowing us to enforce
418 418
         // environment specific restrictions on downloading the file later on.
419
-        $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
419
+        $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
420 420
             return $item->canUploadArchive();
421 421
         });
422 422
         $envsMap = array();
423
-        foreach ($envs as $env) {
423
+        foreach($envs as $env) {
424 424
             $envsMap[$env->ID] = $env->Name;
425 425
         }
426 426
 
@@ -465,18 +465,18 @@  discard block
 block discarded – undo
465 465
 
466 466
         // Performs canView permission check by limiting visible projects
467 467
         $project = $this->getCurrentProject();
468
-        if (!$project) {
468
+        if(!$project) {
469 469
             return $this->project404Response();
470 470
         }
471 471
 
472 472
         $validEnvs = $project->DNEnvironmentList()
473
-            ->filterByCallback(function ($item) {
473
+            ->filterByCallback(function($item) {
474 474
                 return $item->canUploadArchive();
475 475
             });
476 476
 
477 477
         // Validate $data['EnvironmentID'] by checking against $validEnvs.
478 478
         $environment = $validEnvs->find('ID', $data['EnvironmentID']);
479
-        if (!$environment) {
479
+        if(!$environment) {
480 480
             throw new LogicException('Invalid environment');
481 481
         }
482 482
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         $dataArchive->write();
502 502
         $workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
503 503
 
504
-        $cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) {
504
+        $cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) {
505 505
             $process = new Process(sprintf('rm -rf %s', escapeshellarg($workingDir)));
506 506
             $process->run();
507 507
             $dataTransfer->delete();
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
         // extract the sspak contents so we can inspect them
512 512
         try {
513 513
             $dataArchive->extractArchive($workingDir);
514
-        } catch (Exception $e) {
514
+        } catch(Exception $e) {
515 515
             $cleanupFn();
516 516
             $form->sessionMessage(
517 517
                 'There was a problem trying to open your snapshot for processing. Please try uploading again',
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
         // validate that the sspak contents match the declared contents
524 524
         $result = $dataArchive->validateArchiveContents();
525
-        if (!$result->valid()) {
525
+        if(!$result->valid()) {
526 526
             $cleanupFn();
527 527
             $form->sessionMessage($result->message(), 'bad');
528 528
             return $this->redirectBack();
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         try {
533 533
             $dataArchive->fixArchivePermissions($workingDir);
534 534
             $dataArchive->setArchiveFromFiles($workingDir);
535
-        } catch (Exception $e) {
535
+        } catch(Exception $e) {
536 536
             $cleanupFn();
537 537
             $form->sessionMessage(
538 538
                 'There was a problem processing your snapshot. Please try uploading again',
@@ -563,22 +563,22 @@  discard block
 block discarded – undo
563 563
     {
564 564
         // Performs canView permission check by limiting visible projects
565 565
         $project = $this->getCurrentProject();
566
-        if (!$project) {
566
+        if(!$project) {
567 567
             return $this->project404Response();
568 568
         }
569 569
 
570
-        if (!$project->canUploadArchive()) {
570
+        if(!$project->canUploadArchive()) {
571 571
             return new SS_HTTPResponse("Not allowed to upload", 401);
572 572
         }
573 573
 
574 574
         // Framing an environment as a "group of people with download access"
575 575
         // makes more sense to the user here, while still allowing us to enforce
576 576
         // environment specific restrictions on downloading the file later on.
577
-        $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
577
+        $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
578 578
             return $item->canUploadArchive();
579 579
         });
580 580
         $envsMap = array();
581
-        foreach ($envs as $env) {
581
+        foreach($envs as $env) {
582 582
             $envsMap[$env->ID] = $env->Name;
583 583
         }
584 584
 
@@ -616,17 +616,17 @@  discard block
 block discarded – undo
616 616
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
617 617
 
618 618
         $project = $this->getCurrentProject();
619
-        if (!$project) {
619
+        if(!$project) {
620 620
             return $this->project404Response();
621 621
         }
622 622
 
623
-        $validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
623
+        $validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) {
624 624
                 return $item->canUploadArchive();
625 625
         });
626 626
 
627 627
         // Validate $data['EnvironmentID'] by checking against $validEnvs.
628 628
         $environment = $validEnvs->find('ID', $data['EnvironmentID']);
629
-        if (!$environment) {
629
+        if(!$environment) {
630 630
             throw new LogicException('Invalid environment');
631 631
         }
632 632
 
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
 
667 667
         // Performs canView permission check by limiting visible projects
668 668
         $project = $this->getCurrentProject();
669
-        if (!$project) {
669
+        if(!$project) {
670 670
             return $this->project404Response();
671 671
         }
672 672
 
673
-        if (!$project->canUploadArchive()) {
673
+        if(!$project->canUploadArchive()) {
674 674
             return new SS_HTTPResponse("Not allowed to upload", 401);
675 675
         }
676 676
 
677 677
         $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));
678
-        if (!$dataArchive) {
678
+        if(!$dataArchive) {
679 679
             return new SS_HTTPResponse("Archive not found.", 404);
680 680
         }
681 681
 
682
-        if (!$dataArchive->canRestore()) {
682
+        if(!$dataArchive->canRestore()) {
683 683
             throw new SS_HTTPResponse_Exception('Not allowed to restore archive', 403);
684 684
         }
685 685
 
@@ -710,19 +710,19 @@  discard block
 block discarded – undo
710 710
     public function toggleprojectstar(SS_HTTPRequest $request)
711 711
     {
712 712
         $project = $this->getCurrentProject();
713
-        if (!$project) {
713
+        if(!$project) {
714 714
             return $this->project404Response();
715 715
         }
716 716
 
717 717
         $member = Member::currentUser();
718
-        if ($member === null) {
718
+        if($member === null) {
719 719
             return $this->project404Response();
720 720
         }
721 721
         $favProject = $member->StarredProjects()
722 722
             ->filter('DNProjectID', $project->ID)
723 723
             ->first();
724 724
 
725
-        if ($favProject) {
725
+        if($favProject) {
726 726
             $member->StarredProjects()->remove($favProject);
727 727
         } else {
728 728
             $member->StarredProjects()->add($project);
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
     public function branch(SS_HTTPRequest $request)
738 738
     {
739 739
         $project = $this->getCurrentProject();
740
-        if (!$project) {
740
+        if(!$project) {
741 741
             return $this->project404Response();
742 742
         }
743 743
 
744 744
         $branchName = $request->getVar('name');
745 745
         $branch = $project->DNBranchList()->byName($branchName);
746
-        if (!$branch) {
746
+        if(!$branch) {
747 747
             return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
748 748
         }
749 749
 
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
     {
761 761
         // Performs canView permission check by limiting visible projects
762 762
         $project = $this->getCurrentProject();
763
-        if (!$project) {
763
+        if(!$project) {
764 764
             return $this->project404Response();
765 765
         }
766 766
 
767 767
         // Performs canView permission check by limiting visible projects
768 768
         $env = $this->getCurrentEnvironment($project);
769
-        if (!$env) {
769
+        if(!$env) {
770 770
             return $this->environment404Response();
771 771
         }
772 772
 
@@ -816,17 +816,17 @@  discard block
 block discarded – undo
816 816
 
817 817
         // Performs canView permission check by limiting visible projects
818 818
         $project = $this->getCurrentProject();
819
-        if (!$project) {
819
+        if(!$project) {
820 820
             return $this->project404Response();
821 821
         }
822 822
 
823 823
         // Performs canView permission check by limiting visible projects
824 824
         $environment = $this->getCurrentEnvironment($project);
825
-        if (!$environment) {
825
+        if(!$environment) {
826 826
             return $this->environment404Response();
827 827
         }
828 828
 
829
-        if (!$environment->DryRunEnabled && $isDryRun) {
829
+        if(!$environment->DryRunEnabled && $isDryRun) {
830 830
             return new SS_HTTPResponse("Dry-run for pipelines is not enabled for this environment", 404);
831 831
         }
832 832
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
         $pipeline->AuthorID = Member::currentUserID();
839 839
         $pipeline->SHA = $sha->FullName();
840 840
         // Record build at time of execution
841
-        if ($currentBuild = $environment->CurrentBuild()) {
841
+        if($currentBuild = $environment->CurrentBuild()) {
842 842
             $pipeline->PreviousDeploymentID = $currentBuild->ID;
843 843
         }
844 844
         $pipeline->start(); // start() will call write(), so no need to do it here as well.
@@ -856,20 +856,20 @@  discard block
 block discarded – undo
856 856
         $params = $request->params();
857 857
         $pipeline = Pipeline::get()->byID($params['Identifier']);
858 858
 
859
-        if (!$pipeline || !$pipeline->ID || !$pipeline->Environment()) {
859
+        if(!$pipeline || !$pipeline->ID || !$pipeline->Environment()) {
860 860
             throw new SS_HTTPResponse_Exception('Pipeline not found', 404);
861 861
         }
862
-        if (!$pipeline->Environment()->canView()) {
862
+        if(!$pipeline->Environment()->canView()) {
863 863
             return Security::permissionFailure();
864 864
         }
865 865
 
866 866
         $environment = $pipeline->Environment();
867 867
         $project = $pipeline->Environment()->Project();
868 868
 
869
-        if ($environment->Name != $params['Environment']) {
869
+        if($environment->Name != $params['Environment']) {
870 870
             throw new LogicException("Environment in URL doesn't match this pipeline");
871 871
         }
872
-        if ($project->Name != $params['Project']) {
872
+        if($project->Name != $params['Project']) {
873 873
             throw new LogicException("Project in URL doesn't match this pipeline");
874 874
         }
875 875
 
@@ -886,22 +886,22 @@  discard block
 block discarded – undo
886 886
     public function createenv(SS_HTTPRequest $request)
887 887
     {
888 888
         $params = $request->params();
889
-        if ($params['Identifier']) {
889
+        if($params['Identifier']) {
890 890
             $record = DNCreateEnvironment::get()->byId($params['Identifier']);
891 891
 
892
-            if (!$record || !$record->ID) {
892
+            if(!$record || !$record->ID) {
893 893
                 throw new SS_HTTPResponse_Exception('Create environment not found', 404);
894 894
             }
895
-            if (!$record->canView()) {
895
+            if(!$record->canView()) {
896 896
                 return Security::permissionFailure();
897 897
             }
898 898
 
899 899
             $project = $this->getCurrentProject();
900
-            if (!$project) {
900
+            if(!$project) {
901 901
                 return $this->project404Response();
902 902
             }
903 903
 
904
-            if ($project->Name != $params['Project']) {
904
+            if($project->Name != $params['Project']) {
905 905
                 throw new LogicException("Project in URL doesn't match this creation");
906 906
             }
907 907
 
@@ -920,21 +920,21 @@  discard block
 block discarded – undo
920 920
         $params = $request->params();
921 921
         $env = DNCreateEnvironment::get()->byId($params['Identifier']);
922 922
 
923
-        if (!$env || !$env->ID) {
923
+        if(!$env || !$env->ID) {
924 924
             throw new SS_HTTPResponse_Exception('Log not found', 404);
925 925
         }
926
-        if (!$env->canView()) {
926
+        if(!$env->canView()) {
927 927
             return Security::permissionFailure();
928 928
         }
929 929
 
930 930
         $project = $env->Project();
931 931
 
932
-        if ($project->Name != $params['Project']) {
932
+        if($project->Name != $params['Project']) {
933 933
             throw new LogicException("Project in URL doesn't match this deploy");
934 934
         }
935 935
 
936 936
         $log = $env->log();
937
-        if ($log->exists()) {
937
+        if($log->exists()) {
938 938
             $content = $log->content();
939 939
         } else {
940 940
             $content = 'Waiting for action to start';
@@ -952,27 +952,27 @@  discard block
 block discarded – undo
952 952
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
953 953
 
954 954
         $project = $this->getCurrentProject();
955
-        if (!$project) {
955
+        if(!$project) {
956 956
             return $this->project404Response();
957 957
         }
958 958
 
959 959
         $envType = $project->AllowedEnvironmentType;
960
-        if (!$envType || !class_exists($envType)) {
960
+        if(!$envType || !class_exists($envType)) {
961 961
             return null;
962 962
         }
963 963
 
964 964
         $backend = Injector::inst()->get($envType);
965
-        if (!($backend instanceof EnvironmentCreateBackend)) {
965
+        if(!($backend instanceof EnvironmentCreateBackend)) {
966 966
             // Only allow this for supported backends.
967 967
             return null;
968 968
         }
969 969
 
970 970
         $fields = $backend->getCreateEnvironmentFields($project);
971
-        if (!$fields) {
971
+        if(!$fields) {
972 972
             return null;
973 973
         }
974 974
 
975
-        if (!$project->canCreateEnvironments()) {
975
+        if(!$project->canCreateEnvironments()) {
976 976
             return new SS_HTTPResponse('Not allowed to create environments for this project', 401);
977 977
         }
978 978
 
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
1005 1005
 
1006 1006
         $project = $this->getCurrentProject();
1007
-        if (!$project) {
1007
+        if(!$project) {
1008 1008
             return $this->project404Response();
1009 1009
         }
1010 1010
 
1011
-        if (!$project->canCreateEnvironments()) {
1011
+        if(!$project->canCreateEnvironments()) {
1012 1012
             return new SS_HTTPResponse('Not allowed to create environments for this project', 401);
1013 1013
         }
1014 1014
 
@@ -1034,13 +1034,13 @@  discard block
 block discarded – undo
1034 1034
     {
1035 1035
         // Performs canView permission check by limiting visible projects
1036 1036
         $project = $this->getCurrentProject();
1037
-        if (!$project) {
1037
+        if(!$project) {
1038 1038
             return $this->project404Response();
1039 1039
         }
1040 1040
 
1041 1041
         // Performs canView permission check by limiting visible projects
1042 1042
         $env = $this->getCurrentEnvironment($project);
1043
-        if (!$env) {
1043
+        if(!$env) {
1044 1044
             return $this->environment404Response();
1045 1045
         }
1046 1046
 
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
     public function DNProjectList()
1066 1066
     {
1067 1067
         $memberId = Member::currentUserID();
1068
-        if (!$memberId) {
1068
+        if(!$memberId) {
1069 1069
             return new ArrayList();
1070 1070
         }
1071 1071
 
1072
-        if (Permission::check('ADMIN')) {
1072
+        if(Permission::check('ADMIN')) {
1073 1073
             return DNProject::get();
1074 1074
         }
1075 1075
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
     public function getPlatformSpecificStrings()
1085 1085
     {
1086 1086
         $strings = $this->config()->platform_specific_strings;
1087
-        if ($strings) {
1087
+        if($strings) {
1088 1088
             return new ArrayList($strings);
1089 1089
         }
1090 1090
     }
@@ -1097,15 +1097,15 @@  discard block
 block discarded – undo
1097 1097
     public function getStarredProjects()
1098 1098
     {
1099 1099
         $member = Member::currentUser();
1100
-        if ($member === null) {
1100
+        if($member === null) {
1101 1101
             return new ArrayList();
1102 1102
         }
1103 1103
 
1104 1104
         $favProjects = $member->StarredProjects();
1105 1105
 
1106 1106
         $list = new ArrayList();
1107
-        foreach ($favProjects as $project) {
1108
-            if ($project->canView($member)) {
1107
+        foreach($favProjects as $project) {
1108
+            if($project->canView($member)) {
1109 1109
                 $list->add($project);
1110 1110
             }
1111 1111
         }
@@ -1126,24 +1126,24 @@  discard block
 block discarded – undo
1126 1126
         $currentProject = $this->getCurrentProject();
1127 1127
 
1128 1128
         $projects = $this->getStarredProjects();
1129
-        if ($projects->count() < 1) {
1129
+        if($projects->count() < 1) {
1130 1130
             $projects = $this->DNProjectList();
1131 1131
         } else {
1132 1132
             $limit = -1;
1133 1133
         }
1134 1134
 
1135
-        if ($projects->count() > 0) {
1135
+        if($projects->count() > 0) {
1136 1136
             $activeProject = false;
1137 1137
 
1138
-            if ($limit > 0) {
1138
+            if($limit > 0) {
1139 1139
                 $limitedProjects = $projects->limit($limit);
1140 1140
             } else {
1141 1141
                 $limitedProjects = $projects;
1142 1142
             }
1143 1143
 
1144
-            foreach ($limitedProjects as $project) {
1144
+            foreach($limitedProjects as $project) {
1145 1145
                 $isActive = $currentProject && $currentProject->ID == $project->ID;
1146
-                if ($isActive) {
1146
+                if($isActive) {
1147 1147
                     $activeProject = true;
1148 1148
                 }
1149 1149
 
@@ -1154,12 +1154,12 @@  discard block
 block discarded – undo
1154 1154
             }
1155 1155
 
1156 1156
             // Ensure the current project is in the list
1157
-            if (!$activeProject && $currentProject) {
1157
+            if(!$activeProject && $currentProject) {
1158 1158
                 $navigation->unshift(array(
1159 1159
                     'Project' => $currentProject,
1160 1160
                     'IsActive' => true,
1161 1161
                 ));
1162
-                if ($limit > 0 && $navigation->count() > $limit) {
1162
+                if($limit > 0 && $navigation->count() > $limit) {
1163 1163
                     $navigation->pop();
1164 1164
                 }
1165 1165
             }
@@ -1178,17 +1178,17 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
         // Performs canView permission check by limiting visible projects
1180 1180
         $project = $this->getCurrentProject();
1181
-        if (!$project) {
1181
+        if(!$project) {
1182 1182
             return $this->project404Response();
1183 1183
         }
1184 1184
 
1185 1185
         // Performs canView permission check by limiting visible projects
1186 1186
         $environment = $this->getCurrentEnvironment($project);
1187
-        if (!$environment) {
1187
+        if(!$environment) {
1188 1188
             return $this->environment404Response();
1189 1189
         }
1190 1190
 
1191
-        if (!$environment->canDeploy()) {
1191
+        if(!$environment->canDeploy()) {
1192 1192
             return new SS_HTTPResponse("Not allowed to deploy", 401);
1193 1193
         }
1194 1194
 
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
         $form = new DeployForm($this, 'DeployForm', $environment, $project);
1197 1197
 
1198 1198
         // If this is an ajax request we don't want to submit the form - we just want to retrieve the markup.
1199
-        if (
1199
+        if(
1200 1200
             $request &&
1201 1201
             !$request->requestVar('action_showDeploySummary') &&
1202 1202
             $this->getRequest()->isAjax() &&
@@ -1225,19 +1225,19 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
         // Performs canView permission check by limiting visible projects
1227 1227
         $project = $this->getCurrentProject();
1228
-        if (!$project) {
1228
+        if(!$project) {
1229 1229
             return $this->project404Response();
1230 1230
         }
1231 1231
 
1232 1232
         // Performs canView permission check by limiting visible projects
1233 1233
         $env = $this->getCurrentEnvironment($project);
1234
-        if (!$env) {
1234
+        if(!$env) {
1235 1235
             return $this->environment404Response();
1236 1236
         }
1237 1237
 
1238 1238
         // For now only permit advanced options on one environment type, because we hacked the "full-deploy"
1239 1239
         // checkbox in. Other environments such as the fast or capistrano one wouldn't know what to do with it.
1240
-        if (get_class($env) === 'RainforestEnvironment') {
1240
+        if(get_class($env) === 'RainforestEnvironment') {
1241 1241
             $advanced = Permission::check('DEPLOYNAUT_ADVANCED_DEPLOY_OPTIONS') ? 'true' : 'false';
1242 1242
         } else {
1243 1243
             $advanced = 'false';
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
             'field_data' => array(),
1255 1255
             'advanced_opts' => $advanced
1256 1256
         );
1257
-        foreach ($project->DNBranchList() as $branch) {
1257
+        foreach($project->DNBranchList() as $branch) {
1258 1258
             $sha = $branch->SHA();
1259 1259
             $name = $branch->Name();
1260 1260
             $branchValue = sprintf("%s (%s, %s old)",
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
             'advanced_opts' => $advanced
1280 1280
         );
1281 1281
 
1282
-        foreach ($project->DNTagList()->setLimit(null) as $tag) {
1282
+        foreach($project->DNTagList()->setLimit(null) as $tag) {
1283 1283
             $name = $tag->Name();
1284 1284
             $data['field_data'][] = array(
1285 1285
                 'id' => $tag->SHA(),
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
         // We are aiming at the format:
1306 1306
         // [{text: 'optgroup text', children: [{id: '<sha>', text: '<inner text>'}]}]
1307 1307
         $redeploy = array();
1308
-        foreach ($project->DNEnvironmentList() as $dnEnvironment) {
1308
+        foreach($project->DNEnvironmentList() as $dnEnvironment) {
1309 1309
             $envName = $dnEnvironment->Name;
1310 1310
             $perEnvDeploys = array();
1311 1311
 
1312
-            foreach ($dnEnvironment->DeployHistory() as $deploy) {
1312
+            foreach($dnEnvironment->DeployHistory() as $deploy) {
1313 1313
                 $sha = $deploy->SHA;
1314 1314
 
1315 1315
                 // Check if exists to make sure the newest deployment date is used.
1316
-                if (!isset($perEnvDeploys[$sha])) {
1316
+                if(!isset($perEnvDeploys[$sha])) {
1317 1317
                     $pastValue = sprintf("%s (deployed %s)",
1318 1318
                         substr($sha, 0, 8),
1319 1319
                         $deploy->obj('LastEdited')->Ago()
@@ -1325,12 +1325,12 @@  discard block
 block discarded – undo
1325 1325
                 }
1326 1326
             }
1327 1327
 
1328
-            if (!empty($perEnvDeploys)) {
1328
+            if(!empty($perEnvDeploys)) {
1329 1329
                 $redeploy[$envName] = array_values($perEnvDeploys);
1330 1330
             }
1331 1331
         }
1332 1332
         // Convert the array to the frontend format (i.e. keyed to regular array)
1333
-        foreach ($redeploy as $env => $descr) {
1333
+        foreach($redeploy as $env => $descr) {
1334 1334
             $data['field_data'][] = array('text'=>$env, 'children'=>$descr);
1335 1335
         }
1336 1336
         $tabs[] = $data;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
             ->filter('ProjectID', $project->ID)
1353 1353
             ->sort('LastEdited', 'DESC')
1354 1354
             ->first();
1355
-        if ($fetch) {
1355
+        if($fetch) {
1356 1356
             $lastFetched = $fetch->dbObject('LastEdited')->Ago();
1357 1357
         }
1358 1358
 
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 
1379 1379
         // Ensure the submitted token has a value
1380 1380
         $submittedToken = $request->postVar('SecurityID');
1381
-        if (!$submittedToken) {
1381
+        if(!$submittedToken) {
1382 1382
             return false;
1383 1383
         }
1384 1384
 
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
         $check = $token->check($submittedToken);
1387 1387
 
1388 1388
         // Reset the token after we've checked the existing token
1389
-        if ($resetToken) {
1389
+        if($resetToken) {
1390 1390
             $token->reset();
1391 1391
         }
1392 1392
 
@@ -1404,13 +1404,13 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
         // Performs canView permission check by limiting visible projects
1406 1406
         $project = $this->getCurrentProject();
1407
-        if (!$project) {
1407
+        if(!$project) {
1408 1408
             return $this->project404Response();
1409 1409
         }
1410 1410
 
1411 1411
         // Performs canView permission check by limiting visible projects
1412 1412
         $environment = $this->getCurrentEnvironment($project);
1413
-        if (!$environment) {
1413
+        if(!$environment) {
1414 1414
             return $this->environment404Response();
1415 1415
         }
1416 1416
 
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
         // Add in a URL for comparing from->to code changes. Ensure that we have
1425 1425
         // two proper 40 character SHAs, otherwise we can't show the compare link.
1426 1426
         $interface = $project->getRepositoryInterface();
1427
-        if (
1427
+        if(
1428 1428
             !empty($interface) && !empty($interface->URL)
1429 1429
             && !empty($data['changes']['Code version']['from'])
1430 1430
             && strlen($data['changes']['Code version']['from']) == '40'
@@ -1462,20 +1462,20 @@  discard block
 block discarded – undo
1462 1462
     {
1463 1463
 
1464 1464
         // Ensure the CSRF Token is correct
1465
-        if (!$this->checkCsrfToken($request)) {
1465
+        if(!$this->checkCsrfToken($request)) {
1466 1466
             // CSRF token didn't match
1467 1467
             return $this->httpError(400, 'Bad Request');
1468 1468
         }
1469 1469
 
1470 1470
         // Performs canView permission check by limiting visible projects
1471 1471
         $project = $this->getCurrentProject();
1472
-        if (!$project) {
1472
+        if(!$project) {
1473 1473
             return $this->project404Response();
1474 1474
         }
1475 1475
 
1476 1476
         // Performs canView permission check by limiting visible projects
1477 1477
         $environment = $this->getCurrentEnvironment($project);
1478
-        if (!$environment) {
1478
+        if(!$environment) {
1479 1479
             return $this->environment404Response();
1480 1480
         }
1481 1481
 
@@ -1507,20 +1507,20 @@  discard block
 block discarded – undo
1507 1507
         $params = $request->params();
1508 1508
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1509 1509
 
1510
-        if (!$deployment || !$deployment->ID) {
1510
+        if(!$deployment || !$deployment->ID) {
1511 1511
             throw new SS_HTTPResponse_Exception('Deployment not found', 404);
1512 1512
         }
1513
-        if (!$deployment->canView()) {
1513
+        if(!$deployment->canView()) {
1514 1514
             return Security::permissionFailure();
1515 1515
         }
1516 1516
 
1517 1517
         $environment = $deployment->Environment();
1518 1518
         $project = $environment->Project();
1519 1519
 
1520
-        if ($environment->Name != $params['Environment']) {
1520
+        if($environment->Name != $params['Environment']) {
1521 1521
             throw new LogicException("Environment in URL doesn't match this deploy");
1522 1522
         }
1523
-        if ($project->Name != $params['Project']) {
1523
+        if($project->Name != $params['Project']) {
1524 1524
             throw new LogicException("Project in URL doesn't match this deploy");
1525 1525
         }
1526 1526
 
@@ -1543,25 +1543,25 @@  discard block
 block discarded – undo
1543 1543
         $params = $request->params();
1544 1544
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1545 1545
 
1546
-        if (!$deployment || !$deployment->ID) {
1546
+        if(!$deployment || !$deployment->ID) {
1547 1547
             throw new SS_HTTPResponse_Exception('Deployment not found', 404);
1548 1548
         }
1549
-        if (!$deployment->canView()) {
1549
+        if(!$deployment->canView()) {
1550 1550
             return Security::permissionFailure();
1551 1551
         }
1552 1552
 
1553 1553
         $environment = $deployment->Environment();
1554 1554
         $project = $environment->Project();
1555 1555
 
1556
-        if ($environment->Name != $params['Environment']) {
1556
+        if($environment->Name != $params['Environment']) {
1557 1557
             throw new LogicException("Environment in URL doesn't match this deploy");
1558 1558
         }
1559
-        if ($project->Name != $params['Project']) {
1559
+        if($project->Name != $params['Project']) {
1560 1560
             throw new LogicException("Project in URL doesn't match this deploy");
1561 1561
         }
1562 1562
 
1563 1563
         $log = $deployment->log();
1564
-        if ($log->exists()) {
1564
+        if($log->exists()) {
1565 1565
             $content = $log->content();
1566 1566
         } else {
1567 1567
             $content = 'Waiting for action to start';
@@ -1578,11 +1578,11 @@  discard block
 block discarded – undo
1578 1578
     public function getDataTransferForm(SS_HTTPRequest $request = null)
1579 1579
     {
1580 1580
         // Performs canView permission check by limiting visible projects
1581
-        $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1581
+        $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) {
1582 1582
             return $item->canBackup();
1583 1583
         });
1584 1584
 
1585
-        if (!$envs) {
1585
+        if(!$envs) {
1586 1586
             return $this->environment404Response();
1587 1587
         }
1588 1588
 
@@ -1618,21 +1618,21 @@  discard block
 block discarded – undo
1618 1618
 
1619 1619
         // Performs canView permission check by limiting visible projects
1620 1620
         $project = $this->getCurrentProject();
1621
-        if (!$project) {
1621
+        if(!$project) {
1622 1622
             return $this->project404Response();
1623 1623
         }
1624 1624
 
1625 1625
         $dataArchive = null;
1626 1626
 
1627 1627
         // Validate direction.
1628
-        if ($data['Direction'] == 'get') {
1628
+        if($data['Direction'] == 'get') {
1629 1629
             $validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1630
-                ->filterByCallback(function ($item) {
1630
+                ->filterByCallback(function($item) {
1631 1631
                     return $item->canBackup();
1632 1632
                 });
1633
-        } elseif ($data['Direction'] == 'push') {
1633
+        } elseif($data['Direction'] == 'push') {
1634 1634
             $validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1635
-                ->filterByCallback(function ($item) {
1635
+                ->filterByCallback(function($item) {
1636 1636
                     return $item->canRestore();
1637 1637
                 });
1638 1638
         } else {
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 
1642 1642
         // Validate $data['EnvironmentID'] by checking against $validEnvs.
1643 1643
         $environment = $validEnvs->find('ID', $data['EnvironmentID']);
1644
-        if (!$environment) {
1644
+        if(!$environment) {
1645 1645
             throw new LogicException('Invalid environment');
1646 1646
         }
1647 1647
 
@@ -1649,17 +1649,17 @@  discard block
 block discarded – undo
1649 1649
 
1650 1650
 
1651 1651
         // Only 'push' direction is allowed an association with an existing archive.
1652
-        if (
1652
+        if(
1653 1653
             $data['Direction'] == 'push'
1654 1654
             && isset($data['DataArchiveID'])
1655 1655
             && is_numeric($data['DataArchiveID'])
1656 1656
         ) {
1657 1657
             $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']);
1658
-            if (!$dataArchive) {
1658
+            if(!$dataArchive) {
1659 1659
                 throw new LogicException('Invalid data archive');
1660 1660
             }
1661 1661
 
1662
-            if (!$dataArchive->canDownload()) {
1662
+            if(!$dataArchive->canDownload()) {
1663 1663
                 throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403);
1664 1664
             }
1665 1665
         }
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
         $transfer->Direction = $data['Direction'];
1670 1670
         $transfer->Mode = $data['Mode'];
1671 1671
         $transfer->DataArchiveID = $dataArchive ? $dataArchive->ID : null;
1672
-        if ($data['Direction'] == 'push') {
1672
+        if($data['Direction'] == 'push') {
1673 1673
             $transfer->setBackupBeforePush(!empty($data['BackupBeforePush']));
1674 1674
         }
1675 1675
         $transfer->write();
@@ -1693,17 +1693,17 @@  discard block
 block discarded – undo
1693 1693
         $params = $request->params();
1694 1694
         $transfer = DNDataTransfer::get()->byId($params['Identifier']);
1695 1695
 
1696
-        if (!$transfer || !$transfer->ID) {
1696
+        if(!$transfer || !$transfer->ID) {
1697 1697
             throw new SS_HTTPResponse_Exception('Transfer not found', 404);
1698 1698
         }
1699
-        if (!$transfer->canView()) {
1699
+        if(!$transfer->canView()) {
1700 1700
             return Security::permissionFailure();
1701 1701
         }
1702 1702
 
1703 1703
         $environment = $transfer->Environment();
1704 1704
         $project = $environment->Project();
1705 1705
 
1706
-        if ($project->Name != $params['Project']) {
1706
+        if($project->Name != $params['Project']) {
1707 1707
             throw new LogicException("Project in URL doesn't match this deploy");
1708 1708
         }
1709 1709
 
@@ -1728,22 +1728,22 @@  discard block
 block discarded – undo
1728 1728
         $params = $request->params();
1729 1729
         $transfer = DNDataTransfer::get()->byId($params['Identifier']);
1730 1730
 
1731
-        if (!$transfer || !$transfer->ID) {
1731
+        if(!$transfer || !$transfer->ID) {
1732 1732
             throw new SS_HTTPResponse_Exception('Transfer not found', 404);
1733 1733
         }
1734
-        if (!$transfer->canView()) {
1734
+        if(!$transfer->canView()) {
1735 1735
             return Security::permissionFailure();
1736 1736
         }
1737 1737
 
1738 1738
         $environment = $transfer->Environment();
1739 1739
         $project = $environment->Project();
1740 1740
 
1741
-        if ($project->Name != $params['Project']) {
1741
+        if($project->Name != $params['Project']) {
1742 1742
             throw new LogicException("Project in URL doesn't match this deploy");
1743 1743
         }
1744 1744
 
1745 1745
         $log = $transfer->log();
1746
-        if ($log->exists()) {
1746
+        if($log->exists()) {
1747 1747
             $content = $log->content();
1748 1748
         } else {
1749 1749
             $content = 'Waiting for action to start';
@@ -1767,22 +1767,22 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
         // Performs canView permission check by limiting visible projects
1769 1769
         $project = $this->getCurrentProject();
1770
-        $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
1770
+        $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
1771 1771
             return $item->canRestore();
1772 1772
         });
1773 1773
 
1774
-        if (!$envs) {
1774
+        if(!$envs) {
1775 1775
             return $this->environment404Response();
1776 1776
         }
1777 1777
 
1778 1778
         $modesMap = array();
1779
-        if (in_array($dataArchive->Mode, array('all'))) {
1779
+        if(in_array($dataArchive->Mode, array('all'))) {
1780 1780
             $modesMap['all'] = 'Database and Assets';
1781 1781
         };
1782
-        if (in_array($dataArchive->Mode, array('all', 'db'))) {
1782
+        if(in_array($dataArchive->Mode, array('all', 'db'))) {
1783 1783
             $modesMap['db'] = 'Database only';
1784 1784
         };
1785
-        if (in_array($dataArchive->Mode, array('all', 'assets'))) {
1785
+        if(in_array($dataArchive->Mode, array('all', 'assets'))) {
1786 1786
             $modesMap['assets'] = 'Assets only';
1787 1787
         };
1788 1788
 
@@ -1828,13 +1828,13 @@  discard block
 block discarded – undo
1828 1828
         /** @var DNDataArchive $dataArchive */
1829 1829
         $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));
1830 1830
 
1831
-        if (!$dataArchive) {
1831
+        if(!$dataArchive) {
1832 1832
             throw new SS_HTTPResponse_Exception('Archive not found', 404);
1833 1833
         }
1834 1834
 
1835 1835
         // We check for canDownload because that implies access to the data.
1836 1836
         // canRestore is later checked on the actual restore action per environment.
1837
-        if (!$dataArchive->canDownload()) {
1837
+        if(!$dataArchive->canDownload()) {
1838 1838
             throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403);
1839 1839
         }
1840 1840
 
@@ -1861,11 +1861,11 @@  discard block
 block discarded – undo
1861 1861
         /** @var DNDataArchive $dataArchive */
1862 1862
         $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));
1863 1863
 
1864
-        if (!$dataArchive) {
1864
+        if(!$dataArchive) {
1865 1865
             throw new SS_HTTPResponse_Exception('Archive not found', 404);
1866 1866
         }
1867 1867
 
1868
-        if (!$dataArchive->canDelete()) {
1868
+        if(!$dataArchive->canDelete()) {
1869 1869
             throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403);
1870 1870
         }
1871 1871
 
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 
1888 1888
         // Performs canView permission check by limiting visible projects
1889 1889
         $project = $this->getCurrentProject();
1890
-        if (!$project) {
1890
+        if(!$project) {
1891 1891
             return $this->project404Response();
1892 1892
         }
1893 1893
 
@@ -1925,24 +1925,24 @@  discard block
 block discarded – undo
1925 1925
 
1926 1926
         // Performs canView permission check by limiting visible projects
1927 1927
         $project = $this->getCurrentProject();
1928
-        if (!$project) {
1928
+        if(!$project) {
1929 1929
             return $this->project404Response();
1930 1930
         }
1931 1931
 
1932 1932
         $dataArchive = null;
1933 1933
 
1934
-        if (
1934
+        if(
1935 1935
             isset($data['DataArchiveID'])
1936 1936
             && is_numeric($data['DataArchiveID'])
1937 1937
         ) {
1938 1938
             $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']);
1939 1939
         }
1940 1940
 
1941
-        if (!$dataArchive) {
1941
+        if(!$dataArchive) {
1942 1942
             throw new LogicException('Invalid data archive');
1943 1943
         }
1944 1944
 
1945
-        if (!$dataArchive->canDelete()) {
1945
+        if(!$dataArchive->canDelete()) {
1946 1946
             throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403);
1947 1947
         }
1948 1948
 
@@ -1966,12 +1966,12 @@  discard block
 block discarded – undo
1966 1966
         /** @var DNDataArchive $dataArchive */
1967 1967
         $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));
1968 1968
 
1969
-        if (!$dataArchive) {
1969
+        if(!$dataArchive) {
1970 1970
             throw new SS_HTTPResponse_Exception('Archive not found', 404);
1971 1971
         }
1972 1972
 
1973 1973
         // We check for canDownload because that implies access to the data.
1974
-        if (!$dataArchive->canDownload()) {
1974
+        if(!$dataArchive->canDownload()) {
1975 1975
             throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403);
1976 1976
         }
1977 1977
 
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1995 1995
 
1996 1996
         $envs = $dataArchive->validTargetEnvironments();
1997
-        if (!$envs) {
1997
+        if(!$envs) {
1998 1998
             return $this->environment404Response();
1999 1999
         }
2000 2000
 
@@ -2036,25 +2036,25 @@  discard block
 block discarded – undo
2036 2036
 
2037 2037
         // Performs canView permission check by limiting visible projects
2038 2038
         $project = $this->getCurrentProject();
2039
-        if (!$project) {
2039
+        if(!$project) {
2040 2040
             return $this->project404Response();
2041 2041
         }
2042 2042
 
2043 2043
         /** @var DNDataArchive $dataArchive */
2044 2044
         $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']);
2045
-        if (!$dataArchive) {
2045
+        if(!$dataArchive) {
2046 2046
             throw new LogicException('Invalid data archive');
2047 2047
         }
2048 2048
 
2049 2049
         // We check for canDownload because that implies access to the data.
2050
-        if (!$dataArchive->canDownload()) {
2050
+        if(!$dataArchive->canDownload()) {
2051 2051
             throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403);
2052 2052
         }
2053 2053
 
2054 2054
         // Validate $data['EnvironmentID'] by checking against $validEnvs.
2055 2055
         $validEnvs = $dataArchive->validTargetEnvironments();
2056 2056
         $environment = $validEnvs->find('ID', $data['EnvironmentID']);
2057
-        if (!$environment) {
2057
+        if(!$environment) {
2058 2058
             throw new LogicException('Invalid environment');
2059 2059
         }
2060 2060
 
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
     {
2074 2074
         try {
2075 2075
             Resque::queues();
2076
-        } catch (Exception $e) {
2076
+        } catch(Exception $e) {
2077 2077
             return $e->getMessage();
2078 2078
         }
2079 2079
         return '';
@@ -2140,10 +2140,10 @@  discard block
 block discarded – undo
2140 2140
     public function getCurrentProject()
2141 2141
     {
2142 2142
         $projectName = trim($this->getRequest()->param('Project'));
2143
-        if (!$projectName) {
2143
+        if(!$projectName) {
2144 2144
             return null;
2145 2145
         }
2146
-        if (empty(self::$_project_cache[$projectName])) {
2146
+        if(empty(self::$_project_cache[$projectName])) {
2147 2147
             self::$_project_cache[$projectName] = $this->DNProjectList()->filter('Name', $projectName)->First();
2148 2148
         }
2149 2149
         return self::$_project_cache[$projectName];
@@ -2155,14 +2155,14 @@  discard block
 block discarded – undo
2155 2155
      */
2156 2156
     public function getCurrentEnvironment(DNProject $project = null)
2157 2157
     {
2158
-        if ($this->getRequest()->param('Environment') === null) {
2158
+        if($this->getRequest()->param('Environment') === null) {
2159 2159
             return null;
2160 2160
         }
2161
-        if ($project === null) {
2161
+        if($project === null) {
2162 2162
             $project = $this->getCurrentProject();
2163 2163
         }
2164 2164
         // project can still be null
2165
-        if ($project === null) {
2165
+        if($project === null) {
2166 2166
             return null;
2167 2167
         }
2168 2168
         return $project->DNEnvironmentList()->filter('Name', $this->getRequest()->param('Environment'))->First();
@@ -2204,23 +2204,23 @@  discard block
 block discarded – undo
2204 2204
      */
2205 2205
     public function CanViewArchives(Member $member = null)
2206 2206
     {
2207
-        if ($member === null) {
2207
+        if($member === null) {
2208 2208
             $member = Member::currentUser();
2209 2209
         }
2210 2210
 
2211
-        if (Permission::checkMember($member, 'ADMIN')) {
2211
+        if(Permission::checkMember($member, 'ADMIN')) {
2212 2212
             return true;
2213 2213
         }
2214 2214
 
2215 2215
         $allProjects = $this->DNProjectList();
2216
-        if (!$allProjects) {
2216
+        if(!$allProjects) {
2217 2217
             return false;
2218 2218
         }
2219 2219
 
2220
-        foreach ($allProjects as $project) {
2221
-            if ($project->Environments()) {
2222
-                foreach ($project->Environments() as $environment) {
2223
-                    if (
2220
+        foreach($allProjects as $project) {
2221
+            if($project->Environments()) {
2222
+                foreach($project->Environments() as $environment) {
2223
+                    if(
2224 2224
                         $environment->canRestore($member) ||
2225 2225
                         $environment->canBackup($member) ||
2226 2226
                         $environment->canUploadArchive($member) ||
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
     public function CreateEnvironmentList()
2243 2243
     {
2244 2244
         $project = $this->getCurrentProject();
2245
-        if ($project) {
2245
+        if($project) {
2246 2246
             return new PaginatedList($project->CreateEnvironments()->sort("Created DESC"), $this->request);
2247 2247
         }
2248 2248
         return new PaginatedList(new ArrayList(), $this->request);
@@ -2259,9 +2259,9 @@  discard block
 block discarded – undo
2259 2259
         $archives = new ArrayList();
2260 2260
 
2261 2261
         $archiveList = $project->Environments()->relation("DataArchives");
2262
-        if ($archiveList->count() > 0) {
2263
-            foreach ($archiveList as $archive) {
2264
-                if ($archive->canView() && !$archive->isPending()) {
2262
+        if($archiveList->count() > 0) {
2263
+            foreach($archiveList as $archive) {
2264
+                if($archive->canView() && !$archive->isPending()) {
2265 2265
                     $archives->push($archive);
2266 2266
                 }
2267 2267
             }
@@ -2277,9 +2277,9 @@  discard block
 block discarded – undo
2277 2277
     {
2278 2278
         $project = $this->getCurrentProject();
2279 2279
         $archives = new ArrayList();
2280
-        foreach ($project->DNEnvironmentList() as $env) {
2281
-            foreach ($env->DataArchives() as $archive) {
2282
-                if ($archive->canView() && $archive->isPending()) {
2280
+        foreach($project->DNEnvironmentList() as $env) {
2281
+            foreach($env->DataArchives() as $archive) {
2282
+                if($archive->canView() && $archive->isPending()) {
2283 2283
                     $archives->push($archive);
2284 2284
                 }
2285 2285
             }
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
     {
2295 2295
         $project = $this->getCurrentProject();
2296 2296
 
2297
-        $transfers = DNDataTransfer::get()->filterByCallback(function ($record) use ($project) {
2297
+        $transfers = DNDataTransfer::get()->filterByCallback(function($record) use ($project) {
2298 2298
             return
2299 2299
                 $record->Environment()->Project()->ID == $project->ID && // Ensure only the current Project is shown
2300 2300
                 (
@@ -2313,9 +2313,9 @@  discard block
 block discarded – undo
2313 2313
      */
2314 2314
     public function DeployHistory()
2315 2315
     {
2316
-        if ($env = $this->getCurrentEnvironment()) {
2316
+        if($env = $this->getCurrentEnvironment()) {
2317 2317
             $history = $env->DeployHistory();
2318
-            if ($history->count() > 0) {
2318
+            if($history->count() > 0) {
2319 2319
                 $pagination = new PaginatedList($history, $this->getRequest());
2320 2320
                 $pagination->setPageLength(8);
2321 2321
                 return $pagination;
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
         $sendJSON = (strpos($this->getRequest()->getHeader('Accept'), 'application/json') !== false)
2359 2359
             || $this->getRequest()->getExtension() == 'json';
2360 2360
 
2361
-        if (!$sendJSON) {
2361
+        if(!$sendJSON) {
2362 2362
             $this->response->addHeader("Content-type", "text/plain");
2363 2363
             return $content;
2364 2364
         }
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
      */
2377 2377
     protected function validateSnapshotMode($mode)
2378 2378
     {
2379
-        if (!in_array($mode, array('all', 'assets', 'db'))) {
2379
+        if(!in_array($mode, array('all', 'assets', 'db'))) {
2380 2380
             throw new LogicException('Invalid mode');
2381 2381
         }
2382 2382
     }
@@ -2391,12 +2391,12 @@  discard block
 block discarded – undo
2391 2391
     {
2392 2392
         // Performs canView permission check by limiting visible projects
2393 2393
         $project = $this->getCurrentProject();
2394
-        if (!$project) {
2394
+        if(!$project) {
2395 2395
             return $this->project404Response();
2396 2396
         }
2397 2397
         $data[$sectionName] = 1;
2398 2398
 
2399
-        if ($this !== '') {
2399
+        if($this !== '') {
2400 2400
             $data['Title'] = $title;
2401 2401
         }
2402 2402
 
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
     {
2413 2413
         $list = new ArrayList();
2414 2414
 
2415
-        if (Member::currentUserID()) {
2415
+        if(Member::currentUserID()) {
2416 2416
             $list->push(new ArrayData(array(
2417 2417
                 'Classes' => 'logout',
2418 2418
                 'FaIcon' => 'sign-out',
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
      */
2435 2435
     public function createproject(SS_HTTPRequest $request)
2436 2436
     {
2437
-        if ($this->canCreateProjects()) {
2437
+        if($this->canCreateProjects()) {
2438 2438
             return $this->render(['CurrentTitle' => 'Create Stack']);
2439 2439
         }
2440 2440
         return $this->httpError(403);
@@ -2447,10 +2447,10 @@  discard block
 block discarded – undo
2447 2447
      */
2448 2448
     public function canCreateProjects($member = null)
2449 2449
     {
2450
-        if (!$member) {
2450
+        if(!$member) {
2451 2451
             $member = Member::currentUser();
2452 2452
         }
2453
-        if (!$member) {
2453
+        if(!$member) {
2454 2454
             return false;
2455 2455
         }
2456 2456
 
@@ -2515,11 +2515,11 @@  discard block
 block discarded – undo
2515 2515
         $form->saveInto($project);
2516 2516
         $this->extend('onBeforeCreateProject', $project, $data, $form);
2517 2517
         try {
2518
-            if ($project->write() > 0) {
2518
+            if($project->write() > 0) {
2519 2519
                 $this->extend('onAfterCreateProject', $project, $data, $form);
2520 2520
 
2521 2521
                 // If an extension hasn't redirected us, we'll redirect to the project.
2522
-                if (!$this->redirectedTo()) {
2522
+                if(!$this->redirectedTo()) {
2523 2523
                     return $this->redirect($project->Link());
2524 2524
                 } else {
2525 2525
                     return $this->response;
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
             } else {
2528 2528
                 $form->sessionMessage('Unable to write the stack to the database.', 'bad');
2529 2529
             }
2530
-        } catch (ValidationException $e) {
2530
+        } catch(ValidationException $e) {
2531 2531
             $form->sessionMessage($e->getMessage(), 'bad');
2532 2532
         }
2533 2533
         return $this->redirectBack();
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
     public function createprojectprogress(SS_HTTPRequest $request)
2544 2544
     {
2545 2545
         $project = $this->getCurrentProject();
2546
-        if (!$project) {
2546
+        if(!$project) {
2547 2547
             return $this->httpError(404);
2548 2548
         }
2549 2549
 
@@ -2551,13 +2551,13 @@  discard block
 block discarded – undo
2551 2551
         $complete = array();
2552 2552
         $inProgress = array();
2553 2553
         $failed = array();
2554
-        if ($envCreations->count() > 0) {
2555
-            foreach ($envCreations as $env) {
2554
+        if($envCreations->count() > 0) {
2555
+            foreach($envCreations as $env) {
2556 2556
                 $data = unserialize($env->Data);
2557
-                if (!isset($data['Name'])) {
2557
+                if(!isset($data['Name'])) {
2558 2558
                     $data['Name'] = 'Unknown';
2559 2559
                 }
2560
-                switch ($env->ResqueStatus()) {
2560
+                switch($env->ResqueStatus()) {
2561 2561
                     case "Queued":
2562 2562
                     case "Running":
2563 2563
                         $inProgress[$env->ID] = Convert::raw2xml($env->ResqueStatus());
@@ -2594,17 +2594,17 @@  discard block
 block discarded – undo
2594 2594
     public function checkrepoaccess(SS_HTTPRequest $request)
2595 2595
     {
2596 2596
         $project = $this->getCurrentProject();
2597
-        if (!$project) {
2597
+        if(!$project) {
2598 2598
             return $this->httpError(404);
2599 2599
         }
2600 2600
 
2601
-        if ($project->CVSPath) {
2601
+        if($project->CVSPath) {
2602 2602
             $fetch = new FetchJob();
2603 2603
             $fetch->args = array('projectID' => $project->ID);
2604 2604
             try {
2605 2605
                 $fetch->perform();
2606 2606
                 $canAccessRepo = true;
2607
-            } catch (RuntimeException $e) {
2607
+            } catch(RuntimeException $e) {
2608 2608
                 $canAccessRepo = false;
2609 2609
             }
2610 2610
             $data = ['canAccessRepo' => $canAccessRepo];
Please login to merge, or discard this patch.
code/control/DeployForm.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     protected function validateCommit($sha, $field)
32 32
     {
33 33
         // Check selected commit
34
-        if (empty($sha)) {
34
+        if(empty($sha)) {
35 35
             $this->validationError(
36 36
                 $field,
37 37
                 "No valid release selected",
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         }
42 42
 
43 43
         // Check validity of commit
44
-        if (!preg_match('/^[a-f0-9]{40}$/', $sha)) {
44
+        if(!preg_match('/^[a-f0-9]{40}$/', $sha)) {
45 45
             $this->validationError(
46 46
                 $field,
47 47
                 "Invalid release SHA: " . Convert::raw2xml($sha),
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function php($data)
67 67
     {
68 68
         // Check release method
69
-        if (empty($data['SelectRelease'])
69
+        if(empty($data['SelectRelease'])
70 70
             || !in_array($data['SelectRelease'], array('Tag', 'Branch', 'Redeploy', 'SHA', 'FilteredCommits'))
71 71
         ) {
72 72
             $method = empty($data['SelectRelease']) ? '(blank)' : $data['SelectRelease'];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function __construct($controller, $name, DNEnvironment $environment, DNProject $project)
123 123
     {
124
-        if ($environment->HasPipelineSupport()) {
124
+        if($environment->HasPipelineSupport()) {
125 125
             list($field, $validator, $actions) = $this->setupPipeline($environment, $project);
126 126
         } else {
127 127
             list($field, $validator, $actions) = $this->setupSimpleDeploy($project);
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
         $canBypass = Permission::check(DNRoot::DEPLOYNAUT_BYPASS_PIPELINE);
160 160
         $canDryrun = $environment->DryRunEnabled && Permission::check(DNRoot::DEPLOYNAUT_DRYRUN_PIPELINE);
161 161
         $commits = $environment->getDependentFilteredCommits();
162
-        if (empty($commits)) {
162
+        if(empty($commits)) {
163 163
             // There are no filtered commits, so show all commits
164 164
             $field = $this->buildCommitSelector($project);
165 165
             $validator = new DeployForm_CommitValidator();
166
-        } elseif ($canBypass) {
166
+        } elseif($canBypass) {
167 167
             // Build hybrid selector that allows users to follow pipeline or use any commit
168 168
             $field = $this->buildCommitSelector($project, $commits);
169 169
             $validator = new DeployForm_CommitValidator();
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 ->addExtraClass('btn btn-primary')
180 180
                 ->setAttribute('onclick', "return confirm('This will begin a release pipeline. Continue?');")
181 181
         );
182
-        if ($canDryrun) {
182
+        if($canDryrun) {
183 183
             $actions->push(
184 184
                 FormAction::create('doDryRun', "Dry-run release process")
185 185
                     ->addExtraClass('btn btn-info')
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                     )
193 193
             );
194 194
         }
195
-        if ($canBypass) {
195
+        if($canBypass) {
196 196
             $actions->push(
197 197
                 FormAction::create('showDeploySummary', "Direct deployment (bypass pipeline)")
198 198
                     ->addExtraClass('btn btn-warning')
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     {
219 219
         // Branches
220 220
         $branches = array();
221
-        foreach ($project->DNBranchList() as $branch) {
221
+        foreach($project->DNBranchList() as $branch) {
222 222
             $sha = $branch->SHA();
223 223
             $name = $branch->Name();
224 224
             $branchValue = sprintf("%s (%s, %s old)",
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
         // Tags
233 233
         $tags = array();
234
-        foreach ($project->DNTagList()->setLimit(null) as $tag) {
234
+        foreach($project->DNTagList()->setLimit(null) as $tag) {
235 235
             $sha = $tag->SHA();
236 236
             $name = $tag->Name();
237 237
             $tagValue = sprintf("%s (%s, %s old)",
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 
246 246
         // Past deployments
247 247
         $redeploy = array();
248
-        foreach ($project->DNEnvironmentList() as $dnEnvironment) {
248
+        foreach($project->DNEnvironmentList() as $dnEnvironment) {
249 249
             $envName = $dnEnvironment->Name;
250
-            foreach ($dnEnvironment->DeployHistory() as $deploy) {
250
+            foreach($dnEnvironment->DeployHistory() as $deploy) {
251 251
                 $sha = $deploy->SHA;
252
-                if (!isset($redeploy[$envName])) {
252
+                if(!isset($redeploy[$envName])) {
253 253
                     $redeploy[$envName] = array();
254 254
                 }
255
-                if (!isset($redeploy[$envName][$sha])) {
255
+                if(!isset($redeploy[$envName][$sha])) {
256 256
                     $pastValue = sprintf("%s (deployed %s)",
257 257
                         substr($sha, 0, 8),
258 258
                         $deploy->obj('LastEdited')->Ago()
@@ -264,28 +264,28 @@  discard block
 block discarded – undo
264 264
 
265 265
         // Merge fields
266 266
         $releaseMethods = array();
267
-        if ($pipelineCommits) {
267
+        if($pipelineCommits) {
268 268
             $releaseMethods[] = new SelectionGroup_Item(
269 269
                 'FilteredCommits',
270 270
                 $this->buildPipelineField($pipelineCommits),
271 271
                 'Deploy a commit prepared for this pipeline'
272 272
             );
273 273
         }
274
-        if (!empty($branches)) {
274
+        if(!empty($branches)) {
275 275
             $releaseMethods[] = new SelectionGroup_Item(
276 276
                 'Branch',
277 277
                 new DropdownField('Branch', 'Select a branch', $branches),
278 278
                 'Deploy the latest version of a branch'
279 279
             );
280 280
         }
281
-        if ($tags) {
281
+        if($tags) {
282 282
             $releaseMethods[] = new SelectionGroup_Item(
283 283
                 'Tag',
284 284
                 new DropdownField('Tag', 'Select a tag', $tags),
285 285
                 'Deploy a tagged release'
286 286
             );
287 287
         }
288
-        if ($redeploy) {
288
+        if($redeploy) {
289 289
             $releaseMethods[] = new SelectionGroup_Item(
290 290
                 'Redeploy',
291 291
                 new GroupedDropdownField('Redeploy', 'Redeploy', $redeploy),
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     {
315 315
         // Get filtered commits
316 316
         $filteredCommits = array();
317
-        foreach ($commits as $commit) {
317
+        foreach($commits as $commit) {
318 318
             $title = sprintf(
319 319
                 "%s (%s, %s old)",
320 320
                 $commit->Message,
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             );
324 324
             $filteredCommits[$commit->SHA] = $title;
325 325
         }
326
-        if ($filteredCommits) {
326
+        if($filteredCommits) {
327 327
             return new DropdownField('FilteredCommits', '', $filteredCommits);
328 328
         } else {
329 329
             return DropdownField::create('FilteredCommits)', '')
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function getSelectedBuild($data)
342 342
     {
343
-        if (isset($data['SelectRelease']) && !empty($data[$data['SelectRelease']])) {
343
+        if(isset($data['SelectRelease']) && !empty($data[$data['SelectRelease']])) {
344 344
             // Filter out the tag/branch name if required
345 345
             $array = explode('-', $data[$data['SelectRelease']]);
346 346
             return reset($array);
347 347
         }
348
-        if (isset($data['FilteredCommits']) && !empty($data['FilteredCommits'])) {
348
+        if(isset($data['FilteredCommits']) && !empty($data['FilteredCommits'])) {
349 349
             return $data['FilteredCommits'];
350 350
         }
351 351
     }
Please login to merge, or discard this patch.
code/control/DeploynautLogFile.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         $path = $this->getSanitisedLogFilePath();
66 66
 
67 67
         // for backwards compatibility on old logs
68
-        if (!file_exists($path)) {
68
+        if(!file_exists($path)) {
69 69
             $path = $this->getRawFilePath();
70 70
 
71
-            if (!file_exists($path)) {
71
+            if(!file_exists($path)) {
72 72
                 return null;
73 73
             }
74 74
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         // Make sure we write into the old path for existing logs. New logs use the sanitised file path instead.
86 86
         $path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath();
87 87
 
88
-        error_log('['.date('Y-m-d H:i:s').'] ' . $message .PHP_EOL, 3, $path);
88
+        error_log('[' . date('Y-m-d H:i:s') . '] ' . $message . PHP_EOL, 3, $path);
89 89
         @chmod($path, 0666);
90 90
     }
91 91
 
Please login to merge, or discard this patch.
code/control/Dispatcher.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     protected function getSecurityToken($name = null)
41 41
     {
42
-        if (is_null($name)) {
42
+        if(is_null($name)) {
43 43
             $name = sprintf('%sSecurityID', get_class($this));
44 44
         }
45 45
         return new \SecurityToken($name);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     protected function checkSecurityToken($name = null)
49 49
     {
50 50
         $postVar = is_null($name) ? 'SecurityID' : $name;
51
-        if (is_null($name)) {
51
+        if(is_null($name)) {
52 52
             $name = sprintf('%sSecurityID', get_class($this));
53 53
         }
54 54
         $securityToken = $this->getSecurityToken($name);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // By default the security token is always represented by a "SecurityID" post var,
57 57
         // even if the backend uses different names for the token. This too means only one security token
58 58
         // can be managed by one dispatcher if the default is used.
59
-        if (!$securityToken->check($this->request->postVar($postVar))) {
59
+        if(!$securityToken->check($this->request->postVar($postVar))) {
60 60
             $this->httpError(400, 'Invalid security token, try reloading the page.');
61 61
         }
62 62
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function asJSONValidatorErrors($code, $validatorErrors)
73 73
     {
74 74
         $fieldErrors = [];
75
-        foreach ($validatorErrors as $error) {
75
+        foreach($validatorErrors as $error) {
76 76
             $fieldErrors[$error['fieldName']] = $error['message'];
77 77
         }
78 78
         return $this->asJSONFormFieldErrors($code, $fieldErrors);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         // To get around that, upon spotting an active redirect, we change the response code to 200,
117 117
         // and move the redirect into the "RedirectTo" field in the JSON response. Frontend can
118 118
         // then interpret this and trigger a redirect.
119
-        if ($this->redirectedTo()) {
119
+        if($this->redirectedTo()) {
120 120
             $data['RedirectTo'] = $this->response->getHeader('Location');
121 121
             // Pop off the header - we are no longer redirecting via the usual mechanism.
122 122
             $this->response->removeHeader('Location');
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function trimWhitespace($val)
146 146
     {
147
-        if (is_array($val)) {
148
-            foreach ($val as $k => $v) {
147
+        if(is_array($val)) {
148
+            foreach($val as $k => $v) {
149 149
                 $val[$k] = $this->trimWhitespace($v);
150 150
             }
151 151
             return $val;
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function stripNonPrintables($val)
164 164
     {
165
-        if (is_array($val)) {
166
-            foreach ($val as $k => $v) {
165
+        if(is_array($val)) {
166
+            foreach($val as $k => $v) {
167 167
                 $val[$k] = $this->stripNonPrintables($v);
168 168
             }
169 169
             return $val;
Please login to merge, or discard this patch.
code/control/EmailMessagingService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
     protected function sendIndividualMessages($source, $message, $recipients, $from, $subject)
46 46
     {
47 47
         // Split recipients that are comma separated
48
-        if (is_string($recipients) && stripos($recipients, ',')) {
48
+        if(is_string($recipients) && stripos($recipients, ',')) {
49 49
             $recipients = explode(',', $recipients);
50 50
             return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
51 51
         }
52 52
 
53 53
         // Iterate through arrays
54
-        if (is_array($recipients) || $recipients instanceof SS_List) {
55
-            foreach ($recipients as $recipient) {
54
+        if(is_array($recipients) || $recipients instanceof SS_List) {
55
+            foreach($recipients as $recipient) {
56 56
                 $this->sendIndividualMessages($source, $message, $recipient, $from, $subject);
57 57
             }
58 58
             return true;
59 59
         }
60 60
 
61
-        if ($recipients) {
61
+        if($recipients) {
62 62
             $this->sendMessageTo($source, $from, $recipients, $subject, $message);
63 63
             return true;
64 64
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     protected function sendMessageTo($source, $from, $to, $subject, $body)
81 81
     {
82
-        if ($to instanceof Member) {
82
+        if($to instanceof Member) {
83 83
             $to = $to->Email;
84 84
         }
85 85
         $this->sendViaEmail($source, $from, $to, $subject, $body);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     protected function sendViaEmail($source, $from, $to, $subject, $body)
98 98
     {
99 99
         $email = new Email($from, $to, $subject, $body);
100
-        if ($source->getDryRun()) {
100
+        if($source->getDryRun()) {
101 101
             $source->log("[Skipped] Sent message to $to (subject: $subject)");
102 102
         } else {
103 103
             $email->sendPlain();
Please login to merge, or discard this patch.
code/control/PipelineController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function log()
37 37
     {
38 38
         $log = $this->pipeline->getLogger();
39
-        if ($log->exists()) {
39
+        if($log->exists()) {
40 40
             $content = $log->content();
41 41
         } else {
42 42
             $content = 'Waiting for action to start';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             || $this->request->getExtension() == 'json';
47 47
 
48 48
         $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
49
-        if ($sendJSON) {
49
+        if($sendJSON) {
50 50
             $this->response->addHeader("Content-type", "application/json");
51 51
             return json_encode(array(
52 52
                 'status' => $this->pipeline->Status,
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function abort()
65 65
     {
66
-        if ($this->pipeline->canAbort()) {
66
+        if($this->pipeline->canAbort()) {
67 67
             $this->pipeline->markAborted();
68 68
         }
69 69
         return $this->redirect($this->pipeline->Environment()->Link());
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $step = $this->pipeline->CurrentStep();
79 79
 
80 80
         // Check if the action is available on this step
81
-        if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
81
+        if($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
82 82
             // Execute this action, allowing it to override the httpresponse given
83 83
             $step->$action();
84 84
         }
Please login to merge, or discard this patch.
code/events/GenericEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
      */
76 76
     public function get($keyname)
77 77
     {
78
-        if (array_key_exists($keyname, $this->data)) {
78
+        if(array_key_exists($keyname, $this->data)) {
79 79
             return $this->data[$keyname];
80 80
         }
81 81
         return '';
Please login to merge, or discard this patch.
code/extensions/DeploynautFileExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
         $file = $this->owner;
14 14
         $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
15 15
 
16
-        if ($archive) {
16
+        if($archive) {
17 17
             return $archive->canDownload($member);
18 18
         }
19 19
 
Please login to merge, or discard this patch.