@@ -41,7 +41,7 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * |
| 43 | 43 | * @param SS_HTTPRequest $request |
| 44 | - * @return string |
|
| 44 | + * @return SS_HTTPResponse |
|
| 45 | 45 | */ |
| 46 | 46 | public function listProjects(SS_HTTPRequest $request) { |
| 47 | 47 | $response = array( |
@@ -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())) { |
@@ -300,6 +300,7 @@ |
||
| 300 | 300 | /** |
| 301 | 301 | * Utility function for triggering the db rebuild and flush. |
| 302 | 302 | * Also cleans up and generates new error pages. |
| 303 | + * @param DeploynautLogFile $log |
|
| 303 | 304 | */ |
| 304 | 305 | public function rebuild(DNEnvironment $environment, $log) { |
| 305 | 306 | $name = $environment->getFullName(); |
@@ -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 | |
@@ -10,6 +10,7 @@ discard block |
||
| 10 | 10 | * @param DeploynautLogFile $log |
| 11 | 11 | * @param DNProject $project |
| 12 | 12 | * @param type $leaveMaintenancePage |
| 13 | + * @return void |
|
| 13 | 14 | */ |
| 14 | 15 | public function deploy(DNEnvironment $environment, $sha, DeploynautLogFile $log, DNProject $project, $leaveMaintenancePage = false); |
| 15 | 16 | |
@@ -19,6 +20,7 @@ discard block |
||
| 19 | 20 | * |
| 20 | 21 | * @param DNDataTransfer $dataTransfer |
| 21 | 22 | * @param DeploynautLogFile $log |
| 23 | + * @return void |
|
| 22 | 24 | */ |
| 23 | 25 | public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log); |
| 24 | 26 | |
@@ -28,6 +30,7 @@ discard block |
||
| 28 | 30 | * @param DNEnvironment $environment |
| 29 | 31 | * @param DeploynautLogFile $log |
| 30 | 32 | * @param DNProject $project |
| 33 | + * @return void |
|
| 31 | 34 | */ |
| 32 | 35 | public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project); |
| 33 | 36 | |
@@ -37,6 +40,7 @@ discard block |
||
| 37 | 40 | * @param DNEnvironment $environment |
| 38 | 41 | * @param DeploynautLogFile $log |
| 39 | 42 | * @param DNProject $project |
| 43 | + * @return void |
|
| 40 | 44 | */ |
| 41 | 45 | public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project); |
| 42 | 46 | |
@@ -46,6 +50,7 @@ discard block |
||
| 46 | 50 | * @param DNEnvironment $environment |
| 47 | 51 | * @param DeploynautLogFile $log |
| 48 | 52 | * @param DNProject $project |
| 53 | + * @return void |
|
| 49 | 54 | */ |
| 50 | 55 | public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project); |
| 51 | 56 | |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * Generate the package file, saving to the given location |
| 15 | 15 | * |
| 16 | - * @param $baseDir string The base directory of the project, checked out from git. |
|
| 16 | + * @param string $baseDir string The base directory of the project, checked out from git. |
|
| 17 | 17 | * @param $outputFilename string The filename to write to. |
| 18 | + * @param string $sha |
|
| 18 | 19 | * |
| 19 | 20 | * @return boolean True on success |
| 20 | 21 | */ |
@@ -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 | } |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | /** |
| 73 | 73 | * Take the identifier an make it safe to use as a directory name. |
| 74 | 74 | * |
| 75 | - * @param string $identfiier The unsanitised directory name. |
|
| 75 | + * @param string $identifier The unsanitised directory name. |
|
| 76 | 76 | */ |
| 77 | 77 | protected function sanitiseDirName($identifier) { |
| 78 | 78 | $safe = preg_replace('/[^A-Za-z0-9_-]/', '', $identifier); |
@@ -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 | } |
@@ -18,6 +18,7 @@ discard block |
||
| 18 | 18 | * Validate a commit sha |
| 19 | 19 | * |
| 20 | 20 | * @param string $sha |
| 21 | + * @param string $field |
|
| 21 | 22 | * @return boolean |
| 22 | 23 | */ |
| 23 | 24 | protected function validateCommit($sha, $field) { |
@@ -100,6 +101,10 @@ discard block |
||
| 100 | 101 | */ |
| 101 | 102 | class DeployForm extends Form { |
| 102 | 103 | |
| 104 | + /** |
|
| 105 | + * @param DNRoot $controller |
|
| 106 | + * @param string $name |
|
| 107 | + */ |
|
| 103 | 108 | public function __construct($controller, $name, DNEnvironment $environment, DNProject $project) { |
| 104 | 109 | if($environment->HasPipelineSupport()) { |
| 105 | 110 | // Determine if commits are filtered |
@@ -261,7 +266,6 @@ discard block |
||
| 261 | 266 | /** |
| 262 | 267 | * Generate fields necessary to select from a filtered commit list |
| 263 | 268 | * |
| 264 | - * @param DNEnvironment $environment |
|
| 265 | 269 | * @param DataList $commits List of commits |
| 266 | 270 | * @return FormField |
| 267 | 271 | */ |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Check validity of commit |
| 35 | - if (!preg_match('/^[a-f0-9]{40}$/', $sha)) { |
|
| 35 | + if(!preg_match('/^[a-f0-9]{40}$/', $sha)) { |
|
| 36 | 36 | $this->validationError( |
| 37 | 37 | $field, |
| 38 | 38 | "Invalid release SHA: " . Convert::raw2xml($sha), |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ->setAttribute('onclick', |
| 144 | 144 | "return confirm('This will begin a release pipeline, but with the following exclusions:\\n" . |
| 145 | 145 | " - No messages will be sent\\n" . |
| 146 | - " - No capistrano actions will be invoked\\n". |
|
| 146 | + " - No capistrano actions will be invoked\\n" . |
|
| 147 | 147 | " - No deployments or snapshots will be created.');" |
| 148 | 148 | ) |
| 149 | 149 | ); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | FormAction::create('doDeploy', "Direct deployment (bypass pipeline)") |
| 154 | 154 | ->addExtraClass('btn btn-warning') |
| 155 | 155 | ->setAttribute('onclick', |
| 156 | - "return confirm('This will start a direct deployment, bypassing the pipeline ". |
|
| 156 | + "return confirm('This will start a direct deployment, bypassing the pipeline " . |
|
| 157 | 157 | "process in place.\\n\\nAre you sure this is necessary?');" |
| 158 | 158 | ) |
| 159 | 159 | ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | foreach($project->DNBranchList() as $branch) { |
| 189 | 189 | $sha = $branch->SHA(); |
| 190 | 190 | $name = $branch->Name(); |
| 191 | - $branches[$sha . '-' . $name] = $name . ' (' . substr($sha,0,8) . ', ' . $branch->LastUpdated()->TimeDiff() . ' old)'; |
|
| 191 | + $branches[$sha . '-' . $name] = $name . ' (' . substr($sha, 0, 8) . ', ' . $branch->LastUpdated()->TimeDiff() . ' old)'; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Tags |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | foreach($project->DNTagList()->setLimit(null) as $tag) { |
| 197 | 197 | $sha = $tag->SHA(); |
| 198 | 198 | $name = $tag->Name(); |
| 199 | - $tags[$sha . '-' . $tag] = $name . ' (' . substr($sha,0,8) . ', ' . $tag->Created()->TimeDiff() . ' old)'; |
|
| 199 | + $tags[$sha . '-' . $tag] = $name . ' (' . substr($sha, 0, 8) . ', ' . $tag->Created()->TimeDiff() . ' old)'; |
|
| 200 | 200 | } |
| 201 | 201 | $tags = array_reverse($tags); |
| 202 | 202 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $redeploy[$envName] = array(); |
| 211 | 211 | } |
| 212 | 212 | if(!isset($redeploy[$envName][$sha])) { |
| 213 | - $redeploy[$envName][$sha] = substr($sha,0,8) . ' (deployed ' . $deploy->obj('LastEdited')->Ago() . ')'; |
|
| 213 | + $redeploy[$envName][$sha] = substr($sha, 0, 8) . ' (deployed ' . $deploy->obj('LastEdited')->Ago() . ')'; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | protected function buildPipelineField($commits) { |
| 269 | 269 | // Get filtered commits |
| 270 | 270 | $filteredCommits = array(); |
| 271 | - foreach ($commits as $commit) { |
|
| 271 | + foreach($commits as $commit) { |
|
| 272 | 272 | $title = sprintf( |
| 273 | 273 | "%s (%s, %s old)", |
| 274 | 274 | $commit->Message, |
| 275 | - substr($commit->SHA,0,8), |
|
| 275 | + substr($commit->SHA, 0, 8), |
|
| 276 | 276 | $commit->dbObject('Created')->TimeDiff() |
| 277 | 277 | ); |
| 278 | 278 | $filteredCommits[$commit->SHA] = $title; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | /** |
| 162 | 162 | * Action |
| 163 | 163 | * |
| 164 | - * @return string - HTML |
|
| 164 | + * @return HTMLText - HTML |
|
| 165 | 165 | */ |
| 166 | 166 | public function projects(SS_HTTPRequest $request) { |
| 167 | 167 | // Performs canView permission check by limiting visible projects in DNProjectsList() call. |
@@ -854,6 +854,7 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | + * @param SS_HTTPRequest $request |
|
| 857 | 858 | * @return Form |
| 858 | 859 | */ |
| 859 | 860 | public function getDataTransferForm($request) { |
@@ -1189,6 +1190,8 @@ discard block |
||
| 1189 | 1190 | |
| 1190 | 1191 | /** |
| 1191 | 1192 | * Build snapshot move form. |
| 1193 | + * @param SS_HTTPRequest $request |
|
| 1194 | + * @param DataObject $dataArchive |
|
| 1192 | 1195 | */ |
| 1193 | 1196 | public function getMoveForm($request, $dataArchive = null) { |
| 1194 | 1197 | $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID')); |
@@ -1330,7 +1333,7 @@ discard block |
||
| 1330 | 1333 | * TODO To be replaced with a method that just returns the list of archives this {@link Member} has access to. |
| 1331 | 1334 | * |
| 1332 | 1335 | * @param Member $member The {@link Member} to check (or null to check the currently logged in Member) |
| 1333 | - * @return boolean true if $member has access to upload or download to at least one {@link DNEnvironment}. |
|
| 1336 | + * @return boolean|null true if $member has access to upload or download to at least one {@link DNEnvironment}. |
|
| 1334 | 1337 | */ |
| 1335 | 1338 | public function CanViewArchives(Member $member = null) { |
| 1336 | 1339 | if(!$member) $member = Member::currentUser(); |
@@ -1357,7 +1360,7 @@ discard block |
||
| 1357 | 1360 | } |
| 1358 | 1361 | |
| 1359 | 1362 | /** |
| 1360 | - * @return ArrayList The list of all archive files that can be accessed by the currently logged-in {@link Member} |
|
| 1363 | + * @return PaginatedList The list of all archive files that can be accessed by the currently logged-in {@link Member} |
|
| 1361 | 1364 | */ |
| 1362 | 1365 | public function CompleteDataArchives() { |
| 1363 | 1366 | $project = $this->getCurrentProject(); |
@@ -1375,7 +1378,7 @@ discard block |
||
| 1375 | 1378 | } |
| 1376 | 1379 | |
| 1377 | 1380 | /** |
| 1378 | - * @return ArrayList The list of "pending" data archives which are waiting for a file |
|
| 1381 | + * @return PaginatedList The list of "pending" data archives which are waiting for a file |
|
| 1379 | 1382 | * to be delivered offline by post, and manually uploaded into the system. |
| 1380 | 1383 | */ |
| 1381 | 1384 | public function PendingDataArchives() { |
@@ -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); |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | * |
| 85 | 85 | * @param PipelineStep $source Client step |
| 86 | 86 | * @param string $from |
| 87 | - * @param string|Member $to |
|
| 87 | + * @param string $to |
|
| 88 | 88 | * @param string $subject |
| 89 | 89 | * @param string $body |
| 90 | 90 | */ |
@@ -919,6 +919,9 @@ |
||
| 919 | 919 | $fields->insertAfter($createConfigField, 'noDeployConfig'); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | + /** |
|
| 923 | + * @param FieldList $fields |
|
| 924 | + */ |
|
| 922 | 925 | protected function setPipelineConfigurationFields($fields) { |
| 923 | 926 | if(!$this->config()->get('allow_web_editing')) { |
| 924 | 927 | return; |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | "CanBackupGroups" => "Group", |
| 108 | 108 | "ArchiveUploaders" => "Member", // Who can upload archive files linked to this environment |
| 109 | 109 | "ArchiveUploaderGroups" => "Group", |
| 110 | - "ArchiveDownloaders" => "Member", // Who can download archive files from this environment |
|
| 110 | + "ArchiveDownloaders" => "Member", // Who can download archive files from this environment |
|
| 111 | 111 | "ArchiveDownloaderGroups" => "Group", |
| 112 | - "ArchiveDeleters" => "Member", // Who can delete archive files from this environment, |
|
| 112 | + "ArchiveDeleters" => "Member", // Who can delete archive files from this environment, |
|
| 113 | 113 | "ArchiveDeleterGroups" => "Group", |
| 114 | 114 | "PipelineApprovers" => "Member", // Who can approve / reject pipelines from this environment |
| 115 | 115 | "PipelineApproverGroups" => "Group", |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function CanCancelPipeline() { |
| 293 | 293 | // do we have a current pipeline |
| 294 | - if ($this->HasCurrentPipeline()) { |
|
| 294 | + if($this->HasCurrentPipeline()) { |
|
| 295 | 295 | return $this->CurrentPipeline()->canAbort(); |
| 296 | 296 | } |
| 297 | 297 | return false; |
@@ -599,22 +599,22 @@ discard block |
||
| 599 | 599 | // The DeployHistory function is far too slow to use for this |
| 600 | 600 | $deploy = DNDeployment::get()->filter(array('EnvironmentID' => $this->ID, 'Status' => 'Finished'))->sort('LastEdited DESC')->first(); |
| 601 | 601 | |
| 602 | - if (!$deploy || (!$deploy->SHA)) { |
|
| 602 | + if(!$deploy || (!$deploy->SHA)) { |
|
| 603 | 603 | return false; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | $repo = $this->Project()->getRepository(); |
| 607 | - if (!$repo) { |
|
| 607 | + if(!$repo) { |
|
| 608 | 608 | return $deploy; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | try { |
| 612 | 612 | $commit = $repo->getCommit($deploy->SHA); |
| 613 | - if ($commit) { |
|
| 613 | + if($commit) { |
|
| 614 | 614 | $deploy->Message = Convert::raw2xml($commit->getMessage()); |
| 615 | 615 | } |
| 616 | 616 | // We can't find this SHA, so we ignore adding a commit message to the deployment |
| 617 | - } catch (Exception $ex) { } |
|
| 617 | + } catch(Exception $ex) { } |
|
| 618 | 618 | |
| 619 | 619 | return $deploy; |
| 620 | 620 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $deploy->Message = Convert::raw2xml($commit->getMessage()); |
| 645 | 645 | } |
| 646 | 646 | // We can't find this SHA, so we ignore adding a commit message to the deployment |
| 647 | - } catch (Exception $ex) { } |
|
| 647 | + } catch(Exception $ex) { } |
|
| 648 | 648 | $ammendedHistory->push($deploy); |
| 649 | 649 | } |
| 650 | 650 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | * @return string |
| 683 | 683 | */ |
| 684 | 684 | public function Link() { |
| 685 | - return $this->Project()->Link()."/environment/" . $this->Name; |
|
| 685 | + return $this->Project()->Link() . "/environment/" . $this->Name; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | // Add actions |
| 888 | 888 | $action = new FormAction('check', 'Check Connection'); |
| 889 | 889 | $action->setUseButtonTag(true); |
| 890 | - $action->setAttribute('data-url', Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping'); |
|
| 890 | + $action->setAttribute('data-url', Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping'); |
|
| 891 | 891 | $fields->insertBefore($action, 'Name'); |
| 892 | 892 | |
| 893 | 893 | // Allow extensions |
@@ -950,8 +950,8 @@ discard block |
||
| 950 | 950 | */ |
| 951 | 951 | public function onBeforeWrite() { |
| 952 | 952 | parent::onBeforeWrite(); |
| 953 | - if($this->Name && $this->Name.'.rb' != $this->Filename) { |
|
| 954 | - $this->Filename = $this->Name.'.rb'; |
|
| 953 | + if($this->Name && $this->Name . '.rb' != $this->Filename) { |
|
| 954 | + $this->Filename = $this->Name . '.rb'; |
|
| 955 | 955 | } |
| 956 | 956 | $this->checkEnvironmentPath(); |
| 957 | 957 | $this->writeConfigFile(); |
@@ -976,11 +976,11 @@ discard block |
||
| 976 | 976 | if(!$this->config()->get('allow_web_editing')) return; |
| 977 | 977 | |
| 978 | 978 | // Create a basic new environment config from a template |
| 979 | - if( !$this->envFileExists() |
|
| 979 | + if(!$this->envFileExists() |
|
| 980 | 980 | && $this->Filename |
| 981 | 981 | && $this->CreateEnvConfig |
| 982 | 982 | ) { |
| 983 | - $templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template'; |
|
| 983 | + $templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template'; |
|
| 984 | 984 | file_put_contents($this->getConfigFilename(), file_get_contents($templateFile)); |
| 985 | 985 | } else if($this->envFileExists() && $this->DeployConfig) { |
| 986 | 986 | file_put_contents($this->getConfigFilename(), $this->DeployConfig); |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | if(!$this->Filename) { |
| 1048 | 1048 | return ''; |
| 1049 | 1049 | } |
| 1050 | - return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename; |
|
| 1050 | + return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
@@ -1126,10 +1126,10 @@ discard block |
||
| 1126 | 1126 | $filter = isset($config->PipelineConfig->FilteredCommits) |
| 1127 | 1127 | ? $config->PipelineConfig->FilteredCommits |
| 1128 | 1128 | : null; |
| 1129 | - if (empty($filter)) return null; |
|
| 1129 | + if(empty($filter)) return null; |
|
| 1130 | 1130 | |
| 1131 | 1131 | // Create and execute filter |
| 1132 | - if (!class_exists($filter)) throw new Exception(sprintf("Class %s does not exist", $filter)); |
|
| 1132 | + if(!class_exists($filter)) throw new Exception(sprintf("Class %s does not exist", $filter)); |
|
| 1133 | 1133 | $commitClass = $filter::create(); |
| 1134 | 1134 | // setup the environment to check for commits |
| 1135 | 1135 | $commitClass->env = $dependsOnEnv; |