@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | * @method ManyManyList DataTransfers() |
| 48 | 48 | * |
| 49 | 49 | */ |
| 50 | -class DNDataArchive extends DataObject |
|
| 51 | -{ |
|
| 50 | +class DNDataArchive extends DataObject { |
|
| 52 | 51 | |
| 53 | 52 | private static $db = array( |
| 54 | 53 | 'UploadToken' => 'Varchar(8)', |
@@ -104,8 +103,7 @@ discard block |
||
| 104 | 103 | |
| 105 | 104 | private static $_cache_can_download = array(); |
| 106 | 105 | |
| 107 | - public static function get_mode_map() |
|
| 108 | - { |
|
| 106 | + public static function get_mode_map() { |
|
| 109 | 107 | return array( |
| 110 | 108 | 'all' => 'Database and Assets', |
| 111 | 109 | 'db' => 'Database only', |
@@ -119,14 +117,12 @@ discard block |
||
| 119 | 117 | * |
| 120 | 118 | * @return string |
| 121 | 119 | */ |
| 122 | - public static function generate_upload_token($chars = 8) |
|
| 123 | - { |
|
| 120 | + public static function generate_upload_token($chars = 8) { |
|
| 124 | 121 | $generator = new RandomGenerator(); |
| 125 | 122 | return strtoupper(substr($generator->randomToken(), 0, $chars)); |
| 126 | 123 | } |
| 127 | 124 | |
| 128 | - public function onBeforeWrite() |
|
| 129 | - { |
|
| 125 | + public function onBeforeWrite() { |
|
| 130 | 126 | if (!$this->AuthorID) { |
| 131 | 127 | $this->AuthorID = Member::currentUserID(); |
| 132 | 128 | } |
@@ -134,13 +130,11 @@ discard block |
||
| 134 | 130 | parent::onBeforeWrite(); |
| 135 | 131 | } |
| 136 | 132 | |
| 137 | - public function onAfterDelete() |
|
| 138 | - { |
|
| 133 | + public function onAfterDelete() { |
|
| 139 | 134 | $this->ArchiveFile()->delete(); |
| 140 | 135 | } |
| 141 | 136 | |
| 142 | - public function getCMSFields() |
|
| 143 | - { |
|
| 137 | + public function getCMSFields() { |
|
| 144 | 138 | $fields = parent::getCMSFields(); |
| 145 | 139 | $fields->removeByName('OriginalEnvironmentID'); |
| 146 | 140 | $fields->removeByName('EnvironmentID'); |
@@ -173,8 +167,7 @@ discard block |
||
| 173 | 167 | return $fields; |
| 174 | 168 | } |
| 175 | 169 | |
| 176 | - public function getDefaultSearchContext() |
|
| 177 | - { |
|
| 170 | + public function getDefaultSearchContext() { |
|
| 178 | 171 | $context = parent::getDefaultSearchContext(); |
| 179 | 172 | $context->getFields()->dataFieldByName('Mode')->setHasEmptyDefault(true); |
| 180 | 173 | |
@@ -187,8 +180,7 @@ discard block |
||
| 187 | 180 | * |
| 188 | 181 | * @return string The human-readable size of this archive file |
| 189 | 182 | */ |
| 190 | - public function FileSize() |
|
| 191 | - { |
|
| 183 | + public function FileSize() { |
|
| 192 | 184 | if ($this->ArchiveFile()->exists()) { |
| 193 | 185 | return $this->ArchiveFile()->getSize(); |
| 194 | 186 | } else { |
@@ -196,8 +188,7 @@ discard block |
||
| 196 | 188 | } |
| 197 | 189 | } |
| 198 | 190 | |
| 199 | - public function getModeNice() |
|
| 200 | - { |
|
| 191 | + public function getModeNice() { |
|
| 201 | 192 | if ($this->Mode == 'all') { |
| 202 | 193 | return 'database and assets'; |
| 203 | 194 | } else { |
@@ -212,8 +203,7 @@ discard block |
||
| 212 | 203 | * |
| 213 | 204 | * @return boolean |
| 214 | 205 | */ |
| 215 | - public function isPending() |
|
| 216 | - { |
|
| 206 | + public function isPending() { |
|
| 217 | 207 | return !($this->ArchiveFileID); |
| 218 | 208 | } |
| 219 | 209 | |
@@ -222,8 +212,7 @@ discard block |
||
| 222 | 212 | * |
| 223 | 213 | * @param Member|null $member The {@link Member} object to test against. |
| 224 | 214 | */ |
| 225 | - public function canView($member = null) |
|
| 226 | - { |
|
| 215 | + public function canView($member = null) { |
|
| 227 | 216 | return ($this->canRestore($member) || $this->canDownload($member)); |
| 228 | 217 | } |
| 229 | 218 | |
@@ -234,8 +223,7 @@ discard block |
||
| 234 | 223 | * @param Member|null $member The {@link Member} object to test against. |
| 235 | 224 | * @return true if $member (or the currently logged in member if null) can upload this archive |
| 236 | 225 | */ |
| 237 | - public function canRestore($member = null) |
|
| 238 | - { |
|
| 226 | + public function canRestore($member = null) { |
|
| 239 | 227 | $memberID = $member ? $member->ID : Member::currentUserID(); |
| 240 | 228 | if (!$memberID) { |
| 241 | 229 | return false; |
@@ -256,8 +244,7 @@ discard block |
||
| 256 | 244 | * @param Member|null $member The {@link Member} object to test against. |
| 257 | 245 | * @return true if $member (or the currently logged in member if null) can download this archive |
| 258 | 246 | */ |
| 259 | - public function canDownload($member = null) |
|
| 260 | - { |
|
| 247 | + public function canDownload($member = null) { |
|
| 261 | 248 | $memberID = $member ? $member->ID : Member::currentUserID(); |
| 262 | 249 | if (!$memberID) { |
| 263 | 250 | return false; |
@@ -276,8 +263,7 @@ discard block |
||
| 276 | 263 | * @param Member|null $member The {@link Member} object to test against. |
| 277 | 264 | * @return boolean if $member (or the currently logged in member if null) can delete this archive |
| 278 | 265 | */ |
| 279 | - public function canDelete($member = null) |
|
| 280 | - { |
|
| 266 | + public function canDelete($member = null) { |
|
| 281 | 267 | return $this->Environment()->canDeleteArchive($member); |
| 282 | 268 | } |
| 283 | 269 | |
@@ -289,8 +275,7 @@ discard block |
||
| 289 | 275 | * |
| 290 | 276 | * @return boolean true if $member can upload archives linked to this environment, false if they can't. |
| 291 | 277 | */ |
| 292 | - public function canMoveTo($targetEnv, $member = null) |
|
| 293 | - { |
|
| 278 | + public function canMoveTo($targetEnv, $member = null) { |
|
| 294 | 279 | if ($this->Environment()->Project()->ID != $targetEnv->Project()->ID) { |
| 295 | 280 | // We don't permit moving snapshots between projects at this stage. |
| 296 | 281 | return false; |
@@ -327,8 +312,7 @@ discard block |
||
| 327 | 312 | * |
| 328 | 313 | * @return ArrayList List of valid environments. |
| 329 | 314 | */ |
| 330 | - public function validTargetEnvironments() |
|
| 331 | - { |
|
| 315 | + public function validTargetEnvironments() { |
|
| 332 | 316 | $archive = $this; |
| 333 | 317 | $envs = $this->Environment()->Project()->DNEnvironmentList() |
| 334 | 318 | ->filterByCallback(function ($item) use ($archive) { |
@@ -342,8 +326,7 @@ discard block |
||
| 342 | 326 | * Returns a unique filename, including project/environment/timestamp details. |
| 343 | 327 | * @return string |
| 344 | 328 | */ |
| 345 | - public function generateFilename(DNDataTransfer $dataTransfer) |
|
| 346 | - { |
|
| 329 | + public function generateFilename(DNDataTransfer $dataTransfer) { |
|
| 347 | 330 | $generator = new RandomGenerator(); |
| 348 | 331 | $filter = FileNameFilter::create(); |
| 349 | 332 | |
@@ -364,8 +347,7 @@ discard block |
||
| 364 | 347 | * @param DNDataTransfer |
| 365 | 348 | * @return string Absolute file path |
| 366 | 349 | */ |
| 367 | - public function generateFilepath(DNDataTransfer $dataTransfer) |
|
| 368 | - { |
|
| 350 | + public function generateFilepath(DNDataTransfer $dataTransfer) { |
|
| 369 | 351 | $data = DNData::inst(); |
| 370 | 352 | $transferDir = $data->getDataTransferDir(); |
| 371 | 353 | $filter = FileNameFilter::create(); |
@@ -386,8 +368,7 @@ discard block |
||
| 386 | 368 | * @param DNDataTransfer $dataTransfer |
| 387 | 369 | * @return bool |
| 388 | 370 | */ |
| 389 | - public function attachFile($sspakFilepath, DNDataTransfer $dataTransfer) |
|
| 390 | - { |
|
| 371 | + public function attachFile($sspakFilepath, DNDataTransfer $dataTransfer) { |
|
| 391 | 372 | $sspakFilepath = ltrim( |
| 392 | 373 | str_replace( |
| 393 | 374 | array(ASSETS_PATH, realpath(ASSETS_PATH)), |
@@ -431,8 +412,7 @@ discard block |
||
| 431 | 412 | * @throws RuntimeException |
| 432 | 413 | * @return bool |
| 433 | 414 | */ |
| 434 | - public function extractArchive($workingDir = null) |
|
| 435 | - { |
|
| 415 | + public function extractArchive($workingDir = null) { |
|
| 436 | 416 | if (!is_dir($workingDir)) { |
| 437 | 417 | mkdir($workingDir, 0700, true); |
| 438 | 418 | } |
@@ -490,8 +470,7 @@ discard block |
||
| 490 | 470 | * @param string|null $mode "db", "assets", or "all". This is the content we're checking for. Default to the archive setting |
| 491 | 471 | * @return ValidationResult |
| 492 | 472 | */ |
| 493 | - public function validateArchiveContents($mode = null) |
|
| 494 | - { |
|
| 473 | + public function validateArchiveContents($mode = null) { |
|
| 495 | 474 | $mode = $mode ?: $this->Mode; |
| 496 | 475 | $result = new ValidationResult(); |
| 497 | 476 | |
@@ -539,8 +518,7 @@ discard block |
||
| 539 | 518 | * @throws RuntimeException |
| 540 | 519 | * @return bool |
| 541 | 520 | */ |
| 542 | - public function fixArchivePermissions($workingDir) |
|
| 543 | - { |
|
| 521 | + public function fixArchivePermissions($workingDir) { |
|
| 544 | 522 | $fixCmds = array( |
| 545 | 523 | // The directories need to have permissions changed one by one (hence the ; instead of +), |
| 546 | 524 | // otherwise we might end up having no +x access to a directory deeper down. |
@@ -567,8 +545,7 @@ discard block |
||
| 567 | 545 | * @param string|null $workingDir The path of where the sspak has been extracted to |
| 568 | 546 | * @return bool |
| 569 | 547 | */ |
| 570 | - public function setArchiveFromFiles($workingDir) |
|
| 571 | - { |
|
| 548 | + public function setArchiveFromFiles($workingDir) { |
|
| 572 | 549 | $command = sprintf('sspak saveexisting %s 2>&1', $this->ArchiveFile()->FullPath); |
| 573 | 550 | if ($this->Mode == 'db') { |
| 574 | 551 | $command .= sprintf(' --db=%s/database.sql', $workingDir); |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | * @method ManyManyList PipelineCancellers() |
| 40 | 40 | * @method ManyManyList PipelineCancellerGroups() |
| 41 | 41 | */ |
| 42 | -class DNEnvironment extends DataObject |
|
| 43 | -{ |
|
| 42 | +class DNEnvironment extends DataObject { |
|
| 44 | 43 | |
| 45 | 44 | /** |
| 46 | 45 | * If this is set to a full pathfile, it will be used as template |
@@ -168,8 +167,7 @@ discard block |
||
| 168 | 167 | * @param string $path |
| 169 | 168 | * @return \DNEnvironment |
| 170 | 169 | */ |
| 171 | - public static function create_from_path($path) |
|
| 172 | - { |
|
| 170 | + public static function create_from_path($path) { |
|
| 173 | 171 | $e = DNEnvironment::create(); |
| 174 | 172 | $e->Filename = $path; |
| 175 | 173 | $e->Name = basename($e->Filename, '.rb'); |
@@ -188,8 +186,7 @@ discard block |
||
| 188 | 186 | * |
| 189 | 187 | * @return DeploymentBackend |
| 190 | 188 | */ |
| 191 | - public function Backend() |
|
| 192 | - { |
|
| 189 | + public function Backend() { |
|
| 193 | 190 | $backends = array_keys($this->config()->get('allowed_backends', Config::FIRST_SET)); |
| 194 | 191 | switch (sizeof($backends)) { |
| 195 | 192 | // Nothing allowed, use the default value "DeploymentBackend" |
@@ -213,8 +210,7 @@ discard block |
||
| 213 | 210 | return Injector::inst()->get($backend); |
| 214 | 211 | } |
| 215 | 212 | |
| 216 | - public function Menu() |
|
| 217 | - { |
|
| 213 | + public function Menu() { |
|
| 218 | 214 | $list = new ArrayList(); |
| 219 | 215 | |
| 220 | 216 | $controller = Controller::curr(); |
@@ -236,8 +232,7 @@ discard block |
||
| 236 | 232 | * Return the current object from $this->Menu() |
| 237 | 233 | * Good for making titles and things |
| 238 | 234 | */ |
| 239 | - public function CurrentMenu() |
|
| 240 | - { |
|
| 235 | + public function CurrentMenu() { |
|
| 241 | 236 | return $this->Menu()->filter('IsSection', true)->First(); |
| 242 | 237 | } |
| 243 | 238 | |
@@ -247,13 +242,11 @@ discard block |
||
| 247 | 242 | * @param string $separator The string used when concatenating project with env name |
| 248 | 243 | * @return string |
| 249 | 244 | */ |
| 250 | - public function getFullName($separator = ':') |
|
| 251 | - { |
|
| 245 | + public function getFullName($separator = ':') { |
|
| 252 | 246 | return sprintf('%s%s%s', $this->Project()->Name, $separator, $this->Name); |
| 253 | 247 | } |
| 254 | 248 | |
| 255 | - public function getBareURL() |
|
| 256 | - { |
|
| 249 | + public function getBareURL() { |
|
| 257 | 250 | $url = parse_url($this->URL); |
| 258 | 251 | if (isset($url['host'])) { |
| 259 | 252 | return strtolower($url['host']); |
@@ -263,8 +256,7 @@ discard block |
||
| 263 | 256 | /** |
| 264 | 257 | * @return boolean true if there is a pipeline for the current environment. |
| 265 | 258 | */ |
| 266 | - public function HasPipelineSupport() |
|
| 267 | - { |
|
| 259 | + public function HasPipelineSupport() { |
|
| 268 | 260 | $config = $this->GenericPipelineConfig(); |
| 269 | 261 | return $config instanceof ArrayData && isset($config->Steps); |
| 270 | 262 | } |
@@ -275,8 +267,7 @@ discard block |
||
| 275 | 267 | * |
| 276 | 268 | * @return Pipeline |
| 277 | 269 | */ |
| 278 | - public function GenericPipeline() |
|
| 279 | - { |
|
| 270 | + public function GenericPipeline() { |
|
| 280 | 271 | $pipeline = Pipeline::create(); |
| 281 | 272 | $pipeline->EnvironmentID = $this->ID; |
| 282 | 273 | return $pipeline; |
@@ -287,8 +278,7 @@ discard block |
||
| 287 | 278 | * |
| 288 | 279 | * @return ArrayData |
| 289 | 280 | */ |
| 290 | - public function GenericPipelineConfig() |
|
| 291 | - { |
|
| 281 | + public function GenericPipelineConfig() { |
|
| 292 | 282 | $config = $this->loadPipelineConfig(); |
| 293 | 283 | if ($config) { |
| 294 | 284 | return self::array_to_viewabledata($config); |
@@ -300,8 +290,7 @@ discard block |
||
| 300 | 290 | * |
| 301 | 291 | * @return array |
| 302 | 292 | */ |
| 303 | - public function loadPipelineConfig() |
|
| 304 | - { |
|
| 293 | + public function loadPipelineConfig() { |
|
| 305 | 294 | require_once 'thirdparty/spyc/spyc.php'; |
| 306 | 295 | |
| 307 | 296 | $path = $this->getPipelineFilename(); |
@@ -316,8 +305,7 @@ discard block |
||
| 316 | 305 | * `DependsOnEnvironment` - these are used together to find the {@link DNEnvironment} that this environment should |
| 317 | 306 | * rely on. |
| 318 | 307 | */ |
| 319 | - public function DependsOnEnvironment() |
|
| 320 | - { |
|
| 308 | + public function DependsOnEnvironment() { |
|
| 321 | 309 | if ($this->HasPipelineSupport()) { |
| 322 | 310 | $pipeline = $this->GenericPipeline(); |
| 323 | 311 | return $pipeline->getDependentEnvironment(); |
@@ -329,8 +317,7 @@ discard block |
||
| 329 | 317 | /** |
| 330 | 318 | * @return bool true if there is a currently running Pipeline, and false if there isn't |
| 331 | 319 | */ |
| 332 | - public function HasCurrentPipeline() |
|
| 333 | - { |
|
| 320 | + public function HasCurrentPipeline() { |
|
| 334 | 321 | return $this->CurrentPipeline() && $this->CurrentPipeline()->isInDB(); |
| 335 | 322 | } |
| 336 | 323 | |
@@ -340,16 +327,14 @@ discard block |
||
| 340 | 327 | * |
| 341 | 328 | * @return DataObject|null The currently running pipeline, or null if there isn't any. |
| 342 | 329 | */ |
| 343 | - public function CurrentPipeline() |
|
| 344 | - { |
|
| 330 | + public function CurrentPipeline() { |
|
| 345 | 331 | return $this->Pipelines()->filter('Status', array('Running', 'Rollback'))->first(); |
| 346 | 332 | } |
| 347 | 333 | |
| 348 | 334 | /** |
| 349 | 335 | * @return bool true if the current user can cancel a running pipeline |
| 350 | 336 | */ |
| 351 | - public function CanCancelPipeline() |
|
| 352 | - { |
|
| 337 | + public function CanCancelPipeline() { |
|
| 353 | 338 | // do we have a current pipeline |
| 354 | 339 | if ($this->HasCurrentPipeline()) { |
| 355 | 340 | return $this->CurrentPipeline()->canAbort(); |
@@ -363,8 +348,7 @@ discard block |
||
| 363 | 348 | * @param Member|null $member |
| 364 | 349 | * @return boolean |
| 365 | 350 | */ |
| 366 | - public function canView($member = null) |
|
| 367 | - { |
|
| 351 | + public function canView($member = null) { |
|
| 368 | 352 | if (!$member) { |
| 369 | 353 | $member = Member::currentUser(); |
| 370 | 354 | } |
@@ -392,8 +376,7 @@ discard block |
||
| 392 | 376 | * @param Member|null $member |
| 393 | 377 | * @return boolean |
| 394 | 378 | */ |
| 395 | - public function canDeploy($member = null) |
|
| 396 | - { |
|
| 379 | + public function canDeploy($member = null) { |
|
| 397 | 380 | if (!$member) { |
| 398 | 381 | $member = Member::currentUser(); |
| 399 | 382 | } |
@@ -423,8 +406,7 @@ discard block |
||
| 423 | 406 | * @param Member|null $member The {@link Member} object to test against. If null, uses Member::currentMember(); |
| 424 | 407 | * @return boolean true if $member can restore, and false if they can't. |
| 425 | 408 | */ |
| 426 | - public function canRestore($member = null) |
|
| 427 | - { |
|
| 409 | + public function canRestore($member = null) { |
|
| 428 | 410 | if (!$member) { |
| 429 | 411 | $member = Member::currentUser(); |
| 430 | 412 | } |
@@ -454,8 +436,7 @@ discard block |
||
| 454 | 436 | * @param Member|null $member The {@link Member} object to test against. If null, uses Member::currentMember(); |
| 455 | 437 | * @return boolean true if $member can backup, and false if they can't. |
| 456 | 438 | */ |
| 457 | - public function canBackup($member = null) |
|
| 458 | - { |
|
| 439 | + public function canBackup($member = null) { |
|
| 459 | 440 | $project = $this->Project(); |
| 460 | 441 | if ($project->HasDiskQuota() && $project->HasExceededDiskQuota()) { |
| 461 | 442 | return false; |
@@ -494,8 +475,7 @@ discard block |
||
| 494 | 475 | * @param Member|null $member The {@link Member} object to test against. If null, uses Member::currentMember(); |
| 495 | 476 | * @return boolean true if $member can upload archives linked to this environment, false if they can't. |
| 496 | 477 | */ |
| 497 | - public function canUploadArchive($member = null) |
|
| 498 | - { |
|
| 478 | + public function canUploadArchive($member = null) { |
|
| 499 | 479 | $project = $this->Project(); |
| 500 | 480 | if ($project->HasDiskQuota() && $project->HasExceededDiskQuota()) { |
| 501 | 481 | return false; |
@@ -530,8 +510,7 @@ discard block |
||
| 530 | 510 | * @param Member|null $member The {@link Member} object to test against. If null, uses Member::currentMember(); |
| 531 | 511 | * @return boolean true if $member can download archives from this environment, false if they can't. |
| 532 | 512 | */ |
| 533 | - public function canDownloadArchive($member = null) |
|
| 534 | - { |
|
| 513 | + public function canDownloadArchive($member = null) { |
|
| 535 | 514 | if (!$member) { |
| 536 | 515 | $member = Member::currentUser(); |
| 537 | 516 | } |
@@ -560,8 +539,7 @@ discard block |
||
| 560 | 539 | * @param Member|null $member |
| 561 | 540 | * @return boolean |
| 562 | 541 | */ |
| 563 | - public function canAbort($member = null) |
|
| 564 | - { |
|
| 542 | + public function canAbort($member = null) { |
|
| 565 | 543 | if (!$member) { |
| 566 | 544 | $member = Member::currentUser(); |
| 567 | 545 | } |
@@ -583,8 +561,7 @@ discard block |
||
| 583 | 561 | * @param Member|null $member |
| 584 | 562 | * @return boolean |
| 585 | 563 | */ |
| 586 | - public function canApprove($member = null) |
|
| 587 | - { |
|
| 564 | + public function canApprove($member = null) { |
|
| 588 | 565 | if (!$member) { |
| 589 | 566 | $member = Member::currentUser(); |
| 590 | 567 | } |
@@ -606,8 +583,7 @@ discard block |
||
| 606 | 583 | * @param Member|null $member The {@link Member} object to test against. If null, uses Member::currentMember(); |
| 607 | 584 | * @return boolean true if $member can delete archives from this environment, false if they can't. |
| 608 | 585 | */ |
| 609 | - public function canDeleteArchive($member = null) |
|
| 610 | - { |
|
| 586 | + public function canDeleteArchive($member = null) { |
|
| 611 | 587 | if (!$member) { |
| 612 | 588 | $member = Member::currentUser(); |
| 613 | 589 | } |
@@ -635,8 +611,7 @@ discard block |
||
| 635 | 611 | * |
| 636 | 612 | * @return string |
| 637 | 613 | */ |
| 638 | - public function getDeployersList() |
|
| 639 | - { |
|
| 614 | + public function getDeployersList() { |
|
| 640 | 615 | return implode( |
| 641 | 616 | ", ", |
| 642 | 617 | array_merge( |
@@ -651,8 +626,7 @@ discard block |
||
| 651 | 626 | * |
| 652 | 627 | * @return string |
| 653 | 628 | */ |
| 654 | - public function getCanRestoreMembersList() |
|
| 655 | - { |
|
| 629 | + public function getCanRestoreMembersList() { |
|
| 656 | 630 | return implode( |
| 657 | 631 | ", ", |
| 658 | 632 | array_merge( |
@@ -667,8 +641,7 @@ discard block |
||
| 667 | 641 | * |
| 668 | 642 | * @return string |
| 669 | 643 | */ |
| 670 | - public function getCanBackupMembersList() |
|
| 671 | - { |
|
| 644 | + public function getCanBackupMembersList() { |
|
| 672 | 645 | return implode( |
| 673 | 646 | ", ", |
| 674 | 647 | array_merge( |
@@ -684,8 +657,7 @@ discard block |
||
| 684 | 657 | * |
| 685 | 658 | * @return string |
| 686 | 659 | */ |
| 687 | - public function getArchiveUploadersList() |
|
| 688 | - { |
|
| 660 | + public function getArchiveUploadersList() { |
|
| 689 | 661 | return implode( |
| 690 | 662 | ", ", |
| 691 | 663 | array_merge( |
@@ -700,8 +672,7 @@ discard block |
||
| 700 | 672 | * |
| 701 | 673 | * @return string |
| 702 | 674 | */ |
| 703 | - public function getArchiveDownloadersList() |
|
| 704 | - { |
|
| 675 | + public function getArchiveDownloadersList() { |
|
| 705 | 676 | return implode( |
| 706 | 677 | ", ", |
| 707 | 678 | array_merge( |
@@ -716,8 +687,7 @@ discard block |
||
| 716 | 687 | * |
| 717 | 688 | * @return string |
| 718 | 689 | */ |
| 719 | - public function getArchiveDeletersList() |
|
| 720 | - { |
|
| 690 | + public function getArchiveDeletersList() { |
|
| 721 | 691 | return implode( |
| 722 | 692 | ", ", |
| 723 | 693 | array_merge( |
@@ -732,8 +702,7 @@ discard block |
||
| 732 | 702 | * |
| 733 | 703 | * @return string |
| 734 | 704 | */ |
| 735 | - public function getPipelineApproversList() |
|
| 736 | - { |
|
| 705 | + public function getPipelineApproversList() { |
|
| 737 | 706 | return implode( |
| 738 | 707 | ", ", |
| 739 | 708 | array_merge( |
@@ -748,8 +717,7 @@ discard block |
||
| 748 | 717 | * |
| 749 | 718 | * @return string |
| 750 | 719 | */ |
| 751 | - public function getPipelineCancellersList() |
|
| 752 | - { |
|
| 720 | + public function getPipelineCancellersList() { |
|
| 753 | 721 | return implode( |
| 754 | 722 | ", ", |
| 755 | 723 | array_merge( |
@@ -762,8 +730,7 @@ discard block |
||
| 762 | 730 | /** |
| 763 | 731 | * @return DNData |
| 764 | 732 | */ |
| 765 | - public function DNData() |
|
| 766 | - { |
|
| 733 | + public function DNData() { |
|
| 767 | 734 | return DNData::inst(); |
| 768 | 735 | } |
| 769 | 736 | |
@@ -775,8 +742,7 @@ discard block |
||
| 775 | 742 | * |
| 776 | 743 | * @return false|DNDeployment |
| 777 | 744 | */ |
| 778 | - public function CurrentBuild() |
|
| 779 | - { |
|
| 745 | + public function CurrentBuild() { |
|
| 780 | 746 | // The DeployHistory function is far too slow to use for this |
| 781 | 747 | |
| 782 | 748 | /** @var DNDeployment $deploy */ |
@@ -815,8 +781,7 @@ discard block |
||
| 815 | 781 | * |
| 816 | 782 | * @return ArrayList |
| 817 | 783 | */ |
| 818 | - public function DeployHistory() |
|
| 819 | - { |
|
| 784 | + public function DeployHistory() { |
|
| 820 | 785 | return $this->Deployments() |
| 821 | 786 | ->where('SHA IS NOT NULL') |
| 822 | 787 | ->sort('LastEdited DESC'); |
@@ -826,8 +791,7 @@ discard block |
||
| 826 | 791 | * @param string $sha |
| 827 | 792 | * @return array |
| 828 | 793 | */ |
| 829 | - protected function getCommitData($sha) |
|
| 830 | - { |
|
| 794 | + protected function getCommitData($sha) { |
|
| 831 | 795 | try { |
| 832 | 796 | $repo = $this->Project()->getRepository(); |
| 833 | 797 | if ($repo !== false) { |
@@ -855,8 +819,7 @@ discard block |
||
| 855 | 819 | /** |
| 856 | 820 | * @return string |
| 857 | 821 | */ |
| 858 | - public function Link() |
|
| 859 | - { |
|
| 822 | + public function Link() { |
|
| 860 | 823 | return $this->Project()->Link() . "/environment/" . $this->Name; |
| 861 | 824 | } |
| 862 | 825 | |
@@ -864,8 +827,7 @@ discard block |
||
| 864 | 827 | * Is this environment currently at the root level of the controller that handles it? |
| 865 | 828 | * @return bool |
| 866 | 829 | */ |
| 867 | - public function isCurrent() |
|
| 868 | - { |
|
| 830 | + public function isCurrent() { |
|
| 869 | 831 | return $this->isSection() && Controller::curr()->getAction() == 'environment'; |
| 870 | 832 | } |
| 871 | 833 | |
@@ -873,8 +835,7 @@ discard block |
||
| 873 | 835 | * Is this environment currently in a controller that is handling it or performing a sub-task? |
| 874 | 836 | * @return bool |
| 875 | 837 | */ |
| 876 | - public function isSection() |
|
| 877 | - { |
|
| 838 | + public function isSection() { |
|
| 878 | 839 | $controller = Controller::curr(); |
| 879 | 840 | $environment = $controller->getField('CurrentEnvironment'); |
| 880 | 841 | return $environment && $environment->ID == $this->ID; |
@@ -890,8 +851,7 @@ discard block |
||
| 890 | 851 | * @param array $members List of members |
| 891 | 852 | * @return FieldGroup |
| 892 | 853 | */ |
| 893 | - protected function buildPermissionField($groupField, $memberField, $groups, $members) |
|
| 894 | - { |
|
| 854 | + protected function buildPermissionField($groupField, $memberField, $groups, $members) { |
|
| 895 | 855 | return FieldGroup::create( |
| 896 | 856 | ListboxField::create($groupField, false, $groups) |
| 897 | 857 | ->setMultiple(true) |
@@ -910,8 +870,7 @@ discard block |
||
| 910 | 870 | /** |
| 911 | 871 | * @return FieldList |
| 912 | 872 | */ |
| 913 | - public function getCMSFields() |
|
| 914 | - { |
|
| 873 | + public function getCMSFields() { |
|
| 915 | 874 | $fields = new FieldList(new TabSet('Root')); |
| 916 | 875 | |
| 917 | 876 | $project = $this->Project(); |
@@ -1090,8 +1049,7 @@ discard block |
||
| 1090 | 1049 | /** |
| 1091 | 1050 | * @param FieldList $fields |
| 1092 | 1051 | */ |
| 1093 | - protected function setDeployConfigurationFields(&$fields) |
|
| 1094 | - { |
|
| 1052 | + protected function setDeployConfigurationFields(&$fields) { |
|
| 1095 | 1053 | if (!$this->config()->get('allow_web_editing')) { |
| 1096 | 1054 | return; |
| 1097 | 1055 | } |
@@ -1115,8 +1073,7 @@ discard block |
||
| 1115 | 1073 | /** |
| 1116 | 1074 | * @param FieldList $fields |
| 1117 | 1075 | */ |
| 1118 | - protected function setPipelineConfigurationFields($fields) |
|
| 1119 | - { |
|
| 1076 | + protected function setPipelineConfigurationFields($fields) { |
|
| 1120 | 1077 | if (!$this->config()->get('allow_web_editing')) { |
| 1121 | 1078 | return; |
| 1122 | 1079 | } |
@@ -1144,8 +1101,7 @@ discard block |
||
| 1144 | 1101 | |
| 1145 | 1102 | /** |
| 1146 | 1103 | */ |
| 1147 | - public function onBeforeWrite() |
|
| 1148 | - { |
|
| 1104 | + public function onBeforeWrite() { |
|
| 1149 | 1105 | parent::onBeforeWrite(); |
| 1150 | 1106 | if ($this->Name && $this->Name . '.rb' != $this->Filename) { |
| 1151 | 1107 | $this->Filename = $this->Name . '.rb'; |
@@ -1155,8 +1111,7 @@ discard block |
||
| 1155 | 1111 | $this->writePipelineFile(); |
| 1156 | 1112 | } |
| 1157 | 1113 | |
| 1158 | - public function onAfterWrite() |
|
| 1159 | - { |
|
| 1114 | + public function onAfterWrite() { |
|
| 1160 | 1115 | parent::onAfterWrite(); |
| 1161 | 1116 | |
| 1162 | 1117 | if ($this->Usage == 'Production' || $this->Usage == 'UAT') { |
@@ -1176,8 +1131,7 @@ discard block |
||
| 1176 | 1131 | /** |
| 1177 | 1132 | * Ensure that environment paths are setup on the local filesystem |
| 1178 | 1133 | */ |
| 1179 | - protected function checkEnvironmentPath() |
|
| 1180 | - { |
|
| 1134 | + protected function checkEnvironmentPath() { |
|
| 1181 | 1135 | // Create folder if it doesn't exist |
| 1182 | 1136 | $configDir = dirname($this->getConfigFilename()); |
| 1183 | 1137 | if (!file_exists($configDir) && $configDir) { |
@@ -1188,8 +1142,7 @@ discard block |
||
| 1188 | 1142 | /** |
| 1189 | 1143 | * Write the deployment config file to filesystem |
| 1190 | 1144 | */ |
| 1191 | - protected function writeConfigFile() |
|
| 1192 | - { |
|
| 1145 | + protected function writeConfigFile() { |
|
| 1193 | 1146 | if (!$this->config()->get('allow_web_editing')) { |
| 1194 | 1147 | return; |
| 1195 | 1148 | } |
@@ -1209,8 +1162,7 @@ discard block |
||
| 1209 | 1162 | /** |
| 1210 | 1163 | * Write the pipeline config file to filesystem |
| 1211 | 1164 | */ |
| 1212 | - protected function writePipelineFile() |
|
| 1213 | - { |
|
| 1165 | + protected function writePipelineFile() { |
|
| 1214 | 1166 | if (!$this->config()->get('allow_web_editing')) { |
| 1215 | 1167 | return; |
| 1216 | 1168 | } |
@@ -1227,8 +1179,7 @@ discard block |
||
| 1227 | 1179 | /** |
| 1228 | 1180 | * Delete any related config files |
| 1229 | 1181 | */ |
| 1230 | - public function onAfterDelete() |
|
| 1231 | - { |
|
| 1182 | + public function onAfterDelete() { |
|
| 1232 | 1183 | parent::onAfterDelete(); |
| 1233 | 1184 | // Create a basic new environment config from a template |
| 1234 | 1185 | if ($this->config()->get('allow_web_editing') && $this->envFileExists()) { |
@@ -1244,8 +1195,7 @@ discard block |
||
| 1244 | 1195 | /** |
| 1245 | 1196 | * @return string |
| 1246 | 1197 | */ |
| 1247 | - protected function getEnvironmentConfig() |
|
| 1248 | - { |
|
| 1198 | + protected function getEnvironmentConfig() { |
|
| 1249 | 1199 | if (!$this->envFileExists()) { |
| 1250 | 1200 | return ''; |
| 1251 | 1201 | } |
@@ -1255,8 +1205,7 @@ discard block |
||
| 1255 | 1205 | /** |
| 1256 | 1206 | * @return boolean |
| 1257 | 1207 | */ |
| 1258 | - protected function envFileExists() |
|
| 1259 | - { |
|
| 1208 | + protected function envFileExists() { |
|
| 1260 | 1209 | if (!$this->getConfigFilename()) { |
| 1261 | 1210 | return false; |
| 1262 | 1211 | } |
@@ -1268,8 +1217,7 @@ discard block |
||
| 1268 | 1217 | * |
| 1269 | 1218 | * @return string |
| 1270 | 1219 | */ |
| 1271 | - public function getConfigFilename() |
|
| 1272 | - { |
|
| 1220 | + public function getConfigFilename() { |
|
| 1273 | 1221 | if (!$this->Project()->exists()) { |
| 1274 | 1222 | return ''; |
| 1275 | 1223 | } |
@@ -1285,8 +1233,7 @@ discard block |
||
| 1285 | 1233 | * |
| 1286 | 1234 | * @return string |
| 1287 | 1235 | */ |
| 1288 | - public function getPipelineFilename() |
|
| 1289 | - { |
|
| 1236 | + public function getPipelineFilename() { |
|
| 1290 | 1237 | $name = $this->getConfigFilename(); |
| 1291 | 1238 | if (!$name) { |
| 1292 | 1239 | return null; |
@@ -1302,8 +1249,7 @@ discard block |
||
| 1302 | 1249 | * |
| 1303 | 1250 | * @return boolean |
| 1304 | 1251 | */ |
| 1305 | - protected function pipelineFileExists() |
|
| 1306 | - { |
|
| 1252 | + protected function pipelineFileExists() { |
|
| 1307 | 1253 | $filename = $this->getPipelineFilename(); |
| 1308 | 1254 | if (empty($filename)) { |
| 1309 | 1255 | return false; |
@@ -1319,8 +1265,7 @@ discard block |
||
| 1319 | 1265 | * @return object Either an {@link ArrayList} or {@link ArrayData} object, or the original item ($array) if $array |
| 1320 | 1266 | * isn't an array. |
| 1321 | 1267 | */ |
| 1322 | - public static function array_to_viewabledata($array) |
|
| 1323 | - { |
|
| 1268 | + public static function array_to_viewabledata($array) { |
|
| 1324 | 1269 | // Don't transform non-arrays |
| 1325 | 1270 | if (!is_array($array)) { |
| 1326 | 1271 | return $array; |
@@ -1354,8 +1299,7 @@ discard block |
||
| 1354 | 1299 | * |
| 1355 | 1300 | * @return DataList |
| 1356 | 1301 | */ |
| 1357 | - public function getDependentFilteredCommits() |
|
| 1358 | - { |
|
| 1302 | + public function getDependentFilteredCommits() { |
|
| 1359 | 1303 | // check if this environment depends on another environemnt |
| 1360 | 1304 | $dependsOnEnv = $this->DependsOnEnvironment(); |
| 1361 | 1305 | if (empty($dependsOnEnv)) { |
@@ -1386,8 +1330,7 @@ discard block |
||
| 1386 | 1330 | * |
| 1387 | 1331 | * @param DeploynautLogFile $log |
| 1388 | 1332 | */ |
| 1389 | - public function enableMaintenace($log) |
|
| 1390 | - { |
|
| 1333 | + public function enableMaintenace($log) { |
|
| 1391 | 1334 | $this->Backend() |
| 1392 | 1335 | ->enableMaintenance($this, $log, $this->Project()); |
| 1393 | 1336 | } |
@@ -1397,14 +1340,12 @@ discard block |
||
| 1397 | 1340 | * |
| 1398 | 1341 | * @param DeploynautLogFile $log |
| 1399 | 1342 | */ |
| 1400 | - public function disableMaintenance($log) |
|
| 1401 | - { |
|
| 1343 | + public function disableMaintenance($log) { |
|
| 1402 | 1344 | $this->Backend() |
| 1403 | 1345 | ->disableMaintenance($this, $log, $this->Project()); |
| 1404 | 1346 | } |
| 1405 | 1347 | |
| 1406 | - protected function validate() |
|
| 1407 | - { |
|
| 1348 | + protected function validate() { |
|
| 1408 | 1349 | $result = parent::validate(); |
| 1409 | 1350 | $backend = $this->Backend(); |
| 1410 | 1351 | |
@@ -6,13 +6,11 @@ |
||
| 6 | 6 | * Class to represent failed commits |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class DNFailedCommits extends DNFilteredCommits |
|
| 10 | -{ |
|
| 9 | +class DNFailedCommits extends DNFilteredCommits { |
|
| 11 | 10 | |
| 12 | 11 | private $description = 'Commits that have failed in the past'; |
| 13 | 12 | |
| 14 | - public function __construct() |
|
| 15 | - { |
|
| 13 | + public function __construct() { |
|
| 16 | 14 | parent::__construct(); |
| 17 | 15 | $this->setFilter('Failed'); |
| 18 | 16 | } |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * PerformTestOn: 'ThisEnvironment' |
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | -class DNFilteredCommits extends Object |
|
| 31 | -{ |
|
| 30 | +class DNFilteredCommits extends Object { |
|
| 32 | 31 | |
| 33 | 32 | public $env; |
| 34 | 33 | |
@@ -39,13 +38,11 @@ discard block |
||
| 39 | 38 | // default sort to be by the latest commit |
| 40 | 39 | protected $sort = 'DESC'; |
| 41 | 40 | |
| 42 | - public function setFilter($filter = 'Finished') |
|
| 43 | - { |
|
| 41 | + public function setFilter($filter = 'Finished') { |
|
| 44 | 42 | $this->filter = $filter; |
| 45 | 43 | } |
| 46 | 44 | |
| 47 | - public function getCommits() |
|
| 48 | - { |
|
| 45 | + public function getCommits() { |
|
| 49 | 46 | if (!isset($this->env)) { |
| 50 | 47 | $this->environmentNotSetException(); |
| 51 | 48 | } |
@@ -56,8 +53,7 @@ discard block |
||
| 56 | 53 | return $successfulCommits; |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | - public function getLatestCommit() |
|
| 60 | - { |
|
| 56 | + public function getLatestCommit() { |
|
| 61 | 57 | if (!isset($this->env)) { |
| 62 | 58 | $this->environmentNotSetException(); |
| 63 | 59 | } |
@@ -65,8 +61,7 @@ discard block |
||
| 65 | 61 | return $commits->first(); |
| 66 | 62 | } |
| 67 | 63 | |
| 68 | - private function environmentNotSetException() |
|
| 69 | - { |
|
| 64 | + private function environmentNotSetException() { |
|
| 70 | 65 | throw new Exception($this->environmentExceptionError); |
| 71 | 66 | } |
| 72 | 67 | } |
@@ -6,15 +6,13 @@ |
||
| 6 | 6 | * Class to represent finished commits |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class DNFinishedCommits extends DNFilteredCommits |
|
| 10 | -{ |
|
| 9 | +class DNFinishedCommits extends DNFilteredCommits { |
|
| 11 | 10 | /** |
| 12 | 11 | * @var string |
| 13 | 12 | */ |
| 14 | 13 | private $description = 'Commits successfully deployed in the past'; |
| 15 | 14 | |
| 16 | - public function __construct() |
|
| 17 | - { |
|
| 15 | + public function __construct() { |
|
| 18 | 16 | parent::__construct(); |
| 19 | 17 | $this->setFilter('Finished'); |
| 20 | 18 | } |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | * @method ManyManyList Viewers() |
| 13 | 13 | * @method ManyManyList StarredBy() |
| 14 | 14 | */ |
| 15 | -class DNProject extends DataObject |
|
| 16 | -{ |
|
| 15 | +class DNProject extends DataObject { |
|
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | 18 | * @var array |
@@ -103,8 +102,7 @@ discard block |
||
| 103 | 102 | * @param string $path |
| 104 | 103 | * @return \DNProject |
| 105 | 104 | */ |
| 106 | - public static function create_from_path($path) |
|
| 107 | - { |
|
| 105 | + public static function create_from_path($path) { |
|
| 108 | 106 | $project = DNProject::create(); |
| 109 | 107 | $project->Name = $path; |
| 110 | 108 | $project->write(); |
@@ -123,8 +121,7 @@ discard block |
||
| 123 | 121 | * @param int $round Number of decimal places to round to |
| 124 | 122 | * @return double The used quota size in MB |
| 125 | 123 | */ |
| 126 | - public function getUsedQuotaMB($round = 2) |
|
| 127 | - { |
|
| 124 | + public function getUsedQuotaMB($round = 2) { |
|
| 128 | 125 | $size = 0; |
| 129 | 126 | |
| 130 | 127 | foreach ($this->Environments() as $environment) { |
@@ -144,8 +141,7 @@ discard block |
||
| 144 | 141 | * |
| 145 | 142 | * @return string|int The quota size in MB |
| 146 | 143 | */ |
| 147 | - public function getDiskQuotaMB() |
|
| 148 | - { |
|
| 144 | + public function getDiskQuotaMB() { |
|
| 149 | 145 | $size = $this->getField('DiskQuotaMB'); |
| 150 | 146 | |
| 151 | 147 | if (empty($size)) { |
@@ -161,8 +157,7 @@ discard block |
||
| 161 | 157 | * |
| 162 | 158 | * @return boolean |
| 163 | 159 | */ |
| 164 | - public function HasExceededDiskQuota() |
|
| 165 | - { |
|
| 160 | + public function HasExceededDiskQuota() { |
|
| 166 | 161 | return $this->getUsedQuotaMB(0) >= $this->getDiskQuotaMB(); |
| 167 | 162 | } |
| 168 | 163 | |
@@ -171,8 +166,7 @@ discard block |
||
| 171 | 166 | * |
| 172 | 167 | * @return boolean |
| 173 | 168 | */ |
| 174 | - public function HasDiskQuota() |
|
| 175 | - { |
|
| 169 | + public function HasDiskQuota() { |
|
| 176 | 170 | return $this->getDiskQuotaMB() > 0; |
| 177 | 171 | } |
| 178 | 172 | |
@@ -181,8 +175,7 @@ discard block |
||
| 181 | 175 | * |
| 182 | 176 | * @return int |
| 183 | 177 | */ |
| 184 | - public function DiskQuotaUsagePercent() |
|
| 185 | - { |
|
| 178 | + public function DiskQuotaUsagePercent() { |
|
| 186 | 179 | $quota = $this->getDiskQuotaMB(); |
| 187 | 180 | if ($quota > 0) { |
| 188 | 181 | return $this->getUsedQuotaMB() * 100 / $quota; |
@@ -195,8 +188,7 @@ discard block |
||
| 195 | 188 | * |
| 196 | 189 | * @return ArrayList |
| 197 | 190 | */ |
| 198 | - public function Menu() |
|
| 199 | - { |
|
| 191 | + public function Menu() { |
|
| 200 | 192 | $list = new ArrayList(); |
| 201 | 193 | |
| 202 | 194 | $controller = Controller::curr(); |
@@ -221,8 +213,7 @@ discard block |
||
| 221 | 213 | * |
| 222 | 214 | * @return bool |
| 223 | 215 | */ |
| 224 | - public function isCurrent() |
|
| 225 | - { |
|
| 216 | + public function isCurrent() { |
|
| 226 | 217 | return $this->isSection() && Controller::curr()->getAction() == 'project'; |
| 227 | 218 | } |
| 228 | 219 | |
@@ -232,8 +223,7 @@ discard block |
||
| 232 | 223 | * |
| 233 | 224 | * @return DataObject |
| 234 | 225 | */ |
| 235 | - public function CurrentMenu() |
|
| 236 | - { |
|
| 226 | + public function CurrentMenu() { |
|
| 237 | 227 | return $this->Menu()->filter('IsSection', true)->First(); |
| 238 | 228 | } |
| 239 | 229 | |
@@ -242,8 +232,7 @@ discard block |
||
| 242 | 232 | * |
| 243 | 233 | * @return bool |
| 244 | 234 | */ |
| 245 | - public function isSection() |
|
| 246 | - { |
|
| 235 | + public function isSection() { |
|
| 247 | 236 | $controller = Controller::curr(); |
| 248 | 237 | $project = $controller->getField('CurrentProject'); |
| 249 | 238 | return $project && $this->ID == $project->ID; |
@@ -255,8 +244,7 @@ discard block |
||
| 255 | 244 | * @param Member|null $member |
| 256 | 245 | * @return boolean |
| 257 | 246 | */ |
| 258 | - public function canView($member = null) |
|
| 259 | - { |
|
| 247 | + public function canView($member = null) { |
|
| 260 | 248 | if (!$member) { |
| 261 | 249 | $member = Member::currentUser(); |
| 262 | 250 | } |
@@ -273,8 +261,7 @@ discard block |
||
| 273 | 261 | * |
| 274 | 262 | * @return bool |
| 275 | 263 | */ |
| 276 | - public function canRestore($member = null) |
|
| 277 | - { |
|
| 264 | + public function canRestore($member = null) { |
|
| 278 | 265 | if ($this->allowedAny( |
| 279 | 266 | array( |
| 280 | 267 | DNRoot::ALLOW_PROD_SNAPSHOT, |
@@ -294,8 +281,7 @@ discard block |
||
| 294 | 281 | * @param Member|null $member |
| 295 | 282 | * @return bool |
| 296 | 283 | */ |
| 297 | - public function canBackup($member = null) |
|
| 298 | - { |
|
| 284 | + public function canBackup($member = null) { |
|
| 299 | 285 | if ($this->allowedAny( |
| 300 | 286 | array( |
| 301 | 287 | DNRoot::ALLOW_PROD_SNAPSHOT, |
@@ -315,8 +301,7 @@ discard block |
||
| 315 | 301 | * @param Member|null $member |
| 316 | 302 | * @return bool |
| 317 | 303 | */ |
| 318 | - public function canUploadArchive($member = null) |
|
| 319 | - { |
|
| 304 | + public function canUploadArchive($member = null) { |
|
| 320 | 305 | if ($this->allowedAny( |
| 321 | 306 | array( |
| 322 | 307 | DNRoot::ALLOW_PROD_SNAPSHOT, |
@@ -336,8 +321,7 @@ discard block |
||
| 336 | 321 | * @param Member|null $member |
| 337 | 322 | * @return bool |
| 338 | 323 | */ |
| 339 | - public function canDownloadArchive($member = null) |
|
| 340 | - { |
|
| 324 | + public function canDownloadArchive($member = null) { |
|
| 341 | 325 | if ($this->allowedAny( |
| 342 | 326 | array( |
| 343 | 327 | DNRoot::ALLOW_PROD_SNAPSHOT, |
@@ -363,8 +347,7 @@ discard block |
||
| 363 | 347 | * |
| 364 | 348 | * @return bool |
| 365 | 349 | */ |
| 366 | - public function canCreateEnvironments($member = null) |
|
| 367 | - { |
|
| 350 | + public function canCreateEnvironments($member = null) { |
|
| 368 | 351 | $envType = $this->AllowedEnvironmentType; |
| 369 | 352 | if ($envType) { |
| 370 | 353 | $env = Injector::inst()->get($envType); |
@@ -378,8 +361,7 @@ discard block |
||
| 378 | 361 | /** |
| 379 | 362 | * @return DataList |
| 380 | 363 | */ |
| 381 | - public function DataArchives() |
|
| 382 | - { |
|
| 364 | + public function DataArchives() { |
|
| 383 | 365 | $envIds = $this->Environments()->column('ID'); |
| 384 | 366 | return DNDataArchive::get()->filter('EnvironmentID', $envIds); |
| 385 | 367 | } |
@@ -390,8 +372,7 @@ discard block |
||
| 390 | 372 | * |
| 391 | 373 | * @return DataList |
| 392 | 374 | */ |
| 393 | - public function PendingManualUploadDataArchives() |
|
| 394 | - { |
|
| 375 | + public function PendingManualUploadDataArchives() { |
|
| 395 | 376 | return $this->DataArchives()->filter('ArchiveFileID', null); |
| 396 | 377 | } |
| 397 | 378 | |
@@ -405,8 +386,7 @@ discard block |
||
| 405 | 386 | * |
| 406 | 387 | * @return array |
| 407 | 388 | */ |
| 408 | - public function getProcessEnv() |
|
| 409 | - { |
|
| 389 | + public function getProcessEnv() { |
|
| 410 | 390 | if (file_exists($this->getPrivateKeyPath())) { |
| 411 | 391 | // Key-pair is available, use it. |
| 412 | 392 | $processEnv = array( |
@@ -426,16 +406,14 @@ discard block |
||
| 426 | 406 | * |
| 427 | 407 | * @return string |
| 428 | 408 | */ |
| 429 | - public function getViewersList() |
|
| 430 | - { |
|
| 409 | + public function getViewersList() { |
|
| 431 | 410 | return implode(", ", $this->Viewers()->column("Title")); |
| 432 | 411 | } |
| 433 | 412 | |
| 434 | 413 | /** |
| 435 | 414 | * @return DNData |
| 436 | 415 | */ |
| 437 | - public function DNData() |
|
| 438 | - { |
|
| 416 | + public function DNData() { |
|
| 439 | 417 | return DNData::inst(); |
| 440 | 418 | } |
| 441 | 419 | |
@@ -444,8 +422,7 @@ discard block |
||
| 444 | 422 | * |
| 445 | 423 | * @return DNReferenceList |
| 446 | 424 | */ |
| 447 | - public function DNBuildList() |
|
| 448 | - { |
|
| 425 | + public function DNBuildList() { |
|
| 449 | 426 | return DNReferenceList::create($this, $this->DNData()); |
| 450 | 427 | } |
| 451 | 428 | |
@@ -454,8 +431,7 @@ discard block |
||
| 454 | 431 | * |
| 455 | 432 | * @return DNBranchList |
| 456 | 433 | */ |
| 457 | - public function DNBranchList() |
|
| 458 | - { |
|
| 434 | + public function DNBranchList() { |
|
| 459 | 435 | if ($this->CVSPath && !$this->repoExists()) { |
| 460 | 436 | $this->cloneRepo(); |
| 461 | 437 | } |
@@ -467,8 +443,7 @@ discard block |
||
| 467 | 443 | * |
| 468 | 444 | * @return DNReferenceList |
| 469 | 445 | */ |
| 470 | - public function DNTagList() |
|
| 471 | - { |
|
| 446 | + public function DNTagList() { |
|
| 472 | 447 | if ($this->CVSPath && !$this->repoExists()) { |
| 473 | 448 | $this->cloneRepo(); |
| 474 | 449 | } |
@@ -478,8 +453,7 @@ discard block |
||
| 478 | 453 | /** |
| 479 | 454 | * @return false|Gitonomy\Git\Repository |
| 480 | 455 | */ |
| 481 | - public function getRepository() |
|
| 482 | - { |
|
| 456 | + public function getRepository() { |
|
| 483 | 457 | if (!$this->repoExists()) { |
| 484 | 458 | return false; |
| 485 | 459 | } |
@@ -493,8 +467,7 @@ discard block |
||
| 493 | 467 | * |
| 494 | 468 | * @return ArrayList |
| 495 | 469 | */ |
| 496 | - public function DNEnvironmentList() |
|
| 497 | - { |
|
| 470 | + public function DNEnvironmentList() { |
|
| 498 | 471 | if (!self::$_current_member_cache) { |
| 499 | 472 | self::$_current_member_cache = Member::currentUser(); |
| 500 | 473 | } |
@@ -514,8 +487,7 @@ discard block |
||
| 514 | 487 | * @param string $usage |
| 515 | 488 | * @return ArrayList |
| 516 | 489 | */ |
| 517 | - public function EnvironmentsByUsage($usage) |
|
| 518 | - { |
|
| 490 | + public function EnvironmentsByUsage($usage) { |
|
| 519 | 491 | return $this->DNEnvironmentList()->filter('Usage', $usage); |
| 520 | 492 | } |
| 521 | 493 | |
@@ -524,8 +496,7 @@ discard block |
||
| 524 | 496 | * |
| 525 | 497 | * @return false|DNDeployment |
| 526 | 498 | */ |
| 527 | - public function currentBuilds() |
|
| 528 | - { |
|
| 499 | + public function currentBuilds() { |
|
| 529 | 500 | if (!isset(self::$relation_cache['currentBuilds.'.$this->ID])) { |
| 530 | 501 | $currentBuilds = array(); |
| 531 | 502 | foreach ($this->Environments() as $env) { |
@@ -540,16 +511,14 @@ discard block |
||
| 540 | 511 | * @param string |
| 541 | 512 | * @return string |
| 542 | 513 | */ |
| 543 | - public function Link($action = '') |
|
| 544 | - { |
|
| 514 | + public function Link($action = '') { |
|
| 545 | 515 | return Controller::join_links("naut", "project", $this->Name, $action); |
| 546 | 516 | } |
| 547 | 517 | |
| 548 | 518 | /** |
| 549 | 519 | * @return string|null |
| 550 | 520 | */ |
| 551 | - public function CreateEnvironmentLink() |
|
| 552 | - { |
|
| 521 | + public function CreateEnvironmentLink() { |
|
| 553 | 522 | if ($this->canCreateEnvironments()) { |
| 554 | 523 | return $this->Link('createenv'); |
| 555 | 524 | } |
@@ -559,16 +528,14 @@ discard block |
||
| 559 | 528 | /** |
| 560 | 529 | * @return string |
| 561 | 530 | */ |
| 562 | - public function ToggleStarLink() |
|
| 563 | - { |
|
| 531 | + public function ToggleStarLink() { |
|
| 564 | 532 | return $this->Link('/star'); |
| 565 | 533 | } |
| 566 | 534 | |
| 567 | 535 | /** |
| 568 | 536 | * @return bool |
| 569 | 537 | */ |
| 570 | - public function IsStarred() |
|
| 571 | - { |
|
| 538 | + public function IsStarred() { |
|
| 572 | 539 | $member = Member::currentUser(); |
| 573 | 540 | if ($member === null) { |
| 574 | 541 | return false; |
@@ -584,16 +551,14 @@ discard block |
||
| 584 | 551 | * @param string $action |
| 585 | 552 | * @return string |
| 586 | 553 | */ |
| 587 | - public function APILink($action) |
|
| 588 | - { |
|
| 554 | + public function APILink($action) { |
|
| 589 | 555 | return Controller::join_links("naut", "api", $this->Name, $action); |
| 590 | 556 | } |
| 591 | 557 | |
| 592 | 558 | /** |
| 593 | 559 | * @return FieldList |
| 594 | 560 | */ |
| 595 | - public function getCMSFields() |
|
| 596 | - { |
|
| 561 | + public function getCMSFields() { |
|
| 597 | 562 | $fields = parent::getCMSFields(); |
| 598 | 563 | |
| 599 | 564 | /** @var GridField $environments */ |
@@ -653,8 +618,7 @@ discard block |
||
| 653 | 618 | * |
| 654 | 619 | * @param FieldList $fields |
| 655 | 620 | */ |
| 656 | - public function setCreateProjectFolderField(&$fields) |
|
| 657 | - { |
|
| 621 | + public function setCreateProjectFolderField(&$fields) { |
|
| 658 | 622 | // Check if the capistrano project folder exists |
| 659 | 623 | if (!$this->Name) { |
| 660 | 624 | return; |
@@ -675,16 +639,14 @@ discard block |
||
| 675 | 639 | /** |
| 676 | 640 | * @return boolean |
| 677 | 641 | */ |
| 678 | - public function projectFolderExists() |
|
| 679 | - { |
|
| 642 | + public function projectFolderExists() { |
|
| 680 | 643 | return file_exists($this->getProjectFolderPath()); |
| 681 | 644 | } |
| 682 | 645 | |
| 683 | 646 | /** |
| 684 | 647 | * @return bool |
| 685 | 648 | */ |
| 686 | - public function repoExists() |
|
| 687 | - { |
|
| 649 | + public function repoExists() { |
|
| 688 | 650 | return file_exists(sprintf('%s/HEAD', $this->getLocalCVSPath())); |
| 689 | 651 | } |
| 690 | 652 | |
@@ -692,8 +654,7 @@ discard block |
||
| 692 | 654 | * Setup a job to clone a git repository. |
| 693 | 655 | * @return string resque token |
| 694 | 656 | */ |
| 695 | - public function cloneRepo() |
|
| 696 | - { |
|
| 657 | + public function cloneRepo() { |
|
| 697 | 658 | // Avoid this being called multiple times in the same request |
| 698 | 659 | if (!isset(self::$has_cloned_cache[$this->ID])) { |
| 699 | 660 | $fetch = DNGitFetch::create(); |
@@ -712,13 +673,11 @@ discard block |
||
| 712 | 673 | /** |
| 713 | 674 | * @return string |
| 714 | 675 | */ |
| 715 | - public function getLocalCVSPath() |
|
| 716 | - { |
|
| 676 | + public function getLocalCVSPath() { |
|
| 717 | 677 | return sprintf('%s/%s', DEPLOYNAUT_LOCAL_VCS_PATH, $this->Name); |
| 718 | 678 | } |
| 719 | 679 | |
| 720 | - public function onBeforeWrite() |
|
| 721 | - { |
|
| 680 | + public function onBeforeWrite() { |
|
| 722 | 681 | parent::onBeforeWrite(); |
| 723 | 682 | |
| 724 | 683 | if ($this->CreateEnvFolder && !file_exists($this->getProjectFolderPath())) { |
@@ -726,8 +685,7 @@ discard block |
||
| 726 | 685 | } |
| 727 | 686 | } |
| 728 | 687 | |
| 729 | - public function onAfterWrite() |
|
| 730 | - { |
|
| 688 | + public function onAfterWrite() { |
|
| 731 | 689 | parent::onAfterWrite(); |
| 732 | 690 | |
| 733 | 691 | if (!$this->CVSPath) { |
@@ -743,8 +701,7 @@ discard block |
||
| 743 | 701 | /** |
| 744 | 702 | * Delete related environments and folders |
| 745 | 703 | */ |
| 746 | - public function onAfterDelete() |
|
| 747 | - { |
|
| 704 | + public function onAfterDelete() { |
|
| 748 | 705 | parent::onAfterDelete(); |
| 749 | 706 | |
| 750 | 707 | // Delete related environments |
@@ -773,8 +730,7 @@ discard block |
||
| 773 | 730 | * |
| 774 | 731 | * @return string|void |
| 775 | 732 | */ |
| 776 | - public function getPublicKey() |
|
| 777 | - { |
|
| 733 | + public function getPublicKey() { |
|
| 778 | 734 | $key = $this->getPublicKeyPath(); |
| 779 | 735 | |
| 780 | 736 | if (file_exists($key)) { |
@@ -787,8 +743,7 @@ discard block |
||
| 787 | 743 | * |
| 788 | 744 | * @return string|null |
| 789 | 745 | */ |
| 790 | - public function getPublicKeyPath() |
|
| 791 | - { |
|
| 746 | + public function getPublicKeyPath() { |
|
| 792 | 747 | if ($privateKey = $this->getPrivateKeyPath()) { |
| 793 | 748 | return $privateKey . '.pub'; |
| 794 | 749 | } |
@@ -800,8 +755,7 @@ discard block |
||
| 800 | 755 | * |
| 801 | 756 | * @return string|null |
| 802 | 757 | */ |
| 803 | - public function getPrivateKeyPath() |
|
| 804 | - { |
|
| 758 | + public function getPrivateKeyPath() { |
|
| 805 | 759 | $keyDir = $this->getKeyDir(); |
| 806 | 760 | if (!empty($keyDir)) { |
| 807 | 761 | $filter = FileNameFilter::create(); |
@@ -816,8 +770,7 @@ discard block |
||
| 816 | 770 | * |
| 817 | 771 | * @return string|null |
| 818 | 772 | */ |
| 819 | - public function getKeyDir() |
|
| 820 | - { |
|
| 773 | + public function getKeyDir() { |
|
| 821 | 774 | $keyDir = $this->DNData()->getKeyDir(); |
| 822 | 775 | if (!$keyDir) { |
| 823 | 776 | return null; |
@@ -835,8 +788,7 @@ discard block |
||
| 835 | 788 | * @param FieldList $fields |
| 836 | 789 | * @param GridField $environments |
| 837 | 790 | */ |
| 838 | - protected function setEnvironmentFields(&$fields, $environments) |
|
| 839 | - { |
|
| 791 | + protected function setEnvironmentFields(&$fields, $environments) { |
|
| 840 | 792 | if (!$environments) { |
| 841 | 793 | return; |
| 842 | 794 | } |
@@ -860,8 +812,7 @@ discard block |
||
| 860 | 812 | * |
| 861 | 813 | * @return void|string |
| 862 | 814 | */ |
| 863 | - public function getRepositoryURL() |
|
| 864 | - { |
|
| 815 | + public function getRepositoryURL() { |
|
| 865 | 816 | $showUrl = Config::inst()->get($this->class, 'show_repository_url'); |
| 866 | 817 | if ($showUrl) { |
| 867 | 818 | return $this->CVSPath; |
@@ -911,8 +862,7 @@ discard block |
||
| 911 | 862 | * |
| 912 | 863 | * @return ArrayData |
| 913 | 864 | */ |
| 914 | - public function getRepositoryInterface() |
|
| 915 | - { |
|
| 865 | + public function getRepositoryInterface() { |
|
| 916 | 866 | $interfaces = $this->config()->repository_interfaces; |
| 917 | 867 | |
| 918 | 868 | /* Look for each whitelisted hostname */ |
@@ -955,8 +905,7 @@ discard block |
||
| 955 | 905 | /** |
| 956 | 906 | * @return string |
| 957 | 907 | */ |
| 958 | - protected function getProjectFolderPath() |
|
| 959 | - { |
|
| 908 | + protected function getProjectFolderPath() { |
|
| 960 | 909 | return sprintf('%s/%s', $this->DNData()->getEnvironmentDir(), $this->Name); |
| 961 | 910 | } |
| 962 | 911 | |
@@ -966,8 +915,7 @@ discard block |
||
| 966 | 915 | * @param string $code |
| 967 | 916 | * @return SS_List |
| 968 | 917 | */ |
| 969 | - public function whoIsAllowed($code) |
|
| 970 | - { |
|
| 918 | + public function whoIsAllowed($code) { |
|
| 971 | 919 | return $this->whoIsAllowedAny(array($code)); |
| 972 | 920 | } |
| 973 | 921 | |
@@ -978,8 +926,7 @@ discard block |
||
| 978 | 926 | * @param array|string $codes |
| 979 | 927 | * @return SS_List |
| 980 | 928 | */ |
| 981 | - public function whoIsAllowedAny($codes) |
|
| 982 | - { |
|
| 929 | + public function whoIsAllowedAny($codes) { |
|
| 983 | 930 | if (!is_array($codes)) { |
| 984 | 931 | $codes = array($codes); |
| 985 | 932 | } |
@@ -1007,8 +954,7 @@ discard block |
||
| 1007 | 954 | * |
| 1008 | 955 | * @return bool |
| 1009 | 956 | */ |
| 1010 | - public function allowed($code, $member = null) |
|
| 1011 | - { |
|
| 957 | + public function allowed($code, $member = null) { |
|
| 1012 | 958 | return $this->allowedAny(array($code), $member); |
| 1013 | 959 | } |
| 1014 | 960 | |
@@ -1020,8 +966,7 @@ discard block |
||
| 1020 | 966 | * |
| 1021 | 967 | * @return bool |
| 1022 | 968 | */ |
| 1023 | - public function groupAllowed($permissionCode, Group $group) |
|
| 1024 | - { |
|
| 969 | + public function groupAllowed($permissionCode, Group $group) { |
|
| 1025 | 970 | $viewers = $this->Viewers(); |
| 1026 | 971 | if (!$viewers->find('ID', $group->ID)) { |
| 1027 | 972 | return false; |
@@ -1041,8 +986,7 @@ discard block |
||
| 1041 | 986 | * |
| 1042 | 987 | * @return bool |
| 1043 | 988 | */ |
| 1044 | - public function allowedAny($codes, $member = null) |
|
| 1045 | - { |
|
| 989 | + public function allowedAny($codes, $member = null) { |
|
| 1046 | 990 | if (!$member) { |
| 1047 | 991 | $member = Member::currentUser(); |
| 1048 | 992 | } |
@@ -1060,8 +1004,7 @@ discard block |
||
| 1060 | 1004 | * |
| 1061 | 1005 | * @return bool |
| 1062 | 1006 | */ |
| 1063 | - public function isProjectReady() |
|
| 1064 | - { |
|
| 1007 | + public function isProjectReady() { |
|
| 1065 | 1008 | if ($this->getRunningInitialEnvironmentCreations()->count() > 0) { |
| 1066 | 1009 | // We're still creating the initial environments for this project so we're |
| 1067 | 1010 | // not quite done |
@@ -1090,8 +1033,7 @@ discard block |
||
| 1090 | 1033 | * |
| 1091 | 1034 | * @return SS_List |
| 1092 | 1035 | */ |
| 1093 | - public function getRunningEnvironmentCreations() |
|
| 1094 | - { |
|
| 1036 | + public function getRunningEnvironmentCreations() { |
|
| 1095 | 1037 | return $this->CreateEnvironments() |
| 1096 | 1038 | ->filter('Status', ['Queued', 'Started']); |
| 1097 | 1039 | } |
@@ -1101,8 +1043,7 @@ discard block |
||
| 1101 | 1043 | * |
| 1102 | 1044 | * @return DataList |
| 1103 | 1045 | */ |
| 1104 | - public function getInitialEnvironmentCreations() |
|
| 1105 | - { |
|
| 1046 | + public function getInitialEnvironmentCreations() { |
|
| 1106 | 1047 | return $this->CreateEnvironments()->filter('IsInitialEnvironment', true); |
| 1107 | 1048 | } |
| 1108 | 1049 | |
@@ -1111,8 +1052,7 @@ discard block |
||
| 1111 | 1052 | * |
| 1112 | 1053 | * @return DataList |
| 1113 | 1054 | */ |
| 1114 | - public function getRunningInitialEnvironmentCreations() |
|
| 1115 | - { |
|
| 1055 | + public function getRunningInitialEnvironmentCreations() { |
|
| 1116 | 1056 | return $this->getInitialEnvironmentCreations() |
| 1117 | 1057 | ->filter('Status', ['Queued', 'Started']); |
| 1118 | 1058 | } |
@@ -1122,8 +1062,7 @@ discard block |
||
| 1122 | 1062 | * |
| 1123 | 1063 | * @return DataList |
| 1124 | 1064 | */ |
| 1125 | - public function getCompleteInitialEnvironmentCreations() |
|
| 1126 | - { |
|
| 1065 | + public function getCompleteInitialEnvironmentCreations() { |
|
| 1127 | 1066 | return $this->getInitialEnvironmentCreations() |
| 1128 | 1067 | ->exclude('Status', ['Queued', 'Started']); |
| 1129 | 1068 | } |
@@ -1131,8 +1070,7 @@ discard block |
||
| 1131 | 1070 | /** |
| 1132 | 1071 | * @return ValidationResult |
| 1133 | 1072 | */ |
| 1134 | - protected function validate() |
|
| 1135 | - { |
|
| 1073 | + protected function validate() { |
|
| 1136 | 1074 | $validation = parent::validate(); |
| 1137 | 1075 | if ($validation->valid()) { |
| 1138 | 1076 | if (empty($this->Name)) { |
@@ -1164,8 +1102,7 @@ discard block |
||
| 1164 | 1102 | * |
| 1165 | 1103 | * @return bool |
| 1166 | 1104 | */ |
| 1167 | - public function canCreate($member = null) |
|
| 1168 | - { |
|
| 1105 | + public function canCreate($member = null) { |
|
| 1169 | 1106 | if (!$member) { |
| 1170 | 1107 | $member = Member::currentUser(); |
| 1171 | 1108 | } |
@@ -6,13 +6,11 @@ |
||
| 6 | 6 | * Class to represent queued commits |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class DNQueuedCommits extends DNFilteredCommits |
|
| 10 | -{ |
|
| 9 | +class DNQueuedCommits extends DNFilteredCommits { |
|
| 11 | 10 | |
| 12 | 11 | private $description = 'Commits that are currently queued'; |
| 13 | 12 | |
| 14 | - public function __construct() |
|
| 15 | - { |
|
| 13 | + public function __construct() { |
|
| 16 | 14 | parent::__construct(); |
| 17 | 15 | $this->setFilter('Queued'); |
| 18 | 16 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DNReference extends ViewableData |
|
| 4 | -{ |
|
| 3 | +class DNReference extends ViewableData { |
|
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * @var Gitonomy\Git\Reference |
@@ -14,23 +13,19 @@ discard block |
||
| 14 | 13 | 'Filename' => 'Text' |
| 15 | 14 | ); |
| 16 | 15 | |
| 17 | - public function __construct(Gitonomy\Git\Reference $reference) |
|
| 18 | - { |
|
| 16 | + public function __construct(Gitonomy\Git\Reference $reference) { |
|
| 19 | 17 | $this->reference = $reference; |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | - public function Name() |
|
| 23 | - { |
|
| 20 | + public function Name() { |
|
| 24 | 21 | return $this->reference->getName(); |
| 25 | 22 | } |
| 26 | 23 | |
| 27 | - public function FullName() |
|
| 28 | - { |
|
| 24 | + public function FullName() { |
|
| 29 | 25 | return $this->reference->getCommitHash(); |
| 30 | 26 | } |
| 31 | 27 | |
| 32 | - public function Filename() |
|
| 33 | - { |
|
| 28 | + public function Filename() { |
|
| 34 | 29 | return $this->reference->getFullname(); |
| 35 | 30 | } |
| 36 | 31 | } |
@@ -2,8 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Gitonomy\Git\Reference; |
| 4 | 4 | |
| 5 | -class DNReferenceList extends ArrayList |
|
| 6 | -{ |
|
| 5 | +class DNReferenceList extends ArrayList { |
|
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | 8 | * @var string |
@@ -53,16 +52,14 @@ discard block |
||
| 53 | 52 | /** |
| 54 | 53 | * @param $refsDir |
| 55 | 54 | */ |
| 56 | - public static function set_refs_dir($refsDir) |
|
| 57 | - { |
|
| 55 | + public static function set_refs_dir($refsDir) { |
|
| 58 | 56 | self::$refs_dir = $refsDir; |
| 59 | 57 | } |
| 60 | 58 | |
| 61 | 59 | /** |
| 62 | 60 | * @return string |
| 63 | 61 | */ |
| 64 | - public static function get_refs_dir() |
|
| 65 | - { |
|
| 62 | + public static function get_refs_dir() { |
|
| 66 | 63 | return self::$refs_dir; |
| 67 | 64 | } |
| 68 | 65 | |
@@ -92,8 +89,7 @@ discard block |
||
| 92 | 89 | * @param int $limit |
| 93 | 90 | * @return DNReferenceList |
| 94 | 91 | */ |
| 95 | - public function setLimit($limit) |
|
| 96 | - { |
|
| 92 | + public function setLimit($limit) { |
|
| 97 | 93 | $this->limit = $limit; |
| 98 | 94 | return $this; |
| 99 | 95 | } |
@@ -101,8 +97,7 @@ discard block |
||
| 101 | 97 | /** |
| 102 | 98 | * @return array |
| 103 | 99 | */ |
| 104 | - protected function getReferences() |
|
| 105 | - { |
|
| 100 | + protected function getReferences() { |
|
| 106 | 101 | try { |
| 107 | 102 | $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath()); |
| 108 | 103 | } catch (Exception $e) { |
@@ -160,8 +155,7 @@ discard block |
||
| 160 | 155 | * @param string $hash |
| 161 | 156 | * @return DNCommit |
| 162 | 157 | */ |
| 163 | - public function byName($hash) |
|
| 164 | - { |
|
| 158 | + public function byName($hash) { |
|
| 165 | 159 | if ($this->loaded === false) { |
| 166 | 160 | $this->items = $this->getReferences(); |
| 167 | 161 | $this->loaded = true; |
@@ -186,8 +180,7 @@ discard block |
||
| 186 | 180 | return $found; |
| 187 | 181 | } |
| 188 | 182 | |
| 189 | - public function Count() |
|
| 190 | - { |
|
| 183 | + public function Count() { |
|
| 191 | 184 | $this->getIterator(); |
| 192 | 185 | return parent::Count(); |
| 193 | 186 | } |
@@ -198,8 +191,7 @@ discard block |
||
| 198 | 191 | * |
| 199 | 192 | * @return ArrayIterator |
| 200 | 193 | */ |
| 201 | - public function getIterator() |
|
| 202 | - { |
|
| 194 | + public function getIterator() { |
|
| 203 | 195 | if ($this->loaded === false) { |
| 204 | 196 | $this->items = $this->getReferences(); |
| 205 | 197 | $this->loaded = true; |