Completed
Pull Request — master (#489)
by Helpful
03:51
created
code/backends/PackageGenerator.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  * These package generators can be used by applicable deployment backends.
8 8
  */
9
-abstract class PackageGenerator
10
-{
9
+abstract class PackageGenerator {
11 10
 
12 11
     protected $cache;
13 12
 
@@ -31,13 +30,11 @@  discard block
 block discarded – undo
31 30
      */
32 31
     abstract public function getIdentifier();
33 32
 
34
-    public function getCache()
35
-    {
33
+    public function getCache() {
36 34
         return $this->cache;
37 35
     }
38 36
 
39
-    public function setCache(PackageCache $cache)
40
-    {
37
+    public function setCache(PackageCache $cache) {
41 38
         $this->cache = $cache;
42 39
     }
43 40
 
@@ -51,8 +48,7 @@  discard block
 block discarded – undo
51 48
      *
52 49
      * @return string
53 50
      */
54
-    public function getPackageFilename($identifier, $sha, $repositoryDir, DeploynautLogFile $log)
55
-    {
51
+    public function getPackageFilename($identifier, $sha, $repositoryDir, DeploynautLogFile $log) {
56 52
         // Fetch through the cache
57 53
         if ($this->cache) {
58 54
             $identifier .= '-' . get_class($this) . '-' . $this->getIdentifier();
Please login to merge, or discard this patch.
code/backends/SimplePackageGenerator.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,30 +5,25 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * Generates the package directly on the deploynaut server
7 7
  */
8
-class SimplePackageGenerator extends PackageGenerator
9
-{
8
+class SimplePackageGenerator extends PackageGenerator {
10 9
 
11 10
     protected $buildScript = "composer install --prefer-dist --no-dev";
12 11
 
13
-    public function getParamMetadata()
14
-    {
12
+    public function getParamMetadata() {
15 13
         return array(
16 14
             'BuildScript' => array('title' => 'Build script'),
17 15
         );
18 16
     }
19 17
 
20
-    public function getBuildScript()
21
-    {
18
+    public function getBuildScript() {
22 19
         return $this->buildScript;
23 20
     }
24 21
 
25
-    public function setBuildScript($buildScript)
26
-    {
22
+    public function setBuildScript($buildScript) {
27 23
         $this->buildScript = $buildScript;
28 24
     }
29 25
 
30
-    public function getIdentifier()
31
-    {
26
+    public function getIdentifier() {
32 27
         // If the build script changes, don't re-use cached items
33 28
         return substr(sha1($this->buildScript), 0, 8);
34 29
     }
@@ -36,8 +31,7 @@  discard block
 block discarded – undo
36 31
     /**
37 32
      * Generate the package
38 33
      */
39
-    public function generatePackage($sha, $baseDir, $outputFilename, DeploynautLogFile $log)
40
-    {
34
+    public function generatePackage($sha, $baseDir, $outputFilename, DeploynautLogFile $log) {
41 35
         $tempPath = TEMP_FOLDER . "/" . str_replace(".tar.gz", "", basename($outputFilename));
42 36
         if (!file_exists($tempPath)) {
43 37
             mkdir($tempPath);
@@ -82,8 +76,7 @@  discard block
 block discarded – undo
82 76
      * @param array $processes An array of Symfony\Component\Process\Process objects
83 77
      * @param DeploynautLogFile $log The log to send output to
84 78
      */
85
-    protected function executeProcesses($processes, DeploynautLogFile $log)
86
-    {
79
+    protected function executeProcesses($processes, DeploynautLogFile $log) {
87 80
         foreach ($processes as $process) {
88 81
             $process->mustRun(function ($type, $buffer) use ($log) {
89 82
                 $log->write($buffer);
Please login to merge, or discard this patch.
code/backends/SizeRestrictedPackageCache.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Class for calling the package generator and caching the results.
5 5
  */
6
-class SizeRestrictedPackageCache implements PackageCache
7
-{
6
+class SizeRestrictedPackageCache implements PackageCache {
8 7
 
9 8
     protected $cacheSize;
10 9
     protected $baseDir;
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
      *
18 17
      * @param int $cacheSize the number of package files to keep.
19 18
      */
20
-    public function setCacheSize($cacheSize)
21
-    {
19
+    public function setCacheSize($cacheSize) {
22 20
         $this->cacheSize = $cacheSize;
23 21
     }
24 22
 
@@ -29,8 +27,7 @@  discard block
 block discarded – undo
29 27
      *
30 28
      * @param string $baseDir The base directory
31 29
      */
32
-    public function setBaseDir($baseDir)
33
-    {
30
+    public function setBaseDir($baseDir) {
34 31
         $this->baseDir = realpath($baseDir);
35 32
     }
36 33
 
@@ -91,8 +88,7 @@  discard block
 block discarded – undo
91 88
      *
92 89
      * @param string $identifier The unsanitised directory name.
93 90
      */
94
-    protected function sanitiseDirName($identifier)
95
-    {
91
+    protected function sanitiseDirName($identifier) {
96 92
         $safe = preg_replace('/[^A-Za-z0-9_-]/', '', $identifier);
97 93
         return $safe ? $safe : 'null';
98 94
     }
@@ -105,8 +101,7 @@  discard block
 block discarded – undo
105 101
      * @param int $count The maximum number of .tar.gz files that can appear in that directory
106 102
      * @param DeploynautLogFile $log The log to send removal status messages to
107 103
      */
108
-    protected function reduceDirSizeTo($dir, $count, DeploynautLogFile $log)
109
-    {
104
+    protected function reduceDirSizeTo($dir, $count, DeploynautLogFile $log) {
110 105
         $files = glob($dir . '/*.tar.gz');
111 106
         if (sizeof($files) > $count) {
112 107
             usort($files, function ($a, $b) {
Please login to merge, or discard this patch.
code/control/CheckPipelineStatus.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,10 +8,8 @@  discard block
 block discarded – undo
8 8
  * @package deploynaut
9 9
  * @subpackage control
10 10
  */
11
-class CheckPipelineStatus extends Controller
12
-{
13
-    public function index()
14
-    {
11
+class CheckPipelineStatus extends Controller {
12
+    public function index() {
15 13
         // @TODO Check that we have been called via the daemon
16 14
         if (php_sapi_name() != "cli") {
17 15
             throw new Exception("CheckPipelineStatus must be run from the command-line.");
@@ -20,8 +18,7 @@  discard block
 block discarded – undo
20 18
         $this->run();
21 19
     }
22 20
 
23
-    private function run()
24
-    {
21
+    private function run() {
25 22
         // Note that a pipeline must be started prior to being picked up by this task
26 23
         $runningPipelines = Pipeline::get()->filter('Status', array('Running', 'Rollback'));
27 24
 
Please login to merge, or discard this patch.
code/control/ConfirmationMessagingService.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@
 block discarded – undo
4 4
  * @package deploynaut
5 5
  * @subpackage control
6 6
  */
7
-interface ConfirmationMessagingService
8
-{
7
+interface ConfirmationMessagingService {
9 8
 
10 9
     /**
11 10
      * Sends a message to the specified user
Please login to merge, or discard this patch.
code/control/DNAdmin.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
-class DNAdmin extends ModelAdmin
4
-{
3
+class DNAdmin extends ModelAdmin {
5 4
 
6 5
     /**
7 6
      * @var string
Please login to merge, or discard this patch.
code/control/DNRoot.php 1 patch
Braces   +84 added lines, -168 removed lines patch added patch discarded remove patch
@@ -170,8 +170,7 @@  discard block
 block discarded – undo
170 170
     /**
171 171
      * Include requirements that deploynaut needs, such as javascript.
172 172
      */
173
-    public static function include_requirements()
174
-    {
173
+    public static function include_requirements() {
175 174
 
176 175
         // JS should always go to the bottom, otherwise there's the risk that Requirements
177 176
         // puts them halfway through the page to the nearest <script> tag. We don't want that.
@@ -209,8 +208,7 @@  discard block
 block discarded – undo
209 208
      *
210 209
      * @return boolean
211 210
      */
212
-    public static function FlagSnapshotsEnabled()
213
-    {
211
+    public static function FlagSnapshotsEnabled() {
214 212
         if (defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) {
215 213
             return true;
216 214
         }
@@ -227,8 +225,7 @@  discard block
 block discarded – undo
227 225
     /**
228 226
      * @return ArrayList
229 227
      */
230
-    public static function get_support_links()
231
-    {
228
+    public static function get_support_links() {
232 229
         $supportLinks = self::config()->support_links;
233 230
         if ($supportLinks) {
234 231
             return new ArrayList($supportLinks);
@@ -238,8 +235,7 @@  discard block
 block discarded – undo
238 235
     /**
239 236
      * @return array
240 237
      */
241
-    public static function get_template_global_variables()
242
-    {
238
+    public static function get_template_global_variables() {
243 239
         return array(
244 240
             'RedisUnavailable' => 'RedisUnavailable',
245 241
             'RedisWorkersCount' => 'RedisWorkersCount',
@@ -250,8 +246,7 @@  discard block
 block discarded – undo
250 246
 
251 247
     /**
252 248
      */
253
-    public function init()
254
-    {
249
+    public function init() {
255 250
         parent::init();
256 251
 
257 252
         if (!Member::currentUser() && !Session::get('AutoLoginHash')) {
@@ -267,8 +262,7 @@  discard block
 block discarded – undo
267 262
     /**
268 263
      * @return string
269 264
      */
270
-    public function Link()
271
-    {
265
+    public function Link() {
272 266
         return "naut/";
273 267
     }
274 268
 
@@ -278,8 +272,7 @@  discard block
 block discarded – undo
278 272
      * @param SS_HTTPRequest $request
279 273
      * @return \SS_HTTPResponse
280 274
      */
281
-    public function index(SS_HTTPRequest $request)
282
-    {
275
+    public function index(SS_HTTPRequest $request) {
283 276
         return $this->redirect($this->Link() . 'projects/');
284 277
     }
285 278
 
@@ -289,8 +282,7 @@  discard block
 block discarded – undo
289 282
      * @param SS_HTTPRequest $request
290 283
      * @return string - HTML
291 284
      */
292
-    public function projects(SS_HTTPRequest $request)
293
-    {
285
+    public function projects(SS_HTTPRequest $request) {
294 286
         // Performs canView permission check by limiting visible projects in DNProjectsList() call.
295 287
         return $this->customise(array(
296 288
             'Title' => 'Projects',
@@ -301,8 +293,7 @@  discard block
 block discarded – undo
301 293
      * @param SS_HTTPRequest $request
302 294
      * @return HTMLText
303 295
      */
304
-    public function nav(SS_HTTPRequest $request)
305
-    {
296
+    public function nav(SS_HTTPRequest $request) {
306 297
         return $this->renderWith('Nav');
307 298
     }
308 299
 
@@ -310,8 +301,7 @@  discard block
 block discarded – undo
310 301
      * Return a link to the navigation template used for AJAX requests.
311 302
      * @return string
312 303
      */
313
-    public function NavLink()
314
-    {
304
+    public function NavLink() {
315 305
         $currentProject = $this->getCurrentProject();
316 306
         $projectName = $currentProject ? $currentProject->Name : null;
317 307
         return Controller::join_links(Director::absoluteBaseURL(), 'naut', 'nav', $projectName);
@@ -323,8 +313,7 @@  discard block
 block discarded – undo
323 313
      * @param SS_HTTPRequest $request
324 314
      * @return SS_HTTPResponse - HTML
325 315
      */
326
-    public function snapshots(SS_HTTPRequest $request)
327
-    {
316
+    public function snapshots(SS_HTTPRequest $request) {
328 317
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
329 318
         return $this->getCustomisedViewSection('SnapshotsSection', 'Data Snapshots');
330 319
     }
@@ -335,8 +324,7 @@  discard block
 block discarded – undo
335 324
      * @param SS_HTTPRequest $request
336 325
      * @return string - HTML
337 326
      */
338
-    public function createsnapshot(SS_HTTPRequest $request)
339
-    {
327
+    public function createsnapshot(SS_HTTPRequest $request) {
340 328
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
341 329
 
342 330
         // Performs canView permission check by limiting visible projects
@@ -362,8 +350,7 @@  discard block
 block discarded – undo
362 350
      * @param SS_HTTPRequest $request
363 351
      * @return string - HTML
364 352
      */
365
-    public function uploadsnapshot(SS_HTTPRequest $request)
366
-    {
353
+    public function uploadsnapshot(SS_HTTPRequest $request) {
367 354
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
368 355
 
369 356
         // Performs canView permission check by limiting visible projects
@@ -387,8 +374,7 @@  discard block
 block discarded – undo
387 374
      * Return the upload limit for snapshot uploads
388 375
      * @return string
389 376
      */
390
-    public function UploadLimit()
391
-    {
377
+    public function UploadLimit() {
392 378
         return File::format_size(min(
393 379
             File::ini2bytes(ini_get('upload_max_filesize')),
394 380
             File::ini2bytes(ini_get('post_max_size'))
@@ -401,8 +387,7 @@  discard block
 block discarded – undo
401 387
      * @param SS_HTTPRequest $request
402 388
      * @return Form
403 389
      */
404
-    public function getUploadSnapshotForm(SS_HTTPRequest $request)
405
-    {
390
+    public function getUploadSnapshotForm(SS_HTTPRequest $request) {
406 391
         // Performs canView permission check by limiting visible projects
407 392
         $project = $this->getCurrentProject();
408 393
         if (!$project) {
@@ -459,8 +444,7 @@  discard block
 block discarded – undo
459 444
      *
460 445
      * @return bool|HTMLText|SS_HTTPResponse
461 446
      */
462
-    public function doUploadSnapshot($data, Form $form)
463
-    {
447
+    public function doUploadSnapshot($data, Form $form) {
464 448
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
465 449
 
466 450
         // Performs canView permission check by limiting visible projects
@@ -559,8 +543,7 @@  discard block
 block discarded – undo
559 543
      * @param SS_HTTPRequest $request
560 544
      * @return Form
561 545
      */
562
-    public function getPostSnapshotForm(SS_HTTPRequest $request)
563
-    {
546
+    public function getPostSnapshotForm(SS_HTTPRequest $request) {
564 547
         // Performs canView permission check by limiting visible projects
565 548
         $project = $this->getCurrentProject();
566 549
         if (!$project) {
@@ -611,8 +594,7 @@  discard block
 block discarded – undo
611 594
      *
612 595
      * @return SS_HTTPResponse
613 596
      */
614
-    public function doPostSnapshot($data, $form)
615
-    {
597
+    public function doPostSnapshot($data, $form) {
616 598
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
617 599
 
618 600
         $project = $this->getCurrentProject();
@@ -649,8 +631,7 @@  discard block
 block discarded – undo
649 631
      * @param SS_HTTPRequest $request
650 632
      * @return SS_HTTPResponse - HTML
651 633
      */
652
-    public function snapshotslog(SS_HTTPRequest $request)
653
-    {
634
+    public function snapshotslog(SS_HTTPRequest $request) {
654 635
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
655 636
         return $this->getCustomisedViewSection('SnapshotsSection', 'Data Snapshots Log');
656 637
     }
@@ -660,8 +641,7 @@  discard block
 block discarded – undo
660 641
      * @return SS_HTTPResponse|string
661 642
      * @throws SS_HTTPResponse_Exception
662 643
      */
663
-    public function postsnapshotsuccess(SS_HTTPRequest $request)
664
-    {
644
+    public function postsnapshotsuccess(SS_HTTPRequest $request) {
665 645
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
666 646
 
667 647
         // Performs canView permission check by limiting visible projects
@@ -695,8 +675,7 @@  discard block
 block discarded – undo
695 675
      * @param SS_HTTPRequest $request
696 676
      * @return \SS_HTTPResponse
697 677
      */
698
-    public function project(SS_HTTPRequest $request)
699
-    {
678
+    public function project(SS_HTTPRequest $request) {
700 679
         return $this->getCustomisedViewSection('ProjectOverview', '', array('IsAdmin' => Permission::check('ADMIN')));
701 680
     }
702 681
 
@@ -707,8 +686,7 @@  discard block
 block discarded – undo
707 686
      *
708 687
      * @return SS_HTTPResponse
709 688
      */
710
-    public function toggleprojectstar(SS_HTTPRequest $request)
711
-    {
689
+    public function toggleprojectstar(SS_HTTPRequest $request) {
712 690
         $project = $this->getCurrentProject();
713 691
         if (!$project) {
714 692
             return $this->project404Response();
@@ -734,8 +712,7 @@  discard block
 block discarded – undo
734 712
      * @param SS_HTTPRequest $request
735 713
      * @return \SS_HTTPResponse
736 714
      */
737
-    public function branch(SS_HTTPRequest $request)
738
-    {
715
+    public function branch(SS_HTTPRequest $request) {
739 716
         $project = $this->getCurrentProject();
740 717
         if (!$project) {
741 718
             return $this->project404Response();
@@ -756,8 +733,7 @@  discard block
 block discarded – undo
756 733
      * @param SS_HTTPRequest $request
757 734
      * @return \SS_HTTPResponse
758 735
      */
759
-    public function environment(SS_HTTPRequest $request)
760
-    {
736
+    public function environment(SS_HTTPRequest $request) {
761 737
         // Performs canView permission check by limiting visible projects
762 738
         $project = $this->getCurrentProject();
763 739
         if (!$project) {
@@ -785,8 +761,7 @@  discard block
 block discarded – undo
785 761
      *
786 762
      * @return SS_HTTPResponse
787 763
      */
788
-    public function doDryRun($data, DeployForm $form)
789
-    {
764
+    public function doDryRun($data, DeployForm $form) {
790 765
         return $this->beginPipeline($data, $form, true);
791 766
     }
792 767
 
@@ -797,8 +772,7 @@  discard block
 block discarded – undo
797 772
      * @param DeployForm $form
798 773
      * @return \SS_HTTPResponse
799 774
      */
800
-    public function startPipeline($data, $form)
801
-    {
775
+    public function startPipeline($data, $form) {
802 776
         return $this->beginPipeline($data, $form);
803 777
     }
804 778
 
@@ -810,8 +784,7 @@  discard block
 block discarded – undo
810 784
      * @param bool $isDryRun
811 785
      * @return \SS_HTTPResponse
812 786
      */
813
-    protected function beginPipeline($data, DeployForm $form, $isDryRun = false)
814
-    {
787
+    protected function beginPipeline($data, DeployForm $form, $isDryRun = false) {
815 788
         $buildName = $form->getSelectedBuild($data);
816 789
 
817 790
         // Performs canView permission check by limiting visible projects
@@ -851,8 +824,7 @@  discard block
 block discarded – undo
851 824
      * @return SS_HTTPResponse
852 825
      * @throws SS_HTTPResponse_Exception
853 826
      */
854
-    public function pipeline(SS_HTTPRequest $request)
855
-    {
827
+    public function pipeline(SS_HTTPRequest $request) {
856 828
         $params = $request->params();
857 829
         $pipeline = Pipeline::get()->byID($params['Identifier']);
858 830
 
@@ -883,8 +855,7 @@  discard block
 block discarded – undo
883 855
      * @param SS_HTTPRequest $request
884 856
      * @return string
885 857
      */
886
-    public function createenv(SS_HTTPRequest $request)
887
-    {
858
+    public function createenv(SS_HTTPRequest $request) {
888 859
         $params = $request->params();
889 860
         if ($params['Identifier']) {
890 861
             $record = DNCreateEnvironment::get()->byId($params['Identifier']);
@@ -913,8 +884,7 @@  discard block
 block discarded – undo
913 884
     }
914 885
 
915 886
 
916
-    public function createenvlog(SS_HTTPRequest $request)
917
-    {
887
+    public function createenvlog(SS_HTTPRequest $request) {
918 888
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
919 889
 
920 890
         $params = $request->params();
@@ -947,8 +917,7 @@  discard block
 block discarded – undo
947 917
      * @param SS_HTTPRequest $request
948 918
      * @return Form
949 919
      */
950
-    public function getCreateEnvironmentForm(SS_HTTPRequest $request)
951
-    {
920
+    public function getCreateEnvironmentForm(SS_HTTPRequest $request) {
952 921
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
953 922
 
954 923
         $project = $this->getCurrentProject();
@@ -999,8 +968,7 @@  discard block
 block discarded – undo
999 968
      *
1000 969
      * @return bool|HTMLText|SS_HTTPResponse
1001 970
      */
1002
-    public function doCreateEnvironment($data, Form $form)
1003
-    {
971
+    public function doCreateEnvironment($data, Form $form) {
1004 972
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
1005 973
 
1006 974
         $project = $this->getCurrentProject();
@@ -1030,8 +998,7 @@  discard block
 block discarded – undo
1030 998
      * @param SS_HTTPRequest $request
1031 999
      * @return \SS_HTTPResponse
1032 1000
      */
1033
-    public function metrics(SS_HTTPRequest $request)
1034
-    {
1001
+    public function metrics(SS_HTTPRequest $request) {
1035 1002
         // Performs canView permission check by limiting visible projects
1036 1003
         $project = $this->getCurrentProject();
1037 1004
         if (!$project) {
@@ -1052,8 +1019,7 @@  discard block
 block discarded – undo
1052 1019
      *
1053 1020
      * @return DNData
1054 1021
      */
1055
-    public function DNData()
1056
-    {
1022
+    public function DNData() {
1057 1023
         return DNData::inst();
1058 1024
     }
1059 1025
 
@@ -1062,8 +1028,7 @@  discard block
 block discarded – undo
1062 1028
      *
1063 1029
      * @return SS_List
1064 1030
      */
1065
-    public function DNProjectList()
1066
-    {
1031
+    public function DNProjectList() {
1067 1032
         $memberId = Member::currentUserID();
1068 1033
         if (!$memberId) {
1069 1034
             return new ArrayList();
@@ -1081,8 +1046,7 @@  discard block
 block discarded – undo
1081 1046
     /**
1082 1047
      * @return ArrayList
1083 1048
      */
1084
-    public function getPlatformSpecificStrings()
1085
-    {
1049
+    public function getPlatformSpecificStrings() {
1086 1050
         $strings = $this->config()->platform_specific_strings;
1087 1051
         if ($strings) {
1088 1052
             return new ArrayList($strings);
@@ -1094,8 +1058,7 @@  discard block
 block discarded – undo
1094 1058
      *
1095 1059
      * @return SS_List
1096 1060
      */
1097
-    public function getStarredProjects()
1098
-    {
1061
+    public function getStarredProjects() {
1099 1062
         $member = Member::currentUser();
1100 1063
         if ($member === null) {
1101 1064
             return new ArrayList();
@@ -1119,8 +1082,7 @@  discard block
 block discarded – undo
1119 1082
      *
1120 1083
      * @return ArrayList
1121 1084
      */
1122
-    public function Navigation($limit = 5)
1123
-    {
1085
+    public function Navigation($limit = 5) {
1124 1086
         $navigation = new ArrayList();
1125 1087
 
1126 1088
         $currentProject = $this->getCurrentProject();
@@ -1173,8 +1135,7 @@  discard block
 block discarded – undo
1173 1135
      *
1174 1136
      * @return Form
1175 1137
      */
1176
-    public function getDeployForm($request = null)
1177
-    {
1138
+    public function getDeployForm($request = null) {
1178 1139
 
1179 1140
         // Performs canView permission check by limiting visible projects
1180 1141
         $project = $this->getCurrentProject();
@@ -1220,8 +1181,7 @@  discard block
 block discarded – undo
1220 1181
      *
1221 1182
      * @return SS_HTTPResponse|string
1222 1183
      */
1223
-    public function gitRevisions(SS_HTTPRequest $request)
1224
-    {
1184
+    public function gitRevisions(SS_HTTPRequest $request) {
1225 1185
 
1226 1186
         // Performs canView permission check by limiting visible projects
1227 1187
         $project = $this->getCurrentProject();
@@ -1372,8 +1332,7 @@  discard block
 block discarded – undo
1372 1332
      *
1373 1333
      * @return bool
1374 1334
      */
1375
-    protected function checkCsrfToken(SS_HTTPRequest $request, $resetToken = true)
1376
-    {
1335
+    protected function checkCsrfToken(SS_HTTPRequest $request, $resetToken = true) {
1377 1336
         $token = SecurityToken::inst();
1378 1337
 
1379 1338
         // Ensure the submitted token has a value
@@ -1399,8 +1358,7 @@  discard block
 block discarded – undo
1399 1358
      *
1400 1359
      * @return string
1401 1360
      */
1402
-    public function deploySummary(SS_HTTPRequest $request)
1403
-    {
1361
+    public function deploySummary(SS_HTTPRequest $request) {
1404 1362
 
1405 1363
         // Performs canView permission check by limiting visible projects
1406 1364
         $project = $this->getCurrentProject();
@@ -1458,8 +1416,7 @@  discard block
 block discarded – undo
1458 1416
      * @throws ValidationException
1459 1417
      * @throws null
1460 1418
      */
1461
-    public function startDeploy(SS_HTTPRequest $request)
1462
-    {
1419
+    public function startDeploy(SS_HTTPRequest $request) {
1463 1420
 
1464 1421
         // Ensure the CSRF Token is correct
1465 1422
         if (!$this->checkCsrfToken($request)) {
@@ -1502,8 +1459,7 @@  discard block
 block discarded – undo
1502 1459
      * @return SS_HTTPResponse|string
1503 1460
      * @throws SS_HTTPResponse_Exception
1504 1461
      */
1505
-    public function deploy(SS_HTTPRequest $request)
1506
-    {
1462
+    public function deploy(SS_HTTPRequest $request) {
1507 1463
         $params = $request->params();
1508 1464
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1509 1465
 
@@ -1538,8 +1494,7 @@  discard block
 block discarded – undo
1538 1494
      * @return string
1539 1495
      * @throws SS_HTTPResponse_Exception
1540 1496
      */
1541
-    public function deploylog(SS_HTTPRequest $request)
1542
-    {
1497
+    public function deploylog(SS_HTTPRequest $request) {
1543 1498
         $params = $request->params();
1544 1499
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1545 1500
 
@@ -1575,8 +1530,7 @@  discard block
 block discarded – undo
1575 1530
      *
1576 1531
      * @return Form
1577 1532
      */
1578
-    public function getDataTransferForm(SS_HTTPRequest $request = null)
1579
-    {
1533
+    public function getDataTransferForm(SS_HTTPRequest $request = null) {
1580 1534
         // Performs canView permission check by limiting visible projects
1581 1535
         $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1582 1536
             return $item->canBackup();
@@ -1612,8 +1566,7 @@  discard block
 block discarded – undo
1612 1566
      * @return SS_HTTPResponse
1613 1567
      * @throws SS_HTTPResponse_Exception
1614 1568
      */
1615
-    public function doDataTransfer($data, Form $form)
1616
-    {
1569
+    public function doDataTransfer($data, Form $form) {
1617 1570
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1618 1571
 
1619 1572
         // Performs canView permission check by limiting visible projects
@@ -1686,8 +1639,7 @@  discard block
 block discarded – undo
1686 1639
      * @return SS_HTTPResponse|string
1687 1640
      * @throws SS_HTTPResponse_Exception
1688 1641
      */
1689
-    public function transfer(SS_HTTPRequest $request)
1690
-    {
1642
+    public function transfer(SS_HTTPRequest $request) {
1691 1643
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1692 1644
 
1693 1645
         $params = $request->params();
@@ -1721,8 +1673,7 @@  discard block
 block discarded – undo
1721 1673
      * @return string
1722 1674
      * @throws SS_HTTPResponse_Exception
1723 1675
      */
1724
-    public function transferlog(SS_HTTPRequest $request)
1725
-    {
1676
+    public function transferlog(SS_HTTPRequest $request) {
1726 1677
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1727 1678
 
1728 1679
         $params = $request->params();
@@ -1761,8 +1712,7 @@  discard block
 block discarded – undo
1761 1712
      *                            otherwise the state is inferred from the request data.
1762 1713
      * @return Form
1763 1714
      */
1764
-    public function getDataTransferRestoreForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1765
-    {
1715
+    public function getDataTransferRestoreForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1766 1716
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1767 1717
 
1768 1718
         // Performs canView permission check by limiting visible projects
@@ -1821,8 +1771,7 @@  discard block
 block discarded – undo
1821 1771
      * @return HTMLText
1822 1772
      * @throws SS_HTTPResponse_Exception
1823 1773
      */
1824
-    public function restoresnapshot(SS_HTTPRequest $request)
1825
-    {
1774
+    public function restoresnapshot(SS_HTTPRequest $request) {
1826 1775
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1827 1776
 
1828 1777
         /** @var DNDataArchive $dataArchive */
@@ -1854,8 +1803,7 @@  discard block
 block discarded – undo
1854 1803
      * @return HTMLText
1855 1804
      * @throws SS_HTTPResponse_Exception
1856 1805
      */
1857
-    public function deletesnapshot(SS_HTTPRequest $request)
1858
-    {
1806
+    public function deletesnapshot(SS_HTTPRequest $request) {
1859 1807
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1860 1808
 
1861 1809
         /** @var DNDataArchive $dataArchive */
@@ -1881,8 +1829,7 @@  discard block
 block discarded – undo
1881 1829
      *        from the request data.
1882 1830
      * @return Form
1883 1831
      */
1884
-    public function getDeleteForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1885
-    {
1832
+    public function getDeleteForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1886 1833
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1887 1834
 
1888 1835
         // Performs canView permission check by limiting visible projects
@@ -1919,8 +1866,7 @@  discard block
 block discarded – undo
1919 1866
      * @return bool|SS_HTTPResponse
1920 1867
      * @throws SS_HTTPResponse_Exception
1921 1868
      */
1922
-    public function doDelete($data, Form $form)
1923
-    {
1869
+    public function doDelete($data, Form $form) {
1924 1870
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1925 1871
 
1926 1872
         // Performs canView permission check by limiting visible projects
@@ -1959,8 +1905,7 @@  discard block
 block discarded – undo
1959 1905
      * @return HTMLText
1960 1906
      * @throws SS_HTTPResponse_Exception
1961 1907
      */
1962
-    public function movesnapshot(SS_HTTPRequest $request)
1963
-    {
1908
+    public function movesnapshot(SS_HTTPRequest $request) {
1964 1909
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1965 1910
 
1966 1911
         /** @var DNDataArchive $dataArchive */
@@ -1989,8 +1934,7 @@  discard block
 block discarded – undo
1989 1934
      *
1990 1935
      * @return Form|SS_HTTPResponse
1991 1936
      */
1992
-    public function getMoveForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1993
-    {
1937
+    public function getMoveForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1994 1938
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1995 1939
 
1996 1940
         $envs = $dataArchive->validTargetEnvironments();
@@ -2030,8 +1974,7 @@  discard block
 block discarded – undo
2030 1974
      * @throws ValidationException
2031 1975
      * @throws null
2032 1976
      */
2033
-    public function doMove($data, Form $form)
2034
-    {
1977
+    public function doMove($data, Form $form) {
2035 1978
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
2036 1979
 
2037 1980
         // Performs canView permission check by limiting visible projects
@@ -2069,8 +2012,7 @@  discard block
 block discarded – undo
2069 2012
      *
2070 2013
      * @return string
2071 2014
      */
2072
-    public static function RedisUnavailable()
2073
-    {
2015
+    public static function RedisUnavailable() {
2074 2016
         try {
2075 2017
             Resque::queues();
2076 2018
         } catch (Exception $e) {
@@ -2084,16 +2026,14 @@  discard block
 block discarded – undo
2084 2026
      *
2085 2027
      * @return int
2086 2028
      */
2087
-    public static function RedisWorkersCount()
2088
-    {
2029
+    public static function RedisWorkersCount() {
2089 2030
         return count(Resque_Worker::all());
2090 2031
     }
2091 2032
 
2092 2033
     /**
2093 2034
      * @return array
2094 2035
      */
2095
-    public function providePermissions()
2096
-    {
2036
+    public function providePermissions() {
2097 2037
         return array(
2098 2038
             self::DEPLOYNAUT_BYPASS_PIPELINE => array(
2099 2039
                 'name' => "Bypass Pipeline",
@@ -2137,8 +2077,7 @@  discard block
 block discarded – undo
2137 2077
     /**
2138 2078
      * @return DNProject|null
2139 2079
      */
2140
-    public function getCurrentProject()
2141
-    {
2080
+    public function getCurrentProject() {
2142 2081
         $projectName = trim($this->getRequest()->param('Project'));
2143 2082
         if (!$projectName) {
2144 2083
             return null;
@@ -2153,8 +2092,7 @@  discard block
 block discarded – undo
2153 2092
      * @param DNProject|null $project
2154 2093
      * @return DNEnvironment|null
2155 2094
      */
2156
-    public function getCurrentEnvironment(DNProject $project = null)
2157
-    {
2095
+    public function getCurrentEnvironment(DNProject $project = null) {
2158 2096
         if ($this->getRequest()->param('Environment') === null) {
2159 2097
             return null;
2160 2098
         }
@@ -2177,8 +2115,7 @@  discard block
 block discarded – undo
2177 2115
      *
2178 2116
      * @return string - one of the consts from self::$action_types
2179 2117
      */
2180
-    public function getCurrentActionType()
2181
-    {
2118
+    public function getCurrentActionType() {
2182 2119
         return $this->actionType;
2183 2120
     }
2184 2121
 
@@ -2187,8 +2124,7 @@  discard block
 block discarded – undo
2187 2124
      *
2188 2125
      * @param string $actionType string - one of the consts from self::$action_types
2189 2126
      */
2190
-    public function setCurrentActionType($actionType)
2191
-    {
2127
+    public function setCurrentActionType($actionType) {
2192 2128
         $this->actionType = $actionType;
2193 2129
     }
2194 2130
 
@@ -2202,8 +2138,7 @@  discard block
 block discarded – undo
2202 2138
      * @param Member|null $member The {@link Member} to check (or null to check the currently logged in Member)
2203 2139
      * @return boolean|null true if $member has access to upload or download to at least one {@link DNEnvironment}.
2204 2140
      */
2205
-    public function CanViewArchives(Member $member = null)
2206
-    {
2141
+    public function CanViewArchives(Member $member = null) {
2207 2142
         if ($member === null) {
2208 2143
             $member = Member::currentUser();
2209 2144
         }
@@ -2239,8 +2174,7 @@  discard block
 block discarded – undo
2239 2174
      *
2240 2175
      * @return PaginatedList
2241 2176
      */
2242
-    public function CreateEnvironmentList()
2243
-    {
2177
+    public function CreateEnvironmentList() {
2244 2178
         $project = $this->getCurrentProject();
2245 2179
         if ($project) {
2246 2180
             return new PaginatedList($project->CreateEnvironments()->sort("Created DESC"), $this->request);
@@ -2253,8 +2187,7 @@  discard block
 block discarded – undo
2253 2187
      *
2254 2188
      * @return PaginatedList
2255 2189
      */
2256
-    public function CompleteDataArchives()
2257
-    {
2190
+    public function CompleteDataArchives() {
2258 2191
         $project = $this->getCurrentProject();
2259 2192
         $archives = new ArrayList();
2260 2193
 
@@ -2273,8 +2206,7 @@  discard block
 block discarded – undo
2273 2206
      * @return PaginatedList The list of "pending" data archives which are waiting for a file
2274 2207
      * to be delivered offline by post, and manually uploaded into the system.
2275 2208
      */
2276
-    public function PendingDataArchives()
2277
-    {
2209
+    public function PendingDataArchives() {
2278 2210
         $project = $this->getCurrentProject();
2279 2211
         $archives = new ArrayList();
2280 2212
         foreach ($project->DNEnvironmentList() as $env) {
@@ -2290,8 +2222,7 @@  discard block
 block discarded – undo
2290 2222
     /**
2291 2223
      * @return PaginatedList
2292 2224
      */
2293
-    public function DataTransferLogs()
2294
-    {
2225
+    public function DataTransferLogs() {
2295 2226
         $project = $this->getCurrentProject();
2296 2227
 
2297 2228
         $transfers = DNDataTransfer::get()->filterByCallback(function ($record) use ($project) {
@@ -2311,8 +2242,7 @@  discard block
 block discarded – undo
2311 2242
     /**
2312 2243
      * @return null|PaginatedList
2313 2244
      */
2314
-    public function DeployHistory()
2315
-    {
2245
+    public function DeployHistory() {
2316 2246
         if ($env = $this->getCurrentEnvironment()) {
2317 2247
             $history = $env->DeployHistory();
2318 2248
             if ($history->count() > 0) {
@@ -2327,8 +2257,7 @@  discard block
 block discarded – undo
2327 2257
     /**
2328 2258
      * @return SS_HTTPResponse
2329 2259
      */
2330
-    protected function project404Response()
2331
-    {
2260
+    protected function project404Response() {
2332 2261
         return new SS_HTTPResponse(
2333 2262
             "Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2334 2263
             404
@@ -2338,8 +2267,7 @@  discard block
 block discarded – undo
2338 2267
     /**
2339 2268
      * @return SS_HTTPResponse
2340 2269
      */
2341
-    protected function environment404Response()
2342
-    {
2270
+    protected function environment404Response() {
2343 2271
         $envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2344 2272
         return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2345 2273
     }
@@ -2350,8 +2278,7 @@  discard block
 block discarded – undo
2350 2278
      *
2351 2279
      * @return string
2352 2280
      */
2353
-    protected function sendResponse($status, $content)
2354
-    {
2281
+    protected function sendResponse($status, $content) {
2355 2282
         // strip excessive newlines
2356 2283
         $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
2357 2284
 
@@ -2374,8 +2301,7 @@  discard block
 block discarded – undo
2374 2301
      *
2375 2302
      * @param string $mode
2376 2303
      */
2377
-    protected function validateSnapshotMode($mode)
2378
-    {
2304
+    protected function validateSnapshotMode($mode) {
2379 2305
         if (!in_array($mode, array('all', 'assets', 'db'))) {
2380 2306
             throw new LogicException('Invalid mode');
2381 2307
         }
@@ -2387,8 +2313,7 @@  discard block
 block discarded – undo
2387 2313
      *
2388 2314
      * @return SS_HTTPResponse
2389 2315
      */
2390
-    protected function getCustomisedViewSection($sectionName, $title = '', $data = array())
2391
-    {
2316
+    protected function getCustomisedViewSection($sectionName, $title = '', $data = array()) {
2392 2317
         // Performs canView permission check by limiting visible projects
2393 2318
         $project = $this->getCurrentProject();
2394 2319
         if (!$project) {
@@ -2408,8 +2333,7 @@  discard block
 block discarded – undo
2408 2333
      *
2409 2334
      * @return ArrayList
2410 2335
      */
2411
-    public function AmbientMenu()
2412
-    {
2336
+    public function AmbientMenu() {
2413 2337
         $list = new ArrayList();
2414 2338
 
2415 2339
         if (Member::currentUserID()) {
@@ -2432,8 +2356,7 @@  discard block
 block discarded – undo
2432 2356
      *
2433 2357
      * @return SS_HTTPResponse
2434 2358
      */
2435
-    public function createproject(SS_HTTPRequest $request)
2436
-    {
2359
+    public function createproject(SS_HTTPRequest $request) {
2437 2360
         if ($this->canCreateProjects()) {
2438 2361
             return $this->render(['CurrentTitle' => 'Create Stack']);
2439 2362
         }
@@ -2445,8 +2368,7 @@  discard block
 block discarded – undo
2445 2368
      *
2446 2369
      * @return bool
2447 2370
      */
2448
-    public function canCreateProjects($member = null)
2449
-    {
2371
+    public function canCreateProjects($member = null) {
2450 2372
         if (!$member) {
2451 2373
             $member = Member::currentUser();
2452 2374
         }
@@ -2460,8 +2382,7 @@  discard block
 block discarded – undo
2460 2382
     /**
2461 2383
      * @return Form
2462 2384
      */
2463
-    public function CreateProjectForm()
2464
-    {
2385
+    public function CreateProjectForm() {
2465 2386
         $form = Form::create(
2466 2387
             $this,
2467 2388
             __FUNCTION__,
@@ -2476,8 +2397,7 @@  discard block
 block discarded – undo
2476 2397
     /**
2477 2398
      * @return FieldList
2478 2399
      */
2479
-    protected function getCreateProjectFormFields()
2480
-    {
2400
+    protected function getCreateProjectFormFields() {
2481 2401
         $fields = FieldList::create();
2482 2402
         $fields->merge([
2483 2403
             TextField::create('Name', 'Title')->setDescription('Limited to alphanumeric characters, underscores and hyphens.'),
@@ -2490,8 +2410,7 @@  discard block
 block discarded – undo
2490 2410
     /**
2491 2411
      * @return FieldList
2492 2412
      */
2493
-    protected function getCreateProjectFormActions()
2494
-    {
2413
+    protected function getCreateProjectFormActions() {
2495 2414
         $fields = FieldList::create(
2496 2415
             FormAction::create('doCreateProject', 'Create Stack')
2497 2416
         );
@@ -2507,8 +2426,7 @@  discard block
 block discarded – undo
2507 2426
      *
2508 2427
      * @return SS_HTTPResponse
2509 2428
      */
2510
-    public function doCreateProject($data, $form)
2511
-    {
2429
+    public function doCreateProject($data, $form) {
2512 2430
         $form->loadDataFrom($data);
2513 2431
         $project = DNProject::create();
2514 2432
 
@@ -2540,8 +2458,7 @@  discard block
 block discarded – undo
2540 2458
      *
2541 2459
      * @return SS_HTTPResponse
2542 2460
      */
2543
-    public function createprojectprogress(SS_HTTPRequest $request)
2544
-    {
2461
+    public function createprojectprogress(SS_HTTPRequest $request) {
2545 2462
         $project = $this->getCurrentProject();
2546 2463
         if (!$project) {
2547 2464
             return $this->httpError(404);
@@ -2591,8 +2508,7 @@  discard block
 block discarded – undo
2591 2508
         return $response;
2592 2509
     }
2593 2510
 
2594
-    public function checkrepoaccess(SS_HTTPRequest $request)
2595
-    {
2511
+    public function checkrepoaccess(SS_HTTPRequest $request) {
2596 2512
         $project = $this->getCurrentProject();
2597 2513
         if (!$project) {
2598 2514
             return $this->httpError(404);
Please login to merge, or discard this patch.
code/control/DeployForm.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,16 +6,14 @@  discard block
 block discarded – undo
6 6
  * @package deploynaut
7 7
  * @subpackage control
8 8
  */
9
-abstract class DeployForm_ValidatorBase extends Validator
10
-{
9
+abstract class DeployForm_ValidatorBase extends Validator {
11 10
 
12 11
     /**
13 12
      * @param string $fieldName
14 13
      * @param string $message
15 14
      * @param string $messageType
16 15
      */
17
-    public function validationError($fieldName, $message, $messageType = '')
18
-    {
16
+    public function validationError($fieldName, $message, $messageType = '') {
19 17
         // Just make any error use the form message
20 18
         $this->form->sessionMessage($message, $messageType);
21 19
         parent::validationError($fieldName, $message, $messageType);
@@ -28,8 +26,7 @@  discard block
 block discarded – undo
28 26
      * @param string $field
29 27
      * @return boolean
30 28
      */
31
-    protected function validateCommit($sha, $field)
32
-    {
29
+    protected function validateCommit($sha, $field) {
33 30
         // Check selected commit
34 31
         if (empty($sha)) {
35 32
             $this->validationError(
@@ -60,11 +57,9 @@  discard block
 block discarded – undo
60 57
  * @package deploynaut
61 58
  * @subpackage control
62 59
  */
63
-class DeployForm_CommitValidator extends DeployForm_ValidatorBase
64
-{
60
+class DeployForm_CommitValidator extends DeployForm_ValidatorBase {
65 61
 
66
-    public function php($data)
67
-    {
62
+    public function php($data) {
68 63
         // Check release method
69 64
         if (empty($data['SelectRelease'])
70 65
             || !in_array($data['SelectRelease'], array('Tag', 'Branch', 'Redeploy', 'SHA', 'FilteredCommits'))
@@ -92,11 +87,9 @@  discard block
 block discarded – undo
92 87
  * @package deploynaut
93 88
  * @subpackage control
94 89
  */
95
-class DeployForm_PipelineValidator extends DeployForm_ValidatorBase
96
-{
90
+class DeployForm_PipelineValidator extends DeployForm_ValidatorBase {
97 91
 
98
-    public function php($data)
99
-    {
92
+    public function php($data) {
100 93
         return $this->validateCommit(
101 94
             $this->form->getSelectedBuild($data),
102 95
             'FilteredCommits'
@@ -110,8 +103,7 @@  discard block
 block discarded – undo
110 103
  * @package deploynaut
111 104
  * @subpackage control
112 105
  */
113
-class DeployForm extends Form
114
-{
106
+class DeployForm extends Form {
115 107
 
116 108
     /**
117 109
      * @param DNRoot $controller
@@ -119,8 +111,7 @@  discard block
 block discarded – undo
119 111
      * @param DNEnvironment $environment
120 112
      * @param DNProject $project
121 113
      */
122
-    public function __construct($controller, $name, DNEnvironment $environment, DNProject $project)
123
-    {
114
+    public function __construct($controller, $name, DNEnvironment $environment, DNProject $project) {
124 115
         if ($environment->HasPipelineSupport()) {
125 116
             list($field, $validator, $actions) = $this->setupPipeline($environment, $project);
126 117
         } else {
@@ -134,8 +125,7 @@  discard block
 block discarded – undo
134 125
      *
135 126
      * @return array
136 127
      */
137
-    protected function setupSimpleDeploy(DNProject $project)
138
-    {
128
+    protected function setupSimpleDeploy(DNProject $project) {
139 129
         // without a pipeline simply allow any commit to be selected
140 130
         $field = $this->buildCommitSelector($project);
141 131
         $validator = new DeployForm_CommitValidator();
@@ -153,8 +143,7 @@  discard block
 block discarded – undo
153 143
      * @return array
154 144
      * @throws Exception
155 145
      */
156
-    protected function setupPipeline(DNEnvironment $environment, DNProject $project)
157
-    {
146
+    protected function setupPipeline(DNEnvironment $environment, DNProject $project) {
158 147
         // Determine if commits are filtered
159 148
         $canBypass = Permission::check(DNRoot::DEPLOYNAUT_BYPASS_PIPELINE);
160 149
         $canDryrun = $environment->DryRunEnabled && Permission::check(DNRoot::DEPLOYNAUT_DRYRUN_PIPELINE);
@@ -214,8 +203,7 @@  discard block
 block discarded – undo
214 203
      * @param DataList|null $pipelineCommits Optional list of pipeline-filtered commits to include
215 204
      * @return FormField
216 205
      */
217
-    protected function buildCommitSelector($project, $pipelineCommits = null)
218
-    {
206
+    protected function buildCommitSelector($project, $pipelineCommits = null) {
219 207
         // Branches
220 208
         $branches = array();
221 209
         foreach ($project->DNBranchList() as $branch) {
@@ -310,8 +298,7 @@  discard block
 block discarded – undo
310 298
      * @param DataList $commits List of commits
311 299
      * @return FormField
312 300
      */
313
-    protected function buildPipelineField($commits)
314
-    {
301
+    protected function buildPipelineField($commits) {
315 302
         // Get filtered commits
316 303
         $filteredCommits = array();
317 304
         foreach ($commits as $commit) {
@@ -338,8 +325,7 @@  discard block
 block discarded – undo
338 325
      * @param array $data
339 326
      * @return string SHA of selected build
340 327
      */
341
-    public function getSelectedBuild($data)
342
-    {
328
+    public function getSelectedBuild($data) {
343 329
         if (isset($data['SelectRelease']) && !empty($data[$data['SelectRelease']])) {
344 330
             // Filter out the tag/branch name if required
345 331
             $array = explode('-', $data[$data['SelectRelease']]);
Please login to merge, or discard this patch.
code/control/DeploynautLogFile.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Simple support class for reading and writing deploynaut job logs
5 5
  */
6
-class DeploynautLogFile
7
-{
6
+class DeploynautLogFile {
8 7
 
9 8
     protected $logFile;
10 9
 
@@ -14,8 +13,7 @@  discard block
 block discarded – undo
14 13
      * @param string $logFile The log filename
15 14
      * @param string|null $basePath Base path of where logs reside. Defaults to DEPLOYNAUT_LOG_PATH
16 15
      */
17
-    public function __construct($logFile, $basePath = null)
18
-    {
16
+    public function __construct($logFile, $basePath = null) {
19 17
         $this->logFile = $logFile;
20 18
         $this->basePath = $basePath ?: DEPLOYNAUT_LOG_PATH;
21 19
     }
@@ -24,8 +22,7 @@  discard block
 block discarded – undo
24 22
      * Set the log filename
25 23
      * @param string $filename
26 24
      */
27
-    public function setLogFile($filename)
28
-    {
25
+    public function setLogFile($filename) {
29 26
         $this->logFile = $filename;
30 27
     }
31 28
 
@@ -33,8 +30,7 @@  discard block
 block discarded – undo
33 30
      * Set the base path of where logs reside
34 31
      * @param string $path
35 32
      */
36
-    public function setBasePath($path)
37
-    {
33
+    public function setBasePath($path) {
38 34
         $this->basePath = $path;
39 35
     }
40 36
 
@@ -42,8 +38,7 @@  discard block
 block discarded – undo
42 38
      * Return the un-sanitised log path.
43 39
      * @return string
44 40
      */
45
-    public function getRawFilePath()
46
-    {
41
+    public function getRawFilePath() {
47 42
         return $this->basePath . '/' . $this->logFile;
48 43
     }
49 44
 
@@ -51,8 +46,7 @@  discard block
 block discarded – undo
51 46
      * Get the sanitised log path.
52 47
      * @return string
53 48
      */
54
-    public function getSanitisedLogFilePath()
55
-    {
49
+    public function getSanitisedLogFilePath() {
56 50
         return $this->basePath . '/' . strtolower(FileNameFilter::create()->filter($this->logFile));
57 51
     }
58 52
 
@@ -60,8 +54,7 @@  discard block
 block discarded – undo
60 54
      * Return log file path, assuming it exists. Returns NULL if nothing found.
61 55
      * @return string|null
62 56
      */
63
-    public function getLogFilePath()
64
-    {
57
+    public function getLogFilePath() {
65 58
         $path = $this->getSanitisedLogFilePath();
66 59
 
67 60
         // for backwards compatibility on old logs
@@ -80,8 +73,7 @@  discard block
 block discarded – undo
80 73
      * Write a message line into the log file.
81 74
      * @param string $message
82 75
      */
83
-    public function write($message)
84
-    {
76
+    public function write($message) {
85 77
         // Make sure we write into the old path for existing logs. New logs use the sanitised file path instead.
86 78
         $path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath();
87 79
 
@@ -93,8 +85,7 @@  discard block
 block discarded – undo
93 85
      * Does the log file exist?
94 86
      * @return bool
95 87
      */
96
-    public function exists()
97
-    {
88
+    public function exists() {
98 89
         return (bool)$this->getLogFilePath();
99 90
     }
100 91
 
@@ -102,8 +93,7 @@  discard block
 block discarded – undo
102 93
      * Return the content of the log file.
103 94
      * @return string
104 95
      */
105
-    public function content()
106
-    {
96
+    public function content() {
107 97
         return $this->exists() ? file_get_contents($this->getLogFilePath()) : 'Log has not been created yet.';
108 98
     }
109 99
 }
Please login to merge, or discard this patch.