Completed
Pull Request — master (#489)
by Helpful
03:51
created
code/model/DNTag.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Gitonomy\Git\Reference\Tag;
4 4
 
5
-class DNTag extends ViewableData
6
-{
5
+class DNTag extends ViewableData {
7 6
 
8 7
     /**
9 8
      * @var Gitonomy\Git\Reference\Tag
@@ -28,8 +27,7 @@  discard block
 block discarded – undo
28 27
      * @param DNProject $project
29 28
      * @param DNData $data
30 29
      */
31
-    public function __construct(Tag $tag, DNProject $project, DNData $data)
32
-    {
30
+    public function __construct(Tag $tag, DNProject $project, DNData $data) {
33 31
         $this->tag = $tag;
34 32
         $this->project = $project;
35 33
         $this->data = $data;
@@ -38,24 +36,21 @@  discard block
 block discarded – undo
38 36
     /**
39 37
      * @return string
40 38
      */
41
-    public function Name()
42
-    {
39
+    public function Name() {
43 40
         return htmlentities($this->tag->getName());
44 41
     }
45 42
 
46 43
     /**
47 44
      * @return string
48 45
      */
49
-    public function SHA()
50
-    {
46
+    public function SHA() {
51 47
         return htmlentities($this->tag->getCommitHash());
52 48
     }
53 49
 
54 50
     /**
55 51
      * @return SS_Datetime
56 52
      */
57
-    public function Created()
58
-    {
53
+    public function Created() {
59 54
         $created = $this->tag->getCommit()->getCommitterDate();
60 55
 
61 56
         // gitonomy sets the time to UTC, so now we set the timezone to
Please login to merge, or discard this patch.
code/model/GitonomyCache.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,10 @@
 block discarded – undo
3 3
 /**
4 4
  * Helper class caching expensive gitonomy calls
5 5
  */
6
-class GitonomyCache
7
-{
6
+class GitonomyCache {
8 7
     public static $cache = array();
9 8
 
10
-    public static function getIncludingBranches($commit)
11
-    {
9
+    public static function getIncludingBranches($commit) {
12 10
         $cacheKey = 'getIncludingBranches-' . $commit->getRepository()->getPath() . '-' . $commit->gethash();
13 11
         if (!isset(self::$cache[$cacheKey])) {
14 12
             self::$cache[$cacheKey] = $commit->getIncludingBranches();
Please login to merge, or discard this patch.
code/model/Pipeline.php 1 patch
Braces   +44 added lines, -88 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @method HasManyList Steps()
113 113
  */
114
-class Pipeline extends DataObject implements PipelineData
115
-{
114
+class Pipeline extends DataObject implements PipelineData {
116 115
 
117 116
     /**
118 117
      * Messages
@@ -212,21 +211,18 @@  discard block
 block discarded – undo
212 211
     /**
213 212
      * @param ConfirmationMessagingService $service
214 213
      */
215
-    public function setMessagingService(ConfirmationMessagingService $service)
216
-    {
214
+    public function setMessagingService(ConfirmationMessagingService $service) {
217 215
         $this->messagingService = $service;
218 216
     }
219 217
 
220 218
     /**
221 219
      * @return ConfirmationMessagingService
222 220
      */
223
-    public function getMessagingService()
224
-    {
221
+    public function getMessagingService() {
225 222
         return $this->messagingService;
226 223
     }
227 224
 
228
-    public function __isset($property)
229
-    {
225
+    public function __isset($property) {
230 226
         // Workaround fixed in https://github.com/silverstripe/silverstripe-framework/pull/3201
231 227
         // Remove this once we update to a version of framework which supports this
232 228
         if ($property === 'MessagingService') {
@@ -240,8 +236,7 @@  discard block
 block discarded – undo
240 236
      *
241 237
      * @return array
242 238
      */
243
-    public function getReplacements()
244
-    {
239
+    public function getReplacements() {
245 240
         // Get member who began this request
246 241
         $author = $this->Author();
247 242
         $environment = $this->Environment();
@@ -261,16 +256,14 @@  discard block
 block discarded – undo
261 256
      *
262 257
      * @return string
263 258
      */
264
-    public function getTitle()
265
-    {
259
+    public function getTitle() {
266 260
         return "Pipeline {$this->ID} (Status: {$this->Status})";
267 261
     }
268 262
 
269 263
     /**
270 264
      * @param Member $member
271 265
      */
272
-    public function canAbort($member = null)
273
-    {
266
+    public function canAbort($member = null) {
274 267
         // Owner can abort
275 268
         $member = $member ?: Member::currentUser();
276 269
         if (!$member) {
@@ -289,8 +282,7 @@  discard block
 block discarded – undo
289 282
      *
290 283
      * @return string Status description (html format)
291 284
      */
292
-    public function getRunningDescription()
293
-    {
285
+    public function getRunningDescription() {
294 286
         if (!$this->isActive()) {
295 287
             return 'This pipeline is not currently running';
296 288
         }
@@ -306,8 +298,7 @@  discard block
 block discarded – undo
306 298
      *
307 299
      * @return ArrayList List of items with a Link and Title attribute
308 300
      */
309
-    public function RunningOptions()
310
-    {
301
+    public function RunningOptions() {
311 302
         if (!$this->isActive()) {
312 303
             return null;
313 304
         }
@@ -325,8 +316,7 @@  discard block
 block discarded – undo
325 316
      *
326 317
      * @return ArrayList List of logs with a Link and Title attribute
327 318
      */
328
-    public function LogOptions()
329
-    {
319
+    public function LogOptions() {
330 320
         if (!$this->isActive()) {
331 321
             return null;
332 322
         }
@@ -390,8 +380,7 @@  discard block
 block discarded – undo
390 380
      * @return array
391 381
      * @throws Exception
392 382
      */
393
-    public function getConfigData()
394
-    {
383
+    public function getConfigData() {
395 384
         // Lazy load if necessary
396 385
         $data = null;
397 386
         if (!$this->Config && ($data = $this->Environment()->loadPipelineConfig())) {
@@ -414,8 +403,7 @@  discard block
 block discarded – undo
414 403
         throw new Exception(sprintf('YAML configuration for pipeline not found at path "%s"', $path));
415 404
     }
416 405
 
417
-    public function setConfig($data)
418
-    {
406
+    public function setConfig($data) {
419 407
         $this->mergedConfig = null;
420 408
         return parent::setField('Config', $data);
421 409
     }
@@ -426,8 +414,7 @@  discard block
 block discarded – undo
426 414
      * @param string $setting Settings
427 415
      * @return mixed Value of setting, or null if not set
428 416
      */
429
-    public function getConfigSetting($setting)
430
-    {
417
+    public function getConfigSetting($setting) {
431 418
         $source = $this->getConfigData();
432 419
 
433 420
         foreach (func_get_args() as $setting) {
@@ -443,8 +430,7 @@  discard block
 block discarded – undo
443 430
     /**
444 431
      * @return FieldList
445 432
      */
446
-    public function getCMSFields()
447
-    {
433
+    public function getCMSFields() {
448 434
         $fields = new FieldList(new TabSet('Root'));
449 435
 
450 436
         // Main fields
@@ -505,8 +491,7 @@  discard block
 block discarded – undo
505 491
      *
506 492
      * @return DNEnvironment
507 493
      */
508
-    public function getDependentEnvironment()
509
-    {
494
+    public function getDependentEnvironment() {
510 495
         // dependent environment not available
511 496
         $projectName = $this->getConfigSetting('PipelineConfig', 'DependsOnProject');
512 497
         $environmentName = $this->getConfigSetting('PipelineConfig', 'DependsOnEnvironment');
@@ -544,8 +529,7 @@  discard block
 block discarded – undo
544 529
      * @param int $order
545 530
      * @return PipelineStep
546 531
      */
547
-    protected function generateStep($name, $stepConfig, $order = 0)
548
-    {
532
+    protected function generateStep($name, $stepConfig, $order = 0) {
549 533
         $stepClass = isset($stepConfig['Class']) ? $stepConfig['Class'] : $stepConfig;
550 534
 
551 535
         if (empty($stepClass)) {
@@ -583,8 +567,7 @@  discard block
 block discarded – undo
583 567
      * @throws LogicException
584 568
      * @return boolean
585 569
      */
586
-    public function start()
587
-    {
570
+    public function start() {
588 571
         // Ensure there are no other running {@link Pipeline} objects for this {@link DNEnvironment}
589 572
         // Requires that $this->EnvironmentID has been set
590 573
         $env = $this->Environment();
@@ -614,8 +597,7 @@  discard block
 block discarded – undo
614 597
     /**
615 598
      * Mark this Pipeline as completed.
616 599
      */
617
-    public function markComplete()
618
-    {
600
+    public function markComplete() {
619 601
         $this->Status = "Complete";
620 602
         $this->log("Pipeline completed successfully.");
621 603
         $this->write();
@@ -628,8 +610,7 @@  discard block
 block discarded – undo
628 610
     /**
629 611
      * @return bool true if this Pipeline has successfully completed all {@link PipelineStep} steps already.
630 612
      */
631
-    public function isComplete()
632
-    {
613
+    public function isComplete() {
633 614
         return $this->Status == "Complete";
634 615
     }
635 616
 
@@ -638,8 +619,7 @@  discard block
 block discarded – undo
638 619
      *
639 620
      * @return bool
640 621
      */
641
-    public function isRunning()
642
-    {
622
+    public function isRunning() {
643 623
         return $this->Status == "Running";
644 624
     }
645 625
 
@@ -648,8 +628,7 @@  discard block
 block discarded – undo
648 628
      *
649 629
      * @return bool
650 630
      */
651
-    public function isActive()
652
-    {
631
+    public function isActive() {
653 632
         return $this->isRunning() || $this->isRollback();
654 633
     }
655 634
 
@@ -660,8 +639,7 @@  discard block
 block discarded – undo
660 639
      * @param array $stepConfig
661 640
      * @return PipelineStep
662 641
      */
663
-    private function pushPipelineStep($name, $stepConfig)
664
-    {
642
+    private function pushPipelineStep($name, $stepConfig) {
665 643
         $lastStep = $this->Steps()->sort("Order DESC")->first();
666 644
         $order = $lastStep ? $lastStep->Order + 1 : 1;
667 645
         return $this->generateStep($name, $stepConfig, $order);
@@ -670,8 +648,7 @@  discard block
 block discarded – undo
670 648
     /**
671 649
      * The rollback has finished - close the pipeline and send relevant messages.
672 650
      */
673
-    protected function finaliseRollback()
674
-    {
651
+    protected function finaliseRollback() {
675 652
 
676 653
         // Figure out the status by inspecting specific rollback steps.
677 654
         $success = true;
@@ -701,8 +678,7 @@  discard block
 block discarded – undo
701 678
     /**
702 679
      * Initiate a rollback. Moves the pipeline to the 'Rollback' status.
703 680
      */
704
-    protected function beginRollback()
705
-    {
681
+    protected function beginRollback() {
706 682
         $this->log("Beginning rollback...");
707 683
         $this->sendMessage(self::ALERT_ROLLBACK_STARTED);
708 684
 
@@ -731,8 +707,7 @@  discard block
 block discarded – undo
731 707
      *
732 708
      * @return boolean
733 709
      */
734
-    protected function canStartRollback()
735
-    {
710
+    protected function canStartRollback() {
736 711
         // The rollback cannot run twice.
737 712
         if ($this->isRollback()) {
738 713
             return false;
@@ -765,8 +740,7 @@  discard block
 block discarded – undo
765 740
      *
766 741
      * @param bool $notify Set to false to disable notifications for this failure
767 742
      */
768
-    public function markFailed($notify = true)
769
-    {
743
+    public function markFailed($notify = true) {
770 744
         // Abort all running or queued steps.
771 745
         $steps = $this->Steps();
772 746
         foreach ($steps as $step) {
@@ -793,24 +767,21 @@  discard block
 block discarded – undo
793 767
     /**
794 768
      * @return bool true if this Pipeline failed to execute all {@link PipelineStep} steps successfully
795 769
      */
796
-    public function isFailed()
797
-    {
770
+    public function isFailed() {
798 771
         return $this->Status == "Failed";
799 772
     }
800 773
 
801 774
     /**
802 775
      * @return bool true if this Pipeline is rolling back.
803 776
      */
804
-    public function isRollback()
805
-    {
777
+    public function isRollback() {
806 778
         return $this->Status == "Rollback";
807 779
     }
808 780
 
809 781
     /**
810 782
      * Mark this Pipeline as aborted
811 783
      */
812
-    public function markAborted()
813
-    {
784
+    public function markAborted() {
814 785
         $this->Status = 'Aborted';
815 786
         $logMessage = sprintf(
816 787
             "Pipeline processing aborted. %s (%s) aborted the pipeline",
@@ -838,8 +809,7 @@  discard block
 block discarded – undo
838 809
      * @param string $messageID Message ID
839 810
      * @return array Resulting array(subject, message)
840 811
      */
841
-    protected function generateMessageTemplate($messageID)
842
-    {
812
+    protected function generateMessageTemplate($messageID) {
843 813
         $subject = $this->getConfigSetting('PipelineConfig', 'Subjects', $messageID);
844 814
         $message = $this->getConfigSetting('PipelineConfig', 'Messages', $messageID);
845 815
         $substitutions = $this->getReplacements();
@@ -854,8 +824,7 @@  discard block
 block discarded – undo
854 824
      * @param array $substitutions
855 825
      * @return array Resulting array(subject, message)
856 826
      */
857
-    public function injectMessageReplacements($message, $subject, $substitutions)
858
-    {
827
+    public function injectMessageReplacements($message, $subject, $substitutions) {
859 828
         // Handle empty messages
860 829
         if (empty($subject) && empty($message)) {
861 830
             return array(null, null);
@@ -883,8 +852,7 @@  discard block
 block discarded – undo
883 852
      * @param string $messageID Message ID. One of 'Abort', 'Success', or 'Failure', or some custom message
884 853
      * @return boolean|null True if successful
885 854
      */
886
-    public function sendMessage($messageID)
887
-    {
855
+    public function sendMessage($messageID) {
888 856
         // Check message, subject, and additional arguments to include
889 857
         list($subject, $message) = $this->generateMessageTemplate($messageID);
890 858
         if (empty($subject) || empty($message)) {
@@ -924,8 +892,7 @@  discard block
 block discarded – undo
924 892
     /**
925 893
      * @return bool true if this Pipeline has been aborted
926 894
      */
927
-    public function isAborted()
928
-    {
895
+    public function isAborted() {
929 896
         return $this->Status === "Aborted";
930 897
     }
931 898
 
@@ -940,8 +907,7 @@  discard block
 block discarded – undo
940 907
      *
941 908
      * If the Pipeline has run out of steps, then it will mark the pipeline as completed.
942 909
      */
943
-    public function checkPipelineStatus()
944
-    {
910
+    public function checkPipelineStatus() {
945 911
         $message = "";
946 912
 
947 913
         if (!$this->isActive()) {
@@ -1035,8 +1001,7 @@  discard block
 block discarded – undo
1035 1001
      *
1036 1002
      * @return DataObject|null The next step in the pipeline, or null if none remain.
1037 1003
      */
1038
-    protected function findNextStep()
1039
-    {
1004
+    protected function findNextStep() {
1040 1005
         // otherwise get next step in chain
1041 1006
         $currentStep = $this->CurrentStep();
1042 1007
 
@@ -1054,8 +1019,7 @@  discard block
 block discarded – undo
1054 1019
      *
1055 1020
      * @return DataObject|null The previous step in the pipeline, or null if this is the first.
1056 1021
      */
1057
-    public function findPreviousStep()
1058
-    {
1022
+    public function findPreviousStep() {
1059 1023
         // otherwise get previous step in chain
1060 1024
         $currentStep = $this->CurrentStep();
1061 1025
 
@@ -1079,8 +1043,7 @@  discard block
 block discarded – undo
1079 1043
      * @param string $message The message to log
1080 1044
      * @throws LogicException Thrown if we can't log yet because we don't know what to log to (no db record yet).
1081 1045
      */
1082
-    public function log($message = "")
1083
-    {
1046
+    public function log($message = "") {
1084 1047
         $log = $this->getLogger();
1085 1048
 
1086 1049
         // Taken from Debug::caller(), amended for our purposes to filter out the intermediate call to
@@ -1116,8 +1079,7 @@  discard block
 block discarded – undo
1116 1079
      * @return DeploynautLogFile
1117 1080
      * @throws RuntimeException
1118 1081
      */
1119
-    public function getLogger()
1120
-    {
1082
+    public function getLogger() {
1121 1083
         if (!$this->isInDB()) {
1122 1084
             throw new RuntimeException("Can't write to a log file until we know the database ID.");
1123 1085
         }
@@ -1139,8 +1101,7 @@  discard block
 block discarded – undo
1139 1101
     /**
1140 1102
      * @return bool
1141 1103
      */
1142
-    public function getDryRun()
1143
-    {
1104
+    public function getDryRun() {
1144 1105
         return $this->getField('DryRun');
1145 1106
     }
1146 1107
 
@@ -1149,8 +1110,7 @@  discard block
 block discarded – undo
1149 1110
      *
1150 1111
      * @return string
1151 1112
      */
1152
-    public function Link($action = null)
1153
-    {
1113
+    public function Link($action = null) {
1154 1114
         return Controller::join_links($this->Environment()->Link(), 'pipeline', $this->ID, $action);
1155 1115
     }
1156 1116
 
@@ -1160,32 +1120,28 @@  discard block
 block discarded – undo
1160 1120
      * @param string|null $action
1161 1121
      * @return string
1162 1122
      */
1163
-    public function StepLink($action = null)
1164
-    {
1123
+    public function StepLink($action = null) {
1165 1124
         return Controller::join_links($this->Link('step'), $action);
1166 1125
     }
1167 1126
 
1168 1127
     /**
1169 1128
      * @return string
1170 1129
      */
1171
-    public function AbortLink()
1172
-    {
1130
+    public function AbortLink() {
1173 1131
         return $this->Link('abort');
1174 1132
     }
1175 1133
 
1176 1134
     /**
1177 1135
      * @return string
1178 1136
      */
1179
-    public function LogLink()
1180
-    {
1137
+    public function LogLink() {
1181 1138
         return $this->Link('log');
1182 1139
     }
1183 1140
 
1184 1141
     /**
1185 1142
      * @return string
1186 1143
      */
1187
-    public function LogContent()
1188
-    {
1144
+    public function LogContent() {
1189 1145
         if ($this->exists() && $this->Environment()) {
1190 1146
             $logger = $this->getLogger();
1191 1147
             if ($logger->exists()) {
Please login to merge, or discard this patch.
code/model/PipelineData.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-interface PipelineData
4
-{
3
+interface PipelineData {
5 4
 
6 5
     /**
7 6
      * Is this a dry run?
Please login to merge, or discard this patch.
code/model/jobs/DNCreateEnvironment.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  * @method Member Creator()
14 14
  * @property int $CreatorID
15 15
  */
16
-class DNCreateEnvironment extends DataObject
17
-{
16
+class DNCreateEnvironment extends DataObject {
18 17
 
19 18
     /**
20 19
      * @var array
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
      * @param int $int
40 39
      * @return string
41 40
      */
42
-    public static function map_resque_status($int)
43
-    {
41
+    public static function map_resque_status($int) {
44 42
         $remap = array(
45 43
             Resque_Job_Status::STATUS_WAITING => "Queued",
46 44
             Resque_Job_Status::STATUS_RUNNING => "Running",
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
     /**
55 53
      * @return string
56 54
      */
57
-    public function Name()
58
-    {
55
+    public function Name() {
59 56
         $data = unserialize($this->Data);
60 57
         return !empty($data['Name']) ? Convert::raw2xml($data['Name']) : '';
61 58
     }
@@ -63,24 +60,21 @@  discard block
 block discarded – undo
63 60
     /**
64 61
      * @return string
65 62
      */
66
-    public function Link()
67
-    {
63
+    public function Link() {
68 64
         return Controller::join_links($this->Project()->Link(), 'createenv', $this->ID);
69 65
     }
70 66
 
71 67
     /**
72 68
      * @return string
73 69
      */
74
-    public function LogLink()
75
-    {
70
+    public function LogLink() {
76 71
         return $this->Link() . '/log';
77 72
     }
78 73
 
79 74
     /**
80 75
      * @return boolean
81 76
      */
82
-    public function canView($member = null)
83
-    {
77
+    public function canView($member = null) {
84 78
         return $this->Project()->canView($member);
85 79
     }
86 80
 
@@ -88,8 +82,7 @@  discard block
 block discarded – undo
88 82
      * Return a path to the log file.
89 83
      * @return string
90 84
      */
91
-    protected function logfile()
92
-    {
85
+    protected function logfile() {
93 86
         return sprintf(
94 87
             '%s.createenv.%s.log',
95 88
             $this->Project()->Name,
@@ -100,13 +93,11 @@  discard block
 block discarded – undo
100 93
     /**
101 94
      * @return DeploynautLogFile
102 95
      */
103
-    public function log()
104
-    {
96
+    public function log() {
105 97
         return Injector::inst()->createWithArgs('DeploynautLogFile', array($this->logfile()));
106 98
     }
107 99
 
108
-    public function LogContent()
109
-    {
100
+    public function LogContent() {
110 101
         return $this->log()->content();
111 102
     }
112 103
 
@@ -115,8 +106,7 @@  discard block
 block discarded – undo
115 106
      *
116 107
      * @return string
117 108
      */
118
-    public function ResqueStatus()
119
-    {
109
+    public function ResqueStatus() {
120 110
         $status = new Resque_Job_Status($this->ResqueToken);
121 111
         $statusCode = $status->get();
122 112
         // The Resque job can no longer be found, fallback to the DNDeployment.Status
@@ -139,8 +129,7 @@  discard block
 block discarded – undo
139 129
      *
140 130
      * @return string Resque token
141 131
      */
142
-    protected function enqueueCreation()
143
-    {
132
+    protected function enqueueCreation() {
144 133
         $project = $this->Project();
145 134
         $log = $this->log();
146 135
 
@@ -169,8 +158,7 @@  discard block
 block discarded – undo
169 158
         return Resque::enqueue('create', 'CreateEnvJob', $args, true);
170 159
     }
171 160
 
172
-    public function start()
173
-    {
161
+    public function start() {
174 162
         $log = $this->log();
175 163
         $token = $this->enqueueCreation();
176 164
         $this->ResqueToken = $token;
@@ -181,8 +169,7 @@  discard block
 block discarded – undo
181 169
         $log->write($message);
182 170
     }
183 171
 
184
-    public function createEnvironment()
185
-    {
172
+    public function createEnvironment() {
186 173
         $backend = $this->getBackend();
187 174
         if ($backend) {
188 175
             return $backend->createEnvironment($this);
@@ -196,8 +183,7 @@  discard block
 block discarded – undo
196 183
      * @return EnvironmentCreateBackend|null
197 184
      * @throws Exception
198 185
      */
199
-    public function getBackend()
200
-    {
186
+    public function getBackend() {
201 187
         $data = unserialize($this->Data);
202 188
         if (isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) {
203 189
             $env = Injector::inst()->get($data['EnvironmentType']);
Please login to merge, or discard this patch.
code/model/jobs/DNDataTransfer.php 1 patch
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  * @method DNDataTransfer BackupDataTransfer()
32 32
  * @property int BackupDataTransferID
33 33
  */
34
-class DNDataTransfer extends DataObject
35
-{
34
+class DNDataTransfer extends DataObject {
36 35
 
37 36
     private static $db = array(
38 37
         "ResqueToken" => "Varchar(255)",
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
      * @param int $int
95 94
      * @return string
96 95
      */
97
-    public static function map_resque_status($int)
98
-    {
96
+    public static function map_resque_status($int) {
99 97
         $remap = array(
100 98
             Resque_Job_Status::STATUS_WAITING => "Queued",
101 99
             Resque_Job_Status::STATUS_RUNNING => "Running",
@@ -109,28 +107,23 @@  discard block
 block discarded – undo
109 107
     /**
110 108
      * @param boolean $value
111 109
      */
112
-    public function setBackupBeforePush($value)
113
-    {
110
+    public function setBackupBeforePush($value) {
114 111
         $this->backupBeforePush = $value;
115 112
     }
116 113
 
117
-    public function getTitle()
118
-    {
114
+    public function getTitle() {
119 115
         return $this->dbObject('Created')->Nice() . " (Status: {$this->Status})";
120 116
     }
121 117
 
122
-    public function Link()
123
-    {
118
+    public function Link() {
124 119
         return Controller::join_links($this->Environment()->Project()->Link(), 'transfer', $this->ID);
125 120
     }
126 121
 
127
-    public function LogLink()
128
-    {
122
+    public function LogLink() {
129 123
         return Controller::join_links($this->Link(), 'log');
130 124
     }
131 125
 
132
-    public function getDefaultSearchContext()
133
-    {
126
+    public function getDefaultSearchContext() {
134 127
         $context = parent::getDefaultSearchContext();
135 128
         $context->getFields()->dataFieldByName('Status')->setHasEmptyDefault(true);
136 129
         $context->getFields()->dataFieldByName('Origin')->setHasEmptyDefault(true);
@@ -138,8 +131,7 @@  discard block
 block discarded – undo
138 131
         return $context;
139 132
     }
140 133
 
141
-    public function getCMSFields()
142
-    {
134
+    public function getCMSFields() {
143 135
         $fields = parent::getCMSFields();
144 136
         $fields->removeByName('EnvironmentID');
145 137
         $fields->removeByName('ArchiveFile');
@@ -167,8 +159,7 @@  discard block
 block discarded – undo
167 159
     /**
168 160
      * Queue a transfer job
169 161
      */
170
-    public function start()
171
-    {
162
+    public function start() {
172 163
         $env = $this->Environment();
173 164
         $log = $this->log();
174 165
 
@@ -208,8 +199,7 @@  discard block
 block discarded – undo
208 199
      * @param Member|null $member
209 200
      * @return bool
210 201
      */
211
-    public function canView($member = null)
212
-    {
202
+    public function canView($member = null) {
213 203
         return $this->Environment()->canView($member);
214 204
     }
215 205
 
@@ -217,8 +207,7 @@  discard block
 block discarded – undo
217 207
      * Return a path to the log file.
218 208
      * @return string
219 209
      */
220
-    protected function logfile()
221
-    {
210
+    protected function logfile() {
222 211
         return sprintf(
223 212
             '%s.datatransfer.%s.log',
224 213
             $this->Environment()->getFullName('.'),
@@ -229,21 +218,18 @@  discard block
 block discarded – undo
229 218
     /**
230 219
      * @return \DeploynautLogFile
231 220
      */
232
-    public function log()
233
-    {
221
+    public function log() {
234 222
         return new DeploynautLogFile($this->logfile());
235 223
     }
236 224
 
237 225
     /**
238 226
      * @return string
239 227
      */
240
-    public function LogContent()
241
-    {
228
+    public function LogContent() {
242 229
         return $this->log()->content();
243 230
     }
244 231
 
245
-    public function getDescription()
246
-    {
232
+    public function getDescription() {
247 233
         $envName = $this->Environment()->getFullName();
248 234
         if ($this->Direction == 'get') {
249 235
             if ($this->Origin == 'ManualUpload') {
@@ -260,8 +246,7 @@  discard block
 block discarded – undo
260 246
         return $description;
261 247
     }
262 248
 
263
-    public function getModeNice()
264
-    {
249
+    public function getModeNice() {
265 250
         if ($this->Mode == 'all') {
266 251
             return 'database and assets';
267 252
         } else {
@@ -273,8 +258,7 @@  discard block
 block discarded – undo
273 258
      * Is this transfer an automated backup of a push transfer?
274 259
      * @return boolean
275 260
      */
276
-    public function IsBackupDataTransfer()
277
-    {
261
+    public function IsBackupDataTransfer() {
278 262
         return DB::query(sprintf(
279 263
             'SELECT COUNT("ID") FROM "DNDataTransfer" WHERE "BackupDataTransferID" = %d',
280 264
             $this->ID
@@ -286,8 +270,7 @@  discard block
 block discarded – undo
286 270
      *
287 271
      * @return string
288 272
      */
289
-    public function ResqueStatus()
290
-    {
273
+    public function ResqueStatus() {
291 274
         $status = new Resque_Job_Status($this->ResqueToken);
292 275
         $statusCode = $status->get();
293 276
         // The Resque job can no longer be found, fallback to the DNDataTransfer.Status
Please login to merge, or discard this patch.
code/model/jobs/DNDeployment.php 1 patch
Braces   +20 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
  * @method Member Deployer()
13 13
  * @property int DeployerID
14 14
  */
15
-class DNDeployment extends DataObject
16
-{
15
+class DNDeployment extends DataObject {
17 16
 
18 17
     /**
19 18
      * @var array
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
 
39 38
     private static $default_sort = '"LastEdited" DESC';
40 39
 
41
-    public function getTitle()
42
-    {
40
+    public function getTitle() {
43 41
         return "#{$this->ID}: {$this->SHA} (Status: {$this->Status})";
44 42
     }
45 43
 
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
      * @param int $int
55 53
      * @return string
56 54
      */
57
-    public static function map_resque_status($int)
58
-    {
55
+    public static function map_resque_status($int) {
59 56
         $remap = array(
60 57
             Resque_Job_Status::STATUS_WAITING => "Queued",
61 58
             Resque_Job_Status::STATUS_RUNNING => "Running",
@@ -67,18 +64,15 @@  discard block
 block discarded – undo
67 64
     }
68 65
 
69 66
 
70
-    public function Link()
71
-    {
67
+    public function Link() {
72 68
         return Controller::join_links($this->Environment()->Link(), 'deploy', $this->ID);
73 69
     }
74 70
 
75
-    public function LogLink()
76
-    {
71
+    public function LogLink() {
77 72
         return $this->Link() . '/log';
78 73
     }
79 74
 
80
-    public function canView($member = null)
81
-    {
75
+    public function canView($member = null) {
82 76
         return $this->Environment()->canView($member);
83 77
     }
84 78
 
@@ -86,8 +80,7 @@  discard block
 block discarded – undo
86 80
      * Return a path to the log file.
87 81
      * @return string
88 82
      */
89
-    protected function logfile()
90
-    {
83
+    protected function logfile() {
91 84
         return sprintf(
92 85
             '%s.%s.log',
93 86
             $this->Environment()->getFullName('.'),
@@ -98,13 +91,11 @@  discard block
 block discarded – undo
98 91
     /**
99 92
      * @return DeploynautLogFile
100 93
      */
101
-    public function log()
102
-    {
94
+    public function log() {
103 95
         return Injector::inst()->createWithArgs('DeploynautLogFile', array($this->logfile()));
104 96
     }
105 97
 
106
-    public function LogContent()
107
-    {
98
+    public function LogContent() {
108 99
         return $this->log()->content();
109 100
     }
110 101
 
@@ -113,8 +104,7 @@  discard block
 block discarded – undo
113 104
      *
114 105
      * @return string
115 106
      */
116
-    public function ResqueStatus()
117
-    {
107
+    public function ResqueStatus() {
118 108
         $status = new Resque_Job_Status($this->ResqueToken);
119 109
         $statusCode = $status->get();
120 110
         // The Resque job can no longer be found, fallback to the DNDeployment.Status
@@ -138,8 +128,7 @@  discard block
 block discarded – undo
138 128
      *
139 129
      * @return \Gitonomy\Git\Repository|null
140 130
      */
141
-    public function getRepository()
142
-    {
131
+    public function getRepository() {
143 132
         if (!$this->SHA) {
144 133
             return null;
145 134
         }
@@ -152,8 +141,7 @@  discard block
 block discarded – undo
152 141
      *
153 142
      * @return \Gitonomy\Git\Commit|null
154 143
      */
155
-    public function getCommit()
156
-    {
144
+    public function getCommit() {
157 145
         $repo = $this->getRepository();
158 146
         if ($repo) {
159 147
             try {
@@ -172,8 +160,7 @@  discard block
 block discarded – undo
172 160
      *
173 161
      * @return string|null
174 162
      */
175
-    public function getCommitMessage()
176
-    {
163
+    public function getCommitMessage() {
177 164
         $commit = $this->getCommit();
178 165
         if ($commit) {
179 166
             try {
@@ -190,8 +177,7 @@  discard block
 block discarded – undo
190 177
      *
191 178
      * @return ArrayList
192 179
      */
193
-    public function getTags()
194
-    {
180
+    public function getTags() {
195 181
         $returnTags = array();
196 182
         $repo = $this->getRepository();
197 183
         if ($repo) {
@@ -213,8 +199,7 @@  discard block
 block discarded – undo
213 199
      *
214 200
      * @return ArrayList
215 201
      */
216
-    public function getFullDeployMessages()
217
-    {
202
+    public function getFullDeployMessages() {
218 203
         $strategy = $this->getDeploymentStrategy();
219 204
         if ($strategy->getActionCode()!=='full') {
220 205
             return null;
@@ -251,8 +236,7 @@  discard block
 block discarded – undo
251 236
      *
252 237
      * @return \Varchar|null
253 238
      */
254
-    public function getTag()
255
-    {
239
+    public function getTag() {
256 240
         $tags = $this->getTags();
257 241
         if ($tags->count() > 0) {
258 242
             return $tags->last();
@@ -263,8 +247,7 @@  discard block
 block discarded – undo
263 247
     /**
264 248
      * @return DeploymentStrategy
265 249
      */
266
-    public function getDeploymentStrategy()
267
-    {
250
+    public function getDeploymentStrategy() {
268 251
         $environment = $this->Environment();
269 252
         $strategy = new DeploymentStrategy($environment);
270 253
         $strategy->fromJSON($this->Strategy);
@@ -277,8 +260,7 @@  discard block
 block discarded – undo
277 260
      *
278 261
      * @return ArrayList
279 262
      */
280
-    public function getChanges()
281
-    {
263
+    public function getChanges() {
282 264
         $list = new ArrayList();
283 265
         $strategy = $this->getDeploymentStrategy();
284 266
         foreach ($strategy->getChanges() as $name => $change) {
@@ -304,8 +286,7 @@  discard block
 block discarded – undo
304 286
      *
305 287
      * @return string Resque token
306 288
      */
307
-    protected function enqueueDeployment()
308
-    {
289
+    protected function enqueueDeployment() {
309 290
         $environment = $this->Environment();
310 291
         $project = $environment->Project();
311 292
         $log = $this->log();
@@ -344,8 +325,7 @@  discard block
 block discarded – undo
344 325
         return Resque::enqueue('deploy', 'DeployJob', $args, true);
345 326
     }
346 327
 
347
-    public function start()
348
-    {
328
+    public function start() {
349 329
         $log = $this->log();
350 330
         $token = $this->enqueueDeployment();
351 331
         $this->ResqueToken = $token;
Please login to merge, or discard this patch.
code/model/jobs/DNGitFetch.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
  * @property int $DeployerID
12 12
  *
13 13
  */
14
-class DNGitFetch extends DataObject
15
-{
14
+class DNGitFetch extends DataObject {
16 15
 
17 16
     /**
18 17
      * @var array
@@ -36,8 +35,7 @@  discard block
 block discarded – undo
36 35
      * @param int $int
37 36
      * @return string
38 37
      */
39
-    public static function map_resque_status($int)
40
-    {
38
+    public static function map_resque_status($int) {
41 39
         $remap = array(
42 40
             Resque_Job_Status::STATUS_WAITING => "Queued",
43 41
             Resque_Job_Status::STATUS_RUNNING => "Running",
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      * Queue a fetch job
53 51
      * @param bool $forceClone Force repository to be re-cloned
54 52
      */
55
-    public function start($forceClone = false)
56
-    {
53
+    public function start($forceClone = false) {
57 54
         $project = $this->Project();
58 55
         $log = $this->log();
59 56
 
@@ -95,8 +92,7 @@  discard block
 block discarded – undo
95 92
      * @param Member|null $member
96 93
      * @return bool
97 94
      */
98
-    public function canView($member = null)
99
-    {
95
+    public function canView($member = null) {
100 96
         return $this->Project()->canView($member);
101 97
     }
102 98
 
@@ -104,8 +100,7 @@  discard block
 block discarded – undo
104 100
      * Return a path to the log file.
105 101
      * @return string
106 102
      */
107
-    protected function logfile()
108
-    {
103
+    protected function logfile() {
109 104
         return sprintf(
110 105
             '%s.fetch.%s.log',
111 106
             $this->Project()->Name,
@@ -116,16 +111,14 @@  discard block
 block discarded – undo
116 111
     /**
117 112
      * @return \DeploynautLogFile
118 113
      */
119
-    public function log()
120
-    {
114
+    public function log() {
121 115
         return new DeploynautLogFile($this->logfile());
122 116
     }
123 117
 
124 118
     /**
125 119
      * @return string
126 120
      */
127
-    public function LogContent()
128
-    {
121
+    public function LogContent() {
129 122
         return $this->log()->content();
130 123
     }
131 124
 
@@ -134,8 +127,7 @@  discard block
 block discarded – undo
134 127
      *
135 128
      * @return string
136 129
      */
137
-    public function ResqueStatus()
138
-    {
130
+    public function ResqueStatus() {
139 131
         $status = new Resque_Job_Status($this->ResqueToken);
140 132
         $statusCode = $status->get();
141 133
         // The Resque job can no longer be found, fallback to the DNDeployment.Status
Please login to merge, or discard this patch.
code/model/jobs/DNPing.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
  * @method Member Deployer()
10 10
  * @property int DeployerID
11 11
  */
12
-class DNPing extends DataObject
13
-{
12
+class DNPing extends DataObject {
14 13
 
15 14
     /**
16 15
      * @var array
@@ -30,16 +29,14 @@  discard block
 block discarded – undo
30 29
     /**
31 30
      * @return string
32 31
      */
33
-    public function Link()
34
-    {
32
+    public function Link() {
35 33
         return Controller::join_links($this->Environment()->Link(), 'ping', $this->ID);
36 34
     }
37 35
 
38 36
     /**
39 37
      * @return string
40 38
      */
41
-    public function LogLink()
42
-    {
39
+    public function LogLink() {
43 40
         return $this->Link() . '/log';
44 41
     }
45 42
 
@@ -47,8 +44,7 @@  discard block
 block discarded – undo
47 44
      * @param Member|null $member
48 45
      * @return bool
49 46
      */
50
-    public function canView($member = null)
51
-    {
47
+    public function canView($member = null) {
52 48
         return $this->Environment()->canView($member);
53 49
     }
54 50
 
@@ -56,8 +52,7 @@  discard block
 block discarded – undo
56 52
      * Return a path to the log file.
57 53
      * @return string
58 54
      */
59
-    protected function logfile()
60
-    {
55
+    protected function logfile() {
61 56
         return sprintf(
62 57
             '%s.ping.%s.log',
63 58
             $this->Environment()->getFullName('.'),
@@ -68,24 +63,21 @@  discard block
 block discarded – undo
68 63
     /**
69 64
      * @return \DeploynautLogFile
70 65
      */
71
-    public function log()
72
-    {
66
+    public function log() {
73 67
         return new DeploynautLogFile($this->logfile());
74 68
     }
75 69
 
76 70
     /**
77 71
      * @return string
78 72
      */
79
-    public function LogContent()
80
-    {
73
+    public function LogContent() {
81 74
         return $this->log()->content();
82 75
     }
83 76
 
84 77
     /**
85 78
      * @return string
86 79
      */
87
-    public function ResqueStatus()
88
-    {
80
+    public function ResqueStatus() {
89 81
         $status = new Resque_Job_Status($this->ResqueToken);
90 82
 
91 83
         $remap = array(
@@ -102,8 +94,7 @@  discard block
 block discarded – undo
102 94
     /**
103 95
      * Queue a ping job
104 96
      */
105
-    public function start()
106
-    {
97
+    public function start() {
107 98
         $environment = $this->Environment();
108 99
         $project = $environment->Project();
109 100
         $log = $this->log();
Please login to merge, or discard this patch.