@@ -49,7 +49,7 @@ |
||
49 | 49 | 'projects' => array(), |
50 | 50 | ); |
51 | 51 | |
52 | - if($request->httpMethod() != 'GET') return $this->message('API not found', 404);; |
|
52 | + if($request->httpMethod() != 'GET') return $this->message('API not found', 404); ; |
|
53 | 53 | |
54 | 54 | foreach(DNProject::get() as $item) { |
55 | 55 | if($item->canView($this->getMember())) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | "href" => "$href/deploy", |
39 | 39 | "type" => "application/json", |
40 | 40 | "fields" => array( |
41 | - array( "name" => "release", "type" => "text" ), |
|
41 | + array("name" => "release", "type" => "text"), |
|
42 | 42 | ), |
43 | 43 | ) |
44 | 44 | ) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $ping->write(); |
127 | 127 | $ping->start(); |
128 | 128 | |
129 | - $location = Director::absoluteBaseURL().$this->Link().'/ping/'.$ping->ID; |
|
129 | + $location = Director::absoluteBaseURL() . $this->Link() . '/ping/' . $ping->ID; |
|
130 | 130 | $output = array( |
131 | 131 | 'message' => 'Ping queued as job ' . $ping->ResqueToken, |
132 | 132 | 'href' => $location, |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $deploy->SHA = $reqBody['release']; |
181 | 181 | $deploy->write(); |
182 | 182 | $deploy->start(); |
183 | - $location = Director::absoluteBaseURL().$this->Link().'/deploy/'.$deploy->ID; |
|
183 | + $location = Director::absoluteBaseURL() . $this->Link() . '/deploy/' . $deploy->ID; |
|
184 | 184 | $output = array( |
185 | 185 | 'message' => 'Deploy queued as job ' . $deploy->ResqueToken, |
186 | 186 | 'href' => $location, |
@@ -119,7 +119,7 @@ |
||
119 | 119 | * @return SS_HTTPResponse |
120 | 120 | */ |
121 | 121 | protected function message($message, $statusCode) { |
122 | - $response = $this->getAPIResponse(array( |
|
122 | + $response = $this->getAPIResponse(array( |
|
123 | 123 | 'message' => $message, |
124 | 124 | 'statusCode' => $statusCode |
125 | 125 | )); |
@@ -97,7 +97,7 @@ |
||
97 | 97 | $fetch->write(); |
98 | 98 | $fetch->start(); |
99 | 99 | |
100 | - $location = Director::absoluteBaseURL().$this->Link().'/fetch/'.$fetch->ID; |
|
100 | + $location = Director::absoluteBaseURL() . $this->Link() . '/fetch/' . $fetch->ID; |
|
101 | 101 | $output = array( |
102 | 102 | 'message' => 'Ping queued as job ' . $fetch->ResqueToken, |
103 | 103 | 'href' => $location, |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $env = $environment->Project()->getProcessEnv(); |
178 | 178 | |
179 | 179 | if(!$args) $args = array(); |
180 | - $args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH.'/'); |
|
180 | + $args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH . '/'); |
|
181 | 181 | |
182 | 182 | // Inject env string directly into the command. |
183 | 183 | // Capistrano doesn't like the $process->setEnv($env) we'd normally do below. |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $data = DNData::inst(); |
193 | 193 | // Generate a capfile from a template |
194 | - $capTemplate = file_get_contents(BASE_PATH.'/deploynaut/Capfile.template'); |
|
194 | + $capTemplate = file_get_contents(BASE_PATH . '/deploynaut/Capfile.template'); |
|
195 | 195 | $cap = str_replace( |
196 | 196 | array('<config root>', '<ssh key>', '<base path>'), |
197 | 197 | array($data->getEnvironmentDir(), DEPLOYNAUT_SSH_KEY, BASE_PATH), |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if(defined('DEPLOYNAUT_CAPFILE')) { |
202 | 202 | $capFile = DEPLOYNAUT_CAPFILE; |
203 | 203 | } else { |
204 | - $capFile = ASSETS_PATH.'/Capfile'; |
|
204 | + $capFile = ASSETS_PATH . '/Capfile'; |
|
205 | 205 | } |
206 | 206 | file_put_contents($capFile, $cap); |
207 | 207 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | // Default, cacheless implementation |
55 | 55 | } else { |
56 | - $filename = TEMP_FOLDER .'/' . $sha . '.tar.gz'; |
|
56 | + $filename = TEMP_FOLDER . '/' . $sha . '.tar.gz'; |
|
57 | 57 | if($this->generatePackage($sha, $repositoryDir, $outputFilename, $log)) { |
58 | 58 | return $filename; |
59 | 59 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function getIdentifier() { |
27 | 27 | // If the build script changes, don't re-use cached items |
28 | - return substr(sha1($this->buildScript),0,8); |
|
28 | + return substr(sha1($this->buildScript), 0, 8); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function executeProcesses($processes, DeploynautLogFile $log) { |
74 | 74 | foreach($processes as $process) { |
75 | - $process->mustRun(function ($type, $buffer) use($log) { |
|
75 | + $process->mustRun(function($type, $buffer) use($log) { |
|
76 | 76 | $log->write($buffer); |
77 | 77 | }); |
78 | 78 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return $filename; |
62 | 62 | |
63 | 63 | } else { |
64 | - if($this->cacheSize) $this->reduceDirSizeTo($buildPath, $this->cacheSize-1, $log); |
|
64 | + if($this->cacheSize) $this->reduceDirSizeTo($buildPath, $this->cacheSize - 1, $log); |
|
65 | 65 | |
66 | 66 | if($generator->generatePackage($sha, $repositoryDir, $filename, $log)) { |
67 | 67 | return $filename; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return filemtime($a) > filemtime($b); |
95 | 95 | }); |
96 | 96 | |
97 | - for($i=0;$i<sizeof($files)-$count;$i++) { |
|
97 | + for($i = 0; $i < sizeof($files) - $count; $i++) { |
|
98 | 98 | $log->write("Removing " . $files[$i] . " from package cache"); |
99 | 99 | unlink($files[$i]); |
100 | 100 | } |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | * @return boolean |
108 | 108 | */ |
109 | 109 | public static function FlagSnapshotsEnabled() { |
110 | - if (defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) return true; |
|
111 | - if (defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) { |
|
110 | + if(defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) return true; |
|
111 | + if(defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) { |
|
112 | 112 | $allowedMembers = explode(';', FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS); |
113 | 113 | $member = Member::currentUser(); |
114 | - if ($allowedMembers && $member && in_array($member->Email, $allowedMembers)) return true; |
|
114 | + if($allowedMembers && $member && in_array($member->Email, $allowedMembers)) return true; |
|
115 | 115 | } |
116 | 116 | return false; |
117 | 117 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ) |
139 | 139 | ); |
140 | 140 | |
141 | - Requirements::css(FRAMEWORK_ADMIN_DIR .'/thirdparty/chosen/chosen/chosen.css'); |
|
141 | + Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | // Framing an environment as a "group of people with download access" |
266 | 266 | // makes more sense to the user here, while still allowing us to enforce |
267 | 267 | // environment specific restrictions on downloading the file later on. |
268 | - $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {return $item->canUploadArchive();}); |
|
268 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {return $item->canUploadArchive(); }); |
|
269 | 269 | $envsMap = array(); |
270 | 270 | foreach($envs as $env) { |
271 | 271 | $envsMap[$env->ID] = $env->Name; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $form->disableSecurityToken(); |
294 | 294 | $form->addExtraClass('fields-wide'); |
295 | 295 | // Tweak the action so it plays well with our fake URL structure. |
296 | - $form->setFormAction($project->Link().'/UploadSnapshotForm'); |
|
296 | + $form->setFormAction($project->Link() . '/UploadSnapshotForm'); |
|
297 | 297 | |
298 | 298 | return $form; |
299 | 299 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | // Framing an environment as a "group of people with download access" |
413 | 413 | // makes more sense to the user here, while still allowing us to enforce |
414 | 414 | // environment specific restrictions on downloading the file later on. |
415 | - $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {return $item->canUploadArchive();}); |
|
415 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) {return $item->canUploadArchive(); }); |
|
416 | 416 | $envsMap = array(); |
417 | 417 | foreach($envs as $env) { |
418 | 418 | $envsMap[$env->ID] = $env->Name; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $form->disableSecurityToken(); |
435 | 435 | $form->addExtraClass('fields-wide'); |
436 | 436 | // Tweak the action so it plays well with our fake URL structure. |
437 | - $form->setFormAction($project->Link().'/PostSnapshotForm'); |
|
437 | + $form->setFormAction($project->Link() . '/PostSnapshotForm'); |
|
438 | 438 | |
439 | 439 | return $form; |
440 | 440 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | $validEnvs = $project->DNEnvironmentList() |
449 | - ->filterByCallback(function($item) {return $item->canUploadArchive();}); |
|
449 | + ->filterByCallback(function($item) {return $item->canUploadArchive(); }); |
|
450 | 450 | |
451 | 451 | // Validate $data['EnvironmentID'] by checking against $validEnvs. |
452 | 452 | $environment = $validEnvs->find('ID', $data['EnvironmentID']); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $form = new DeployForm($this, 'DeployForm', $environment, $project); |
746 | 746 | |
747 | 747 | // Tweak the action so it plays well with our fake URL structure. |
748 | - $form->setFormAction($request->getURL().'/DeployForm'); |
|
748 | + $form->setFormAction($request->getURL() . '/DeployForm'); |
|
749 | 749 | return $form; |
750 | 750 | } |
751 | 751 | |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | public function getDataTransferForm($request) { |
860 | 860 | // Performs canView permission check by limiting visible projects |
861 | 861 | $envs = $this->getCurrentProject()->DNEnvironmentList() |
862 | - ->filterByCallback(function($item) {return $item->canBackup();}); |
|
862 | + ->filterByCallback(function($item) {return $item->canBackup(); }); |
|
863 | 863 | if(!$envs) { |
864 | 864 | return new SS_HTTPResponse("Environment '" . Convert::raw2xml($request->latestParam('Environment')) . "' not found.", 404); |
865 | 865 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | FormAction::create('doDataTransfer', 'Create')->addExtraClass('btn') |
877 | 877 | ) |
878 | 878 | ); |
879 | - $form->setFormAction($request->getURL().'/DataTransferForm'); |
|
879 | + $form->setFormAction($request->getURL() . '/DataTransferForm'); |
|
880 | 880 | |
881 | 881 | return $form; |
882 | 882 | } |
@@ -892,12 +892,12 @@ discard block |
||
892 | 892 | $dataArchive = null; |
893 | 893 | |
894 | 894 | // Validate direction. |
895 | - if ($data['Direction']=='get') { |
|
895 | + if($data['Direction'] == 'get') { |
|
896 | 896 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
897 | - ->filterByCallback(function($item) {return $item->canBackup();}); |
|
898 | - } else if ($data['Direction']=='push') { |
|
897 | + ->filterByCallback(function($item) {return $item->canBackup(); }); |
|
898 | + } else if($data['Direction'] == 'push') { |
|
899 | 899 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
900 | - ->filterByCallback(function($item) {return $item->canRestore();}); |
|
900 | + ->filterByCallback(function($item) {return $item->canRestore(); }); |
|
901 | 901 | } else { |
902 | 902 | throw new LogicException('Invalid direction'); |
903 | 903 | } |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | } |
910 | 910 | |
911 | 911 | // Validate mode. |
912 | - if (!in_array($data['Mode'], array('all', 'assets', 'db'))) { |
|
912 | + if(!in_array($data['Mode'], array('all', 'assets', 'db'))) { |
|
913 | 913 | throw new LogicException('Invalid mode'); |
914 | 914 | } |
915 | 915 | |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | // Performs canView permission check by limiting visible projects |
1023 | 1023 | $project = $this->getCurrentProject(); |
1024 | 1024 | $envs = $project->DNEnvironmentList() |
1025 | - ->filterByCallback(function($item) {return $item->canRestore();}); |
|
1025 | + ->filterByCallback(function($item) {return $item->canRestore(); }); |
|
1026 | 1026 | |
1027 | 1027 | if(!$envs) { |
1028 | 1028 | return new SS_HTTPResponse("Environment '" . Convert::raw2xml($request->latestParam('Environment')) . "' not found.", 404); |