@@ -9,7 +9,7 @@ |
||
| 9 | 9 | $items = CompositeField::FieldList()->toArray(); |
| 10 | 10 | $fields = new ArrayList(); |
| 11 | 11 | |
| 12 | - foreach($items as $item) { |
|
| 12 | + foreach ($items as $item) { |
|
| 13 | 13 | $extra = array( |
| 14 | 14 | 'Selected' => $this->value == $item->getValue(), |
| 15 | 15 | ); |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | * @return bool|DataArchiveFileField |
| 16 | 16 | */ |
| 17 | 17 | public function saveInto(DataObjectInterface $record) { |
| 18 | - if(!isset($_FILES[$this->name])) { |
|
| 18 | + if (!isset($_FILES[$this->name])) { |
|
| 19 | 19 | return false; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if(!($record instanceof DNDataArchive)) { |
|
| 22 | + if (!($record instanceof DNDataArchive)) { |
|
| 23 | 23 | throw new LogicException('Saving into wrong type, expected DNDataArchive'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | /** @var DNDataTransfer $dataTransfer */ |
| 29 | 29 | $dataTransfer = $dataArchive->DataTransfers()->First(); |
| 30 | - if(!$dataTransfer) { |
|
| 30 | + if (!$dataTransfer) { |
|
| 31 | 31 | throw new LogicException('No transfer found'); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | // Hack: loadIntoFile assumes paths relative to assets, |
| 37 | 37 | // otherwise it creates the whole structure *within* that folder |
| 38 | 38 | $absolutePath = $dataArchive->generateFilepath($dataTransfer); |
| 39 | - $relativePath = preg_replace('#^' . preg_quote(ASSETS_PATH) . '/#', '', $absolutePath); |
|
| 39 | + $relativePath = preg_replace('#^'.preg_quote(ASSETS_PATH).'/#', '', $absolutePath); |
|
| 40 | 40 | $this->upload->loadIntoFile($_FILES[$this->name], $file, $relativePath); |
| 41 | - if($this->upload->isError()) { |
|
| 41 | + if ($this->upload->isError()) { |
|
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $file = $this->upload->getFile(); |
| 46 | - if($this->relationAutoSetting) { |
|
| 46 | + if ($this->relationAutoSetting) { |
|
| 47 | 47 | // save to record |
| 48 | - $record->{$this->name . 'ID'} = $file->ID; |
|
| 48 | + $record->{$this->name.'ID'} = $file->ID; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $this; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | // the 'ping' action is called via AJAX from the /admin and will cause |
| 7 | 7 | // the admin section to 'grow' over time. We only need the css and js |
| 8 | 8 | // for login, reset, logout and so on. |
| 9 | - if(!$this->owner->getRequest()->isAjax()) { |
|
| 9 | + if (!$this->owner->getRequest()->isAjax()) { |
|
| 10 | 10 | DNRoot::include_requirements(); |
| 11 | 11 | } |
| 12 | 12 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $file = $this->owner; |
| 12 | 12 | $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First(); |
| 13 | 13 | |
| 14 | - if($archive) { |
|
| 14 | + if ($archive) { |
|
| 15 | 15 | return $archive->canDownload($member); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | protected function getQueues() { |
| 54 | 54 | $queues = Resque::queues(); |
| 55 | 55 | $queueList = new ArrayList(); |
| 56 | - foreach($queues as $idx => $queue) { |
|
| 56 | + foreach ($queues as $idx => $queue) { |
|
| 57 | 57 | $queueList->push(new ResqueQueue(array( |
| 58 | 58 | 'ID' => ($idx + 1), |
| 59 | 59 | 'Name' => $queue, |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | * @return mixed |
| 61 | 61 | */ |
| 62 | 62 | public function __get($property) { |
| 63 | - if(isset($this->record[$property])) { |
|
| 63 | + if (isset($this->record[$property])) { |
|
| 64 | 64 | return $this->record[$property]; |
| 65 | 65 | } |
| 66 | 66 | return null; |
@@ -49,20 +49,20 @@ discard block |
||
| 49 | 49 | protected function getJobs() { |
| 50 | 50 | $jobs = new ArrayList(); |
| 51 | 51 | |
| 52 | - $resqueJobs = Resque::redis()->lrange('queue:' . $this->Name, 0, -1); |
|
| 53 | - if(!$resqueJobs) { |
|
| 52 | + $resqueJobs = Resque::redis()->lrange('queue:'.$this->Name, 0, -1); |
|
| 53 | + if (!$resqueJobs) { |
|
| 54 | 54 | $jobs->push(new ResqueJob(array( |
| 55 | 55 | 'Name' => 'null', |
| 56 | 56 | 'Value' => 'null', |
| 57 | 57 | ))); |
| 58 | 58 | return $jobs; |
| 59 | 59 | } |
| 60 | - foreach($resqueJobs as $idx => $job) { |
|
| 60 | + foreach ($resqueJobs as $idx => $job) { |
|
| 61 | 61 | $stdClass = json_decode($job); |
| 62 | - if($stdClass->class === 'CapistranoDeploy' || $stdClass->class === 'DeployJob') { |
|
| 62 | + if ($stdClass->class === 'CapistranoDeploy' || $stdClass->class === 'DeployJob') { |
|
| 63 | 63 | $value = $stdClass->args[0]->projectName |
| 64 | - . ':' . $stdClass->args[0]->environment |
|
| 65 | - . ' - ' . $stdClass->args[0]->sha; |
|
| 64 | + . ':'.$stdClass->args[0]->environment |
|
| 65 | + . ' - '.$stdClass->args[0]->sha; |
|
| 66 | 66 | $jobs->push(new ResqueJob(array( |
| 67 | 67 | 'Name' => $stdClass->class, |
| 68 | 68 | 'Value' => $value, |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return mixed |
| 112 | 112 | */ |
| 113 | 113 | public function __get($property) { |
| 114 | - if(isset($this->record[$property])) { |
|
| 114 | + if (isset($this->record[$property])) { |
|
| 115 | 115 | return $this->record[$property]; |
| 116 | 116 | } |
| 117 | 117 | return null; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | class AbortableProcess extends \Symfony\Component\Process\Process { |
| 16 | 16 | public function run($callback = null) { |
| 17 | 17 | $this->start($callback); |
| 18 | - while($this->isRunning()) { |
|
| 18 | + while ($this->isRunning()) { |
|
| 19 | 19 | $this->checkTimeout(); |
| 20 | 20 | sleep(1); |
| 21 | 21 | } |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | public function alarmHandler() { |
| 19 | 19 | $sigFile = $this->args['sigFile']; |
| 20 | 20 | if (file_exists($sigFile) && is_readable($sigFile) && is_writable($sigFile)) { |
| 21 | - $signal = (int)file_get_contents($sigFile); |
|
| 22 | - if (is_int($signal) && in_array((int)$signal, [ |
|
| 21 | + $signal = (int) file_get_contents($sigFile); |
|
| 22 | + if (is_int($signal) && in_array((int) $signal, [ |
|
| 23 | 23 | // The following signals are trapped by both Resque and Rainforest. |
| 24 | 24 | SIGTERM, |
| 25 | 25 | SIGINT, |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | SIGCONT |
| 31 | 31 | ])) { |
| 32 | 32 | echo sprintf( |
| 33 | - '[-] Signal "%s" received, delivering to own process group, PID "%s".' . PHP_EOL, |
|
| 33 | + '[-] Signal "%s" received, delivering to own process group, PID "%s".'.PHP_EOL, |
|
| 34 | 34 | $signal, |
| 35 | 35 | getmypid() |
| 36 | 36 | ); |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | // Dispatch to own process group. |
| 42 | 42 | $pgid = posix_getpgid(getmypid()); |
| 43 | - if ($pgid<=0) { |
|
| 43 | + if ($pgid <= 0) { |
|
| 44 | 44 | echo sprintf( |
| 45 | - '[-] Unable to send signal to invalid PGID "%s".' . PHP_EOL, |
|
| 45 | + '[-] Unable to send signal to invalid PGID "%s".'.PHP_EOL, |
|
| 46 | 46 | $pgid |
| 47 | 47 | ); |
| 48 | 48 | } else { |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | // to this job as a whole (including any subprocesses such as spawned by Symfony). |
| 61 | 61 | posix_setsid(); |
| 62 | 62 | |
| 63 | - if(function_exists('pcntl_alarm') && function_exists('pcntl_signal')) { |
|
| 63 | + if (function_exists('pcntl_alarm') && function_exists('pcntl_signal')) { |
|
| 64 | 64 | if (!empty($this->args['sigFile'])) { |
| 65 | - echo sprintf('[-] Signal file requested, polling "%s".' . PHP_EOL, $this->args['sigFile']); |
|
| 65 | + echo sprintf('[-] Signal file requested, polling "%s".'.PHP_EOL, $this->args['sigFile']); |
|
| 66 | 66 | declare(ticks = 1); |
| 67 | 67 | pcntl_signal(SIGALRM, [$this, 'alarmHandler']); |
| 68 | 68 | pcntl_alarm(1); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function perform() { |
| 77 | - echo "[-] DeployJob starting" . PHP_EOL; |
|
| 77 | + echo "[-] DeployJob starting".PHP_EOL; |
|
| 78 | 78 | $log = new DeploynautLogFile($this->args['logfile']); |
| 79 | 79 | |
| 80 | 80 | $deployment = DNDeployment::get()->byID($this->args['deploymentID']); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // deploy onto a clean environment will not be performing any backup regardless of |
| 93 | 93 | // whether the predeploy_backup option was passed or not. |
| 94 | 94 | // Sometimes predeploy_backup comes through as string false from the frontend. |
| 95 | - if( |
|
| 95 | + if ( |
|
| 96 | 96 | !empty($this->args['predeploy_backup']) |
| 97 | 97 | && $this->args['predeploy_backup'] !== 'false' |
| 98 | 98 | && !empty($currentBuild) |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // Disallow concurrent deployments (don't rely on queuing implementation to restrict this) |
| 115 | 115 | // Only consider deployments started in the last 30 minutes (older jobs probably got stuck) |
| 116 | 116 | $runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']); |
| 117 | - if($runningDeployments->count()) { |
|
| 117 | + if ($runningDeployments->count()) { |
|
| 118 | 118 | $runningDeployment = $runningDeployments->first(); |
| 119 | 119 | $message = sprintf( |
| 120 | 120 | 'Error: another deployment is in progress (started at %s by %s)', |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | // all options from the DeploymentStrategy merged in, including sha. |
| 135 | 135 | $this->args |
| 136 | 136 | ); |
| 137 | - } catch(Exception $e) { |
|
| 137 | + } catch (Exception $e) { |
|
| 138 | 138 | // DeploynautJob will automatically trigger onFailure. |
| 139 | - echo "[-] DeployJob failed" . PHP_EOL; |
|
| 139 | + echo "[-] DeployJob failed".PHP_EOL; |
|
| 140 | 140 | throw $e; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $this->updateStatus(DNDeployment::TR_COMPLETE); |
| 144 | - echo "[-] DeployJob finished" . PHP_EOL; |
|
| 144 | + echo "[-] DeployJob finished".PHP_EOL; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function onFailure(Exception $exception) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | DB::connect($databaseConfig); |
| 161 | 161 | $backupDataTransfer->Status = 'Finished'; |
| 162 | 162 | $backupDataTransfer->write(); |
| 163 | - } catch(Exception $e) { |
|
| 163 | + } catch (Exception $e) { |
|
| 164 | 164 | global $databaseConfig; |
| 165 | 165 | DB::connect($databaseConfig); |
| 166 | 166 | $backupDataTransfer->Status = 'Failed'; |