@@ -13,8 +13,7 @@ discard block |
||
| 13 | 13 | * DeploynautAPI > APIProject > APIEnvironment |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | -class DeploynautAPI extends APINoun |
|
| 17 | -{ |
|
| 16 | +class DeploynautAPI extends APINoun { |
|
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * Default URL handlers - (Action)/(ID)//(OtherID) |
@@ -46,8 +45,7 @@ discard block |
||
| 46 | 45 | * @param SS_HTTPRequest $request |
| 47 | 46 | * @return SS_HTTPResponse |
| 48 | 47 | */ |
| 49 | - public function listProjects(SS_HTTPRequest $request) |
|
| 50 | - { |
|
| 48 | + public function listProjects(SS_HTTPRequest $request) { |
|
| 51 | 49 | $response = array( |
| 52 | 50 | 'href' => Director::absoluteURL($this->Link()), |
| 53 | 51 | 'projects' => array(), |
@@ -75,8 +73,7 @@ discard block |
||
| 75 | 73 | * @param SS_HTTPRequest $request |
| 76 | 74 | * @return APIProject |
| 77 | 75 | */ |
| 78 | - public function project(SS_HTTPRequest $request) |
|
| 79 | - { |
|
| 76 | + public function project(SS_HTTPRequest $request) { |
|
| 80 | 77 | $project = $this->getProject(); |
| 81 | 78 | if (!$project) { |
| 82 | 79 | return $this->project404Response(); |
@@ -90,8 +87,7 @@ discard block |
||
| 90 | 87 | * @param SS_HTTPRequest $request |
| 91 | 88 | * @return APIEnvironment |
| 92 | 89 | */ |
| 93 | - public function environment(SS_HTTPRequest $request) |
|
| 94 | - { |
|
| 90 | + public function environment(SS_HTTPRequest $request) { |
|
| 95 | 91 | $project = $this->getProject(); |
| 96 | 92 | if (!$project) { |
| 97 | 93 | return $this->project404Response(); |
@@ -107,8 +103,7 @@ discard block |
||
| 107 | 103 | /** |
| 108 | 104 | * @return SS_HTTPResponse |
| 109 | 105 | */ |
| 110 | - protected function project404Response() |
|
| 111 | - { |
|
| 106 | + protected function project404Response() { |
|
| 112 | 107 | $projectName = Convert::raw2xml($this->getRequest()->latestParam('Project')); |
| 113 | 108 | return new SS_HTTPResponse('Project "' . $projectName . '" not found.', 404); |
| 114 | 109 | } |
@@ -116,8 +111,7 @@ discard block |
||
| 116 | 111 | /** |
| 117 | 112 | * @return SS_HTTPResponse |
| 118 | 113 | */ |
| 119 | - protected function environment404Response() |
|
| 120 | - { |
|
| 114 | + protected function environment404Response() { |
|
| 121 | 115 | $envName = Convert::raw2xml($this->getRequest()->latestParam('Environment')); |
| 122 | 116 | return new SS_HTTPResponse('Environment "' . $envName . '" not found.', 404); |
| 123 | 117 | } |
@@ -127,8 +121,7 @@ discard block |
||
| 127 | 121 | * |
| 128 | 122 | * @return DNProject |
| 129 | 123 | */ |
| 130 | - protected function getProject() |
|
| 131 | - { |
|
| 124 | + protected function getProject() { |
|
| 132 | 125 | $projectName = $this->getRequest()->param('Project'); |
| 133 | 126 | return DNProject::get()->filter('Name', $projectName)->first(); |
| 134 | 127 | } |
@@ -138,8 +131,7 @@ discard block |
||
| 138 | 131 | * |
| 139 | 132 | * @return DNEnvironment |
| 140 | 133 | */ |
| 141 | - protected function getEnvironment() |
|
| 142 | - { |
|
| 134 | + protected function getEnvironment() { |
|
| 143 | 135 | $projectName = $this->getRequest()->param('Project'); |
| 144 | 136 | $project = DNProject::get()->filter('Name', $projectName)->first(); |
| 145 | 137 | $environmentName = $this->getRequest()->param('Environment'); |
@@ -149,8 +141,7 @@ discard block |
||
| 149 | 141 | /** |
| 150 | 142 | * @return string |
| 151 | 143 | */ |
| 152 | - public function Link() |
|
| 153 | - { |
|
| 144 | + public function Link() { |
|
| 154 | 145 | return 'naut/api'; |
| 155 | 146 | } |
| 156 | 147 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class APIEnvironment extends APINoun |
|
| 4 | -{ |
|
| 3 | +class APIEnvironment extends APINoun { |
|
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * @var array |
@@ -15,8 +14,7 @@ discard block |
||
| 15 | 14 | * @param SS_HTTPRequest $request |
| 16 | 15 | * @return SS_HTTPResponse |
| 17 | 16 | */ |
| 18 | - public function index(SS_HTTPRequest $request) |
|
| 19 | - { |
|
| 17 | + public function index(SS_HTTPRequest $request) { |
|
| 20 | 18 | if (!$this->record->canView($this->getMember())) { |
| 21 | 19 | return $this->message('You are not authorized to view this environment', 403); |
| 22 | 20 | } |
@@ -52,8 +50,7 @@ discard block |
||
| 52 | 50 | * @param SS_HTTPRequest $request |
| 53 | 51 | * @return SS_HTTPResponse |
| 54 | 52 | */ |
| 55 | - public function ping(SS_HTTPRequest $request) |
|
| 56 | - { |
|
| 53 | + public function ping(SS_HTTPRequest $request) { |
|
| 57 | 54 | if (!$this->record->canView($this->getMember())) { |
| 58 | 55 | return $this->message('You are not authorized to do that on this environment', 403); |
| 59 | 56 | } |
@@ -71,8 +68,7 @@ discard block |
||
| 71 | 68 | * @param SS_HTTPRequest $request |
| 72 | 69 | * @return SS_HTTPResponse |
| 73 | 70 | */ |
| 74 | - public function deploy(SS_HTTPRequest $request) |
|
| 75 | - { |
|
| 71 | + public function deploy(SS_HTTPRequest $request) { |
|
| 76 | 72 | if (!$this->record->canView($this->getMember())) { |
| 77 | 73 | return $this->message('You are not authorized to do that on this environment', 403); |
| 78 | 74 | } |
@@ -89,8 +85,7 @@ discard block |
||
| 89 | 85 | /** |
| 90 | 86 | * @return string |
| 91 | 87 | */ |
| 92 | - public function Link() |
|
| 93 | - { |
|
| 88 | + public function Link() { |
|
| 94 | 89 | return Controller::join_links( |
| 95 | 90 | $this->parent->Link(), |
| 96 | 91 | $this->record->Project()->Name, |
@@ -101,16 +96,14 @@ discard block |
||
| 101 | 96 | /** |
| 102 | 97 | * @return SS_HTTPResponse |
| 103 | 98 | */ |
| 104 | - protected function showRecord() |
|
| 105 | - { |
|
| 99 | + protected function showRecord() { |
|
| 106 | 100 | return $this->getAPIResponse($this->record->toMap()); |
| 107 | 101 | } |
| 108 | 102 | |
| 109 | 103 | /** |
| 110 | 104 | * @return SS_HTTPResponse |
| 111 | 105 | */ |
| 112 | - protected function createPing() |
|
| 113 | - { |
|
| 106 | + protected function createPing() { |
|
| 114 | 107 | if (!$this->record->canDeploy($this->getMember())) { |
| 115 | 108 | return $this->message('You are not authorized to do that on this environment', 403); |
| 116 | 109 | } |
@@ -135,8 +128,7 @@ discard block |
||
| 135 | 128 | * @param int $ID |
| 136 | 129 | * @return SS_HTTPResponse |
| 137 | 130 | */ |
| 138 | - protected function getPing($ID) |
|
| 139 | - { |
|
| 131 | + protected function getPing($ID) { |
|
| 140 | 132 | $ping = DNPing::get()->byID($ID); |
| 141 | 133 | if (!$ping) { |
| 142 | 134 | return $this->message('Ping not found', 404); |
@@ -152,8 +144,7 @@ discard block |
||
| 152 | 144 | /** |
| 153 | 145 | * @return SS_HTTPResponse |
| 154 | 146 | */ |
| 155 | - protected function createDeploy() |
|
| 156 | - { |
|
| 147 | + protected function createDeploy() { |
|
| 157 | 148 | if (!$this->record->canDeploy($this->getMember())) { |
| 158 | 149 | return $this->message('You are not authorized to do that on this environment', 403); |
| 159 | 150 | } |
@@ -188,8 +179,7 @@ discard block |
||
| 188 | 179 | * @param int $id |
| 189 | 180 | * @return SS_HTTPResponse |
| 190 | 181 | */ |
| 191 | - protected function getDeploy($id) |
|
| 192 | - { |
|
| 182 | + protected function getDeploy($id) { |
|
| 193 | 183 | $deploy = DNDeployment::get()->byID($id); |
| 194 | 184 | if (!$deploy) { |
| 195 | 185 | return $this->message('Deploy not found', 404); |
@@ -2,8 +2,7 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * Base class for the APINouns |
| 4 | 4 | */ |
| 5 | -class APINoun extends Controller |
|
| 6 | -{ |
|
| 5 | +class APINoun extends Controller { |
|
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | 8 | * @var controller |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | * @param Controller|null $parent |
| 27 | 26 | * @param DataObject|null $record |
| 28 | 27 | */ |
| 29 | - public function __construct(\Controller $parent = null, DataObject $record = null) |
|
| 30 | - { |
|
| 28 | + public function __construct(\Controller $parent = null, DataObject $record = null) { |
|
| 31 | 29 | $this->record = $record; |
| 32 | 30 | $this->parent = $parent; |
| 33 | 31 | parent::__construct(); |
@@ -36,8 +34,7 @@ discard block |
||
| 36 | 34 | /** |
| 37 | 35 | * Enable basic auth on the API |
| 38 | 36 | */ |
| 39 | - public function init() |
|
| 40 | - { |
|
| 37 | + public function init() { |
|
| 41 | 38 | $this->member = BasicAuth::requireLogin('Deploynaut API'); |
| 42 | 39 | parent::init(); |
| 43 | 40 | } |
@@ -45,16 +42,14 @@ discard block |
||
| 45 | 42 | /** |
| 46 | 43 | * @return DataObject |
| 47 | 44 | */ |
| 48 | - public function getRecord() |
|
| 49 | - { |
|
| 45 | + public function getRecord() { |
|
| 50 | 46 | return $this->record; |
| 51 | 47 | } |
| 52 | 48 | |
| 53 | 49 | /** |
| 54 | 50 | * @return Member |
| 55 | 51 | */ |
| 56 | - public function getMember() |
|
| 57 | - { |
|
| 52 | + public function getMember() { |
|
| 58 | 53 | return $this->member; |
| 59 | 54 | } |
| 60 | 55 | |
@@ -62,8 +57,7 @@ discard block |
||
| 62 | 57 | * @param array $output |
| 63 | 58 | * @return SS_HTTPResponse |
| 64 | 59 | */ |
| 65 | - protected function getAPIResponse($output) |
|
| 66 | - { |
|
| 60 | + protected function getAPIResponse($output) { |
|
| 67 | 61 | $response = $this->getResponse(); |
| 68 | 62 | if ($this->respondWithText()) { |
| 69 | 63 | $body = print_r($output, true); |
@@ -79,8 +73,7 @@ discard block |
||
| 79 | 73 | /** |
| 80 | 74 | * @return boolean |
| 81 | 75 | */ |
| 82 | - protected function respondWithJSON() |
|
| 83 | - { |
|
| 76 | + protected function respondWithJSON() { |
|
| 84 | 77 | if ($this->getRequest()->getExtension() == 'json') { |
| 85 | 78 | return true; |
| 86 | 79 | } |
@@ -93,8 +86,7 @@ discard block |
||
| 93 | 86 | /** |
| 94 | 87 | * @return boolean |
| 95 | 88 | */ |
| 96 | - protected function respondWithText() |
|
| 97 | - { |
|
| 89 | + protected function respondWithText() { |
|
| 98 | 90 | if ($this->getRequest()->getExtension() == 'txt') { |
| 99 | 91 | return true; |
| 100 | 92 | } |
@@ -107,8 +99,7 @@ discard block |
||
| 107 | 99 | /** |
| 108 | 100 | * @return array|null |
| 109 | 101 | */ |
| 110 | - protected function getRequestBody() |
|
| 111 | - { |
|
| 102 | + protected function getRequestBody() { |
|
| 112 | 103 | return Convert::json2array($this->getRequest()->getBody()); |
| 113 | 104 | } |
| 114 | 105 | |
@@ -119,8 +110,7 @@ discard block |
||
| 119 | 110 | * @param int $statusCode |
| 120 | 111 | * @return SS_HTTPResponse |
| 121 | 112 | */ |
| 122 | - protected function message($message, $statusCode) |
|
| 123 | - { |
|
| 113 | + protected function message($message, $statusCode) { |
|
| 124 | 114 | $response = $this->getAPIResponse(array( |
| 125 | 115 | 'message' => $message, |
| 126 | 116 | 'statusCode' => $statusCode |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class APIProject extends APINoun |
|
| 4 | -{ |
|
| 3 | +class APIProject extends APINoun { |
|
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * @var array |
@@ -15,8 +14,7 @@ discard block |
||
| 15 | 14 | * @param SS_HTTPRequest $request |
| 16 | 15 | * @return SS_HTTPResponse |
| 17 | 16 | */ |
| 18 | - public function index(SS_HTTPRequest $request) |
|
| 19 | - { |
|
| 17 | + public function index(SS_HTTPRequest $request) { |
|
| 20 | 18 | if (!$this->record->canView($this->getMember())) { |
| 21 | 19 | return $this->message('You are not authorized to this environment', 403); |
| 22 | 20 | } |
@@ -48,8 +46,7 @@ discard block |
||
| 48 | 46 | * @param SS_HTTPRequest $request |
| 49 | 47 | * @return SS_HTTPResponse |
| 50 | 48 | */ |
| 51 | - public function fetch(SS_HTTPRequest $request) |
|
| 52 | - { |
|
| 49 | + public function fetch(SS_HTTPRequest $request) { |
|
| 53 | 50 | if (!$this->record->canView($this->getMember())) { |
| 54 | 51 | return $this->message('You are not authorized to do that on this environment', 403); |
| 55 | 52 | } |
@@ -67,8 +64,7 @@ discard block |
||
| 67 | 64 | * @param int $ID |
| 68 | 65 | * @return SS_HTTPResponse |
| 69 | 66 | */ |
| 70 | - protected function getFetch($ID) |
|
| 71 | - { |
|
| 67 | + protected function getFetch($ID) { |
|
| 72 | 68 | $ping = DNGitFetch::get()->byID($ID); |
| 73 | 69 | if (!$ping) { |
| 74 | 70 | return $this->message('Fetch not found', 404); |
@@ -84,8 +80,7 @@ discard block |
||
| 84 | 80 | /** |
| 85 | 81 | * @return SS_HTTPResponse |
| 86 | 82 | */ |
| 87 | - protected function createFetch() |
|
| 88 | - { |
|
| 83 | + protected function createFetch() { |
|
| 89 | 84 | /** @var DNGitFetch $fetch */ |
| 90 | 85 | $fetch = DNGitFetch::create(); |
| 91 | 86 | $fetch->ProjectID = $this->record->ID; |
@@ -107,8 +102,7 @@ discard block |
||
| 107 | 102 | /** |
| 108 | 103 | * @return string |
| 109 | 104 | */ |
| 110 | - public function Link() |
|
| 111 | - { |
|
| 105 | + public function Link() { |
|
| 112 | 106 | return Controller::join_links( |
| 113 | 107 | $this->parent->Link(), |
| 114 | 108 | $this->record->Name |
@@ -1,18 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | use \Symfony\Component\Process\Process; |
| 3 | 3 | |
| 4 | -class CapistranoDeploymentBackend extends Object implements DeploymentBackend |
|
| 5 | -{ |
|
| 4 | +class CapistranoDeploymentBackend extends Object implements DeploymentBackend { |
|
| 6 | 5 | |
| 7 | 6 | protected $packageGenerator; |
| 8 | 7 | |
| 9 | - public function getPackageGenerator() |
|
| 10 | - { |
|
| 8 | + public function getPackageGenerator() { |
|
| 11 | 9 | return $this->packageGenerator; |
| 12 | 10 | } |
| 13 | 11 | |
| 14 | - public function setPackageGenerator(PackageGenerator $packageGenerator) |
|
| 15 | - { |
|
| 12 | + public function setPackageGenerator(PackageGenerator $packageGenerator) { |
|
| 16 | 13 | $this->packageGenerator = $packageGenerator; |
| 17 | 14 | } |
| 18 | 15 | |
@@ -24,8 +21,7 @@ discard block |
||
| 24 | 21 | * |
| 25 | 22 | * @return DeploymentStrategy |
| 26 | 23 | */ |
| 27 | - public function planDeploy(DNEnvironment $environment, $options) |
|
| 28 | - { |
|
| 24 | + public function planDeploy(DNEnvironment $environment, $options) { |
|
| 29 | 25 | $strategy = new DeploymentStrategy($environment, $options); |
| 30 | 26 | |
| 31 | 27 | $currentBuild = $environment->CurrentBuild(); |
@@ -131,8 +127,7 @@ discard block |
||
| 131 | 127 | /** |
| 132 | 128 | * Enable a maintenance page for the given environment using the maintenance:enable Capistrano task. |
| 133 | 129 | */ |
| 134 | - public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) |
|
| 135 | - { |
|
| 130 | + public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { |
|
| 136 | 131 | $name = $environment->getFullName(); |
| 137 | 132 | $command = $this->getCommand('maintenance:enable', 'web', $environment, null, $log); |
| 138 | 133 | $command->run(function ($type, $buffer) use ($log) { |
@@ -148,8 +143,7 @@ discard block |
||
| 148 | 143 | /** |
| 149 | 144 | * Disable the maintenance page for the given environment using the maintenance:disable Capistrano task. |
| 150 | 145 | */ |
| 151 | - public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) |
|
| 152 | - { |
|
| 146 | + public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { |
|
| 153 | 147 | $name = $environment->getFullName(); |
| 154 | 148 | $command = $this->getCommand('maintenance:disable', 'web', $environment, null, $log); |
| 155 | 149 | $command->run(function ($type, $buffer) use ($log) { |
@@ -165,8 +159,7 @@ discard block |
||
| 165 | 159 | /** |
| 166 | 160 | * Check the status using the deploy:check capistrano method |
| 167 | 161 | */ |
| 168 | - public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) |
|
| 169 | - { |
|
| 162 | + public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { |
|
| 170 | 163 | $command = $this->getCommand('deploy:check', 'web', $environment, null, $log); |
| 171 | 164 | $command->run(function ($type, $buffer) use ($log) { |
| 172 | 165 | $log->write($buffer); |
@@ -177,8 +170,7 @@ discard block |
||
| 177 | 170 | /** |
| 178 | 171 | * @inheritdoc |
| 179 | 172 | */ |
| 180 | - public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) |
|
| 181 | - { |
|
| 173 | + public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) { |
|
| 182 | 174 | if ($dataTransfer->Direction == 'get') { |
| 183 | 175 | $this->dataTransferBackup($dataTransfer, $log); |
| 184 | 176 | } else { |
@@ -222,8 +214,7 @@ discard block |
||
| 222 | 214 | * @param DeploynautLogFile $log |
| 223 | 215 | * @return \Symfony\Component\Process\Process |
| 224 | 216 | */ |
| 225 | - public function getCommand($action, $roles, DNEnvironment $environment, $args = null, DeploynautLogFile $log) |
|
| 226 | - { |
|
| 217 | + public function getCommand($action, $roles, DNEnvironment $environment, $args = null, DeploynautLogFile $log) { |
|
| 227 | 218 | $name = $environment->getFullName(); |
| 228 | 219 | $env = $environment->Project()->getProcessEnv(); |
| 229 | 220 | |
@@ -277,8 +268,7 @@ discard block |
||
| 277 | 268 | * @param DNDataTransfer $dataTransfer |
| 278 | 269 | * @param DeploynautLogFile $log |
| 279 | 270 | */ |
| 280 | - protected function dataTransferBackup(DNDataTransfer $dataTransfer, DeploynautLogFile $log) |
|
| 281 | - { |
|
| 271 | + protected function dataTransferBackup(DNDataTransfer $dataTransfer, DeploynautLogFile $log) { |
|
| 282 | 272 | $environment = $dataTransfer->Environment(); |
| 283 | 273 | $name = $environment->getFullName(); |
| 284 | 274 | |
@@ -354,8 +344,7 @@ discard block |
||
| 354 | 344 | * Also cleans up and generates new error pages. |
| 355 | 345 | * @param DeploynautLogFile $log |
| 356 | 346 | */ |
| 357 | - public function rebuild(DNEnvironment $environment, $log) |
|
| 358 | - { |
|
| 347 | + public function rebuild(DNEnvironment $environment, $log) { |
|
| 359 | 348 | $name = $environment->getFullName(); |
| 360 | 349 | $command = $this->getCommand('deploy:migrate', 'web', $environment, null, $log); |
| 361 | 350 | $command->run(function ($type, $buffer) use ($log) { |
@@ -376,8 +365,7 @@ discard block |
||
| 376 | 365 | * @param DNDataTransfer $dataTransfer |
| 377 | 366 | * @param DeploynautLogFile $log |
| 378 | 367 | */ |
| 379 | - protected function dataTransferRestore($workingDir, DNDataTransfer $dataTransfer, DeploynautLogFile $log) |
|
| 380 | - { |
|
| 368 | + protected function dataTransferRestore($workingDir, DNDataTransfer $dataTransfer, DeploynautLogFile $log) { |
|
| 381 | 369 | $environment = $dataTransfer->Environment(); |
| 382 | 370 | $name = $environment->getFullName(); |
| 383 | 371 | |
@@ -7,8 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | * It's useful for demonstrating how the system works, and how you can write deployment back-ends |
| 9 | 9 | */ |
| 10 | -class DemoDeploymentBackend extends Object implements DeploymentBackend |
|
| 11 | -{ |
|
| 10 | +class DemoDeploymentBackend extends Object implements DeploymentBackend { |
|
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | 13 | * Create a deployment strategy. |
@@ -18,8 +17,7 @@ discard block |
||
| 18 | 17 | * |
| 19 | 18 | * @return DeploymentStrategy |
| 20 | 19 | */ |
| 21 | - public function planDeploy(DNEnvironment $environment, $options = array()) |
|
| 22 | - { |
|
| 20 | + public function planDeploy(DNEnvironment $environment, $options = array()) { |
|
| 23 | 21 | return new DeploymentStrategy($environment, $options); |
| 24 | 22 | } |
| 25 | 23 | |
@@ -69,23 +67,19 @@ discard block |
||
| 69 | 67 | /** |
| 70 | 68 | * @inheritdoc |
| 71 | 69 | */ |
| 72 | - public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) |
|
| 73 | - { |
|
| 70 | + public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) { |
|
| 74 | 71 | die('Not implemented'); |
| 75 | 72 | } |
| 76 | 73 | |
| 77 | - public function enableMaintenance(DNEnvironment $environment, \DeploynautLogFile $log, DNProject $project) |
|
| 78 | - { |
|
| 74 | + public function enableMaintenance(DNEnvironment $environment, \DeploynautLogFile $log, DNProject $project) { |
|
| 79 | 75 | $log->write(sprintf('Maintenance page enabled on "%s"', $environment->getFullName())); |
| 80 | 76 | } |
| 81 | 77 | |
| 82 | - public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) |
|
| 83 | - { |
|
| 78 | + public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { |
|
| 84 | 79 | $log->write(sprintf('Maintenance page disabled on "%s"', $environment->getFullName())); |
| 85 | 80 | } |
| 86 | 81 | |
| 87 | - public function ping(\DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) |
|
| 88 | - { |
|
| 82 | + public function ping(\DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) { |
|
| 89 | 83 | $log->write(sprintf('Ping "%s"', $environment->getFullName())); |
| 90 | 84 | } |
| 91 | 85 | } |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -interface DeploymentBackend |
|
| 4 | -{ |
|
| 3 | +interface DeploymentBackend { |
|
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * Creates a deployment strategy that can be used to do some pre-flight checks. |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DeploymentStrategy extends ViewableData |
|
| 4 | -{ |
|
| 3 | +class DeploymentStrategy extends ViewableData { |
|
| 5 | 4 | |
| 6 | 5 | const SUCCESS_CODE = 'success'; |
| 7 | 6 | |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | * @param DNEnvironment $environment |
| 57 | 56 | * @param array $options |
| 58 | 57 | */ |
| 59 | - public function __construct(DNEnvironment $environment, $options = array()) |
|
| 60 | - { |
|
| 58 | + public function __construct(DNEnvironment $environment, $options = array()) { |
|
| 61 | 59 | $this->environment = $environment; |
| 62 | 60 | $this->options = $options; |
| 63 | 61 | } |
@@ -65,47 +63,41 @@ discard block |
||
| 65 | 63 | /** |
| 66 | 64 | * @param string $title |
| 67 | 65 | */ |
| 68 | - public function setActionTitle($title) |
|
| 69 | - { |
|
| 66 | + public function setActionTitle($title) { |
|
| 70 | 67 | $this->actionTitle = $title; |
| 71 | 68 | } |
| 72 | 69 | |
| 73 | 70 | /** |
| 74 | 71 | * @return string |
| 75 | 72 | */ |
| 76 | - public function getActionTitle() |
|
| 77 | - { |
|
| 73 | + public function getActionTitle() { |
|
| 78 | 74 | return $this->actionTitle; |
| 79 | 75 | } |
| 80 | 76 | |
| 81 | 77 | /** |
| 82 | 78 | */ |
| 83 | - public function setActionCode($code) |
|
| 84 | - { |
|
| 79 | + public function setActionCode($code) { |
|
| 85 | 80 | $this->actionCode = $code; |
| 86 | 81 | } |
| 87 | 82 | |
| 88 | 83 | /** |
| 89 | 84 | * @return string |
| 90 | 85 | */ |
| 91 | - public function getActionCode() |
|
| 92 | - { |
|
| 86 | + public function getActionCode() { |
|
| 93 | 87 | return $this->actionCode; |
| 94 | 88 | } |
| 95 | 89 | |
| 96 | 90 | /** |
| 97 | 91 | * @param int |
| 98 | 92 | */ |
| 99 | - public function setEstimatedTime($seconds) |
|
| 100 | - { |
|
| 93 | + public function setEstimatedTime($seconds) { |
|
| 101 | 94 | $this->estimatedTime = $seconds; |
| 102 | 95 | } |
| 103 | 96 | |
| 104 | 97 | /** |
| 105 | 98 | * @return int Time in minutes |
| 106 | 99 | */ |
| 107 | - public function getEstimatedTime() |
|
| 108 | - { |
|
| 100 | + public function getEstimatedTime() { |
|
| 109 | 101 | return $this->estimatedTime; |
| 110 | 102 | } |
| 111 | 103 | |
@@ -114,8 +106,7 @@ discard block |
||
| 114 | 106 | * @param string $from |
| 115 | 107 | * @param string $to |
| 116 | 108 | */ |
| 117 | - public function setChange($title, $from, $to) |
|
| 118 | - { |
|
| 109 | + public function setChange($title, $from, $to) { |
|
| 119 | 110 | return $this->changes[$title] = array( |
| 120 | 111 | 'from' => $from, |
| 121 | 112 | 'to' => $to |
@@ -126,8 +117,7 @@ discard block |
||
| 126 | 117 | * @param string $title |
| 127 | 118 | * @param string $desc |
| 128 | 119 | */ |
| 129 | - public function setChangeDescriptionOnly($title, $desc) |
|
| 130 | - { |
|
| 120 | + public function setChangeDescriptionOnly($title, $desc) { |
|
| 131 | 121 | return $this->changes[$title] = array( |
| 132 | 122 | 'description' => $desc |
| 133 | 123 | ); |
@@ -138,8 +128,7 @@ discard block |
||
| 138 | 128 | * |
| 139 | 129 | * @return array |
| 140 | 130 | */ |
| 141 | - public function getChangesModificationNeeded() |
|
| 142 | - { |
|
| 131 | + public function getChangesModificationNeeded() { |
|
| 143 | 132 | $filtered = []; |
| 144 | 133 | foreach ($this->changes as $change => $details) { |
| 145 | 134 | if (array_key_exists('description', $details)) { |
@@ -164,8 +153,7 @@ discard block |
||
| 164 | 153 | * ) |
| 165 | 154 | * ) |
| 166 | 155 | */ |
| 167 | - public function getChanges() |
|
| 168 | - { |
|
| 156 | + public function getChanges() { |
|
| 169 | 157 | return $this->changes; |
| 170 | 158 | } |
| 171 | 159 | |
@@ -174,8 +162,7 @@ discard block |
||
| 174 | 162 | * |
| 175 | 163 | * @return ArrayData|null |
| 176 | 164 | */ |
| 177 | - public function getChange($key) |
|
| 178 | - { |
|
| 165 | + public function getChange($key) { |
|
| 179 | 166 | $changes = $this->getChanges(); |
| 180 | 167 | if (array_key_exists($key, $changes)) { |
| 181 | 168 | return new ArrayData($changes[$key]); |
@@ -187,8 +174,7 @@ discard block |
||
| 187 | 174 | * @param string $option |
| 188 | 175 | * @param string $value |
| 189 | 176 | */ |
| 190 | - public function setOption($option, $value) |
|
| 191 | - { |
|
| 177 | + public function setOption($option, $value) { |
|
| 192 | 178 | $this->options[$option] = $value; |
| 193 | 179 | } |
| 194 | 180 | |
@@ -196,8 +182,7 @@ discard block |
||
| 196 | 182 | * @param string $option |
| 197 | 183 | * @return string|null |
| 198 | 184 | */ |
| 199 | - public function getOption($option) |
|
| 200 | - { |
|
| 185 | + public function getOption($option) { |
|
| 201 | 186 | if (!empty($this->options[$option])) { |
| 202 | 187 | return $this->options[$option]; |
| 203 | 188 | } |
@@ -206,32 +191,28 @@ discard block |
||
| 206 | 191 | /** |
| 207 | 192 | * @return string |
| 208 | 193 | */ |
| 209 | - public function getOptions() |
|
| 210 | - { |
|
| 194 | + public function getOptions() { |
|
| 211 | 195 | return $this->options; |
| 212 | 196 | } |
| 213 | 197 | |
| 214 | 198 | /** |
| 215 | 199 | * @param string $code |
| 216 | 200 | */ |
| 217 | - public function setValidationCode($code) |
|
| 218 | - { |
|
| 201 | + public function setValidationCode($code) { |
|
| 219 | 202 | $this->validationCode = $code; |
| 220 | 203 | } |
| 221 | 204 | |
| 222 | 205 | /** |
| 223 | 206 | * @return string |
| 224 | 207 | */ |
| 225 | - public function getValidationCode() |
|
| 226 | - { |
|
| 208 | + public function getValidationCode() { |
|
| 227 | 209 | return $this->validationCode; |
| 228 | 210 | } |
| 229 | 211 | |
| 230 | 212 | /** |
| 231 | 213 | * @param string $msg |
| 232 | 214 | */ |
| 233 | - public function setMessage($msg, $code = self::ERROR_CODE) |
|
| 234 | - { |
|
| 215 | + public function setMessage($msg, $code = self::ERROR_CODE) { |
|
| 235 | 216 | $this->messages[] = [ |
| 236 | 217 | 'text' => $msg, |
| 237 | 218 | 'code' => $code |
@@ -251,8 +232,7 @@ discard block |
||
| 251 | 232 | /** |
| 252 | 233 | * @return array |
| 253 | 234 | */ |
| 254 | - public function getMessages() |
|
| 255 | - { |
|
| 235 | + public function getMessages() { |
|
| 256 | 236 | return $this->messages; |
| 257 | 237 | } |
| 258 | 238 | |
@@ -261,8 +241,7 @@ discard block |
||
| 261 | 241 | * |
| 262 | 242 | * @return array |
| 263 | 243 | */ |
| 264 | - public function toArray() |
|
| 265 | - { |
|
| 244 | + public function toArray() { |
|
| 266 | 245 | $fields = array( |
| 267 | 246 | 'actionTitle', |
| 268 | 247 | 'actionCode', |
@@ -283,8 +262,7 @@ discard block |
||
| 283 | 262 | /** |
| 284 | 263 | * @return string |
| 285 | 264 | */ |
| 286 | - public function toJSON() |
|
| 287 | - { |
|
| 265 | + public function toJSON() { |
|
| 288 | 266 | return json_encode($this->toArray(), JSON_PRETTY_PRINT); |
| 289 | 267 | } |
| 290 | 268 | |
@@ -294,8 +272,7 @@ discard block |
||
| 294 | 272 | * |
| 295 | 273 | * @param string $json |
| 296 | 274 | */ |
| 297 | - public function fromJSON($json) |
|
| 298 | - { |
|
| 275 | + public function fromJSON($json) { |
|
| 299 | 276 | $decoded = json_decode($json, true); |
| 300 | 277 | return $this->fromArray($decoded); |
| 301 | 278 | } |
@@ -306,8 +283,7 @@ discard block |
||
| 306 | 283 | * |
| 307 | 284 | * @param string $data |
| 308 | 285 | */ |
| 309 | - public function fromArray($data) |
|
| 310 | - { |
|
| 286 | + public function fromArray($data) { |
|
| 311 | 287 | $fields = array( |
| 312 | 288 | 'actionTitle', |
| 313 | 289 | 'actionCode', |
@@ -328,8 +304,7 @@ discard block |
||
| 328 | 304 | /** |
| 329 | 305 | * @return DNDeployment |
| 330 | 306 | */ |
| 331 | - public function createDeployment() |
|
| 332 | - { |
|
| 307 | + public function createDeployment() { |
|
| 333 | 308 | $deployment = DNDeployment::create(); |
| 334 | 309 | $deployment->EnvironmentID = $this->environment->ID; |
| 335 | 310 | // Pull out the SHA from the options so we can make it queryable. |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -interface EnvironmentCreateBackend |
|
| 4 | -{ |
|
| 3 | +interface EnvironmentCreateBackend { |
|
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * @param DNCreateEnvironment $job |