@@ -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'; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return string |
| 46 | 46 | */ |
| 47 | 47 | public function getRawFilePath() { |
| 48 | - return $this->basePath . '/' . $this->logFile; |
|
| 48 | + return $this->basePath.'/'.$this->logFile; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | 55 | public function getSanitisedLogFilePath() { |
| 56 | - return $this->basePath . '/' . strtolower(FileNameFilter::create()->filter($this->logFile)); |
|
| 56 | + return $this->basePath.'/'.strtolower(FileNameFilter::create()->filter($this->logFile)); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Make sure we write into the old path for existing logs. New logs use the sanitised file path instead. |
| 84 | 84 | $path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath(); |
| 85 | 85 | |
| 86 | - error_log('[' . date('Y-m-d H:i:s') . '] ' . $message . PHP_EOL, 3, $path); |
|
| 86 | + error_log('['.date('Y-m-d H:i:s').'] '.$message.PHP_EOL, 3, $path); |
|
| 87 | 87 | @chmod($path, 0666); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -9,19 +9,19 @@ discard block |
||
| 9 | 9 | $remove = true; |
| 10 | 10 | $dryRun = true; |
| 11 | 11 | |
| 12 | - if($request && $request->requestVar('remove') !== null) { |
|
| 13 | - $remove = (bool)$request->requestVar('remove'); |
|
| 12 | + if ($request && $request->requestVar('remove') !== null) { |
|
| 13 | + $remove = (bool) $request->requestVar('remove'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - if($request && $request->requestVar('dryrun') !== null) { |
|
| 17 | - $dryRun = (bool)$request->requestVar('dryrun'); |
|
| 16 | + if ($request && $request->requestVar('dryrun') !== null) { |
|
| 17 | + $dryRun = (bool) $request->requestVar('dryrun'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if($dryRun) { |
|
| 20 | + if ($dryRun) { |
|
| 21 | 21 | echo "Running in dry run mode, no changes commited, "; |
| 22 | - echo "the output shows a prediction on what will happen." . PHP_EOL; |
|
| 23 | - echo "To skip dryrun, run the task like this:" . PHP_EOL; |
|
| 24 | - echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0" . PHP_EOL . PHP_EOL; |
|
| 22 | + echo "the output shows a prediction on what will happen.".PHP_EOL; |
|
| 23 | + echo "To skip dryrun, run the task like this:".PHP_EOL; |
|
| 24 | + echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0".PHP_EOL.PHP_EOL; |
|
| 25 | 25 | sleep(3); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Sync projects |
| 32 | 32 | $projects = DNProject::get(); |
| 33 | - if($remove) { |
|
| 33 | + if ($remove) { |
|
| 34 | 34 | $this->echoHeader('Removing obsolete projects'); |
| 35 | 35 | $this->removeObsoleteProjects($projectPaths, $dryRun); |
| 36 | 36 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->syncProjectPaths($projectPaths, $dryRun); |
| 39 | 39 | |
| 40 | 40 | $this->echoHeader('Syncing environment files'); |
| 41 | - foreach($projects as $project) { |
|
| 41 | + foreach ($projects as $project) { |
|
| 42 | 42 | $this->echoHeader($project->Name); |
| 43 | 43 | // Sync environments for each project |
| 44 | 44 | $environmentPaths = $data->getEnvironmentPaths($project->Name); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | }, $paths); |
| 63 | 63 | |
| 64 | 64 | $removeList = $list->filter('Filename:not', $basePaths); |
| 65 | - if($removeList->count() === 0) { |
|
| 65 | + if ($removeList->count() === 0) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - foreach($removeList as $remove) { |
|
| 70 | - $this->message('Removing "' . basename($remove->Name) . '" from db'); |
|
| 71 | - if(!$dryRun) { |
|
| 69 | + foreach ($removeList as $remove) { |
|
| 70 | + $this->message('Removing "'.basename($remove->Name).'" from db'); |
|
| 71 | + if (!$dryRun) { |
|
| 72 | 72 | $removeList->remove($remove); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | protected function removeObsoleteProjects($paths, $dryrun = false) { |
| 85 | 85 | $removeList = DNProject::get()->filter('Name:not', $paths); |
| 86 | - if($removeList->count() == 0) { |
|
| 86 | + if ($removeList->count() == 0) { |
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - foreach($removeList as $remove) { |
|
| 91 | - $this->message($remove->Name . ' ' . $remove->Path); |
|
| 92 | - if(!$dryrun) { |
|
| 90 | + foreach ($removeList as $remove) { |
|
| 91 | + $this->message($remove->Name.' '.$remove->Path); |
|
| 92 | + if (!$dryrun) { |
|
| 93 | 93 | $removeList->remove($remove); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -106,22 +106,22 @@ discard block |
||
| 106 | 106 | $list = $project->Environments(); |
| 107 | 107 | |
| 108 | 108 | // Normalise paths in DB |
| 109 | - foreach($list as $item) { |
|
| 109 | + foreach ($list as $item) { |
|
| 110 | 110 | $real = realpath($item->Filename); |
| 111 | - if($real && $real != $item->Filename) { |
|
| 111 | + if ($real && $real != $item->Filename) { |
|
| 112 | 112 | $item->Filename = $real; |
| 113 | 113 | $item->write(); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - foreach($paths as $path) { |
|
| 117 | + foreach ($paths as $path) { |
|
| 118 | 118 | $path = basename($path); |
| 119 | - if($list->filter('Filename', $path)->count()) { |
|
| 119 | + if ($list->filter('Filename', $path)->count()) { |
|
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $this->message('Adding "' . basename($path) . '" to db'); |
|
| 124 | - if(!$dryRun) { |
|
| 123 | + $this->message('Adding "'.basename($path).'" to db'); |
|
| 124 | + if (!$dryRun) { |
|
| 125 | 125 | $environment = DNEnvironment::create_from_path($path); |
| 126 | 126 | $environment->ProjectID = $project->ID; |
| 127 | 127 | $environment->write(); |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | * @param boolean $dryRun |
| 137 | 137 | */ |
| 138 | 138 | public function syncProjectPaths($paths, $dryRun = false) { |
| 139 | - foreach($paths as $path) { |
|
| 140 | - if(!DNProject::get()->filter('Name', $path)->count()) { |
|
| 139 | + foreach ($paths as $path) { |
|
| 140 | + if (!DNProject::get()->filter('Name', $path)->count()) { |
|
| 141 | 141 | $this->message($path); |
| 142 | - if(!$dryRun) { |
|
| 142 | + if (!$dryRun) { |
|
| 143 | 143 | DNProject::create_from_path($path)->write(); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -150,20 +150,20 @@ discard block |
||
| 150 | 150 | * @param string $text |
| 151 | 151 | */ |
| 152 | 152 | protected function message($text) { |
| 153 | - if(PHP_SAPI !== 'cli') { |
|
| 154 | - $text = '<p>' . $text . '</p>' . PHP_EOL; |
|
| 153 | + if (PHP_SAPI !== 'cli') { |
|
| 154 | + $text = '<p>'.$text.'</p>'.PHP_EOL; |
|
| 155 | 155 | } |
| 156 | - echo ' - ' . $text . PHP_EOL; |
|
| 156 | + echo ' - '.$text.PHP_EOL; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * @param string $text |
| 161 | 161 | */ |
| 162 | 162 | protected function echoHeader($text) { |
| 163 | - if(PHP_SAPI !== 'cli') { |
|
| 164 | - echo '<h2>' . $text . '</h2>' . PHP_EOL; |
|
| 163 | + if (PHP_SAPI !== 'cli') { |
|
| 164 | + echo '<h2>'.$text.'</h2>'.PHP_EOL; |
|
| 165 | 165 | } else { |
| 166 | - echo '# ' . $text . PHP_EOL; |
|
| 166 | + echo '# '.$text.PHP_EOL; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | 52 | public function Name() { |
| 53 | - return (string)htmlentities($this->branch->getName()); |
|
| 53 | + return (string) htmlentities($this->branch->getName()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function Link() { |
| 57 | 57 | // Use a get-var for branch so that it can handle unsafe chars better |
| 58 | - return Controller::join_links($this->project->Link(), 'branch?name=' . urlencode($this->Name())); |
|
| 58 | + return Controller::join_links($this->project->Link(), 'branch?name='.urlencode($this->Name())); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
| 64 | 64 | public function SHA() { |
| 65 | - return (string)htmlentities($this->branch->getCommit()->getHash()); |
|
| 65 | + return (string) htmlentities($this->branch->getCommit()->getHash()); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function LastUpdated() { |
| 80 | 80 | |
| 81 | - if($this->_lastUpdatedCache) { |
|
| 81 | + if ($this->_lastUpdatedCache) { |
|
| 82 | 82 | return $this->_lastUpdatedCache; |
| 83 | 83 | } |
| 84 | 84 | try { |
| 85 | 85 | $created = $this->branch->getCommit()->getCommitterDate(); |
| 86 | - } catch(Exception $e) { |
|
| 86 | + } catch (Exception $e) { |
|
| 87 | 87 | //occasionally parsing will fail this is a fallback to make it still work |
| 88 | 88 | return new SS_Datetime(); |
| 89 | 89 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return string |
| 104 | 104 | */ |
| 105 | 105 | public function IsOpenByDefault() { |
| 106 | - if($this->Name() == 'master') { |
|
| 106 | + if ($this->Name() == 'master') { |
|
| 107 | 107 | return " open"; |
| 108 | 108 | } else { |
| 109 | 109 | return ""; |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | $output['status_code'] = $statusCode; |
| 145 | 145 | $response = $this->getResponse(); |
| 146 | 146 | $response->addHeader('Content-Type', 'application/json'); |
| 147 | - $response->setBody(json_encode($output, JSON_PRETTY_PRINT|JSON_NUMERIC_CHECK)); |
|
| 147 | + $response->setBody(json_encode($output, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK)); |
|
| 148 | 148 | $response->setStatusCode($statusCode); |
| 149 | 149 | return $response; |
| 150 | 150 | } |
@@ -66,11 +66,11 @@ |
||
| 66 | 66 | public function getModel($name = '') { |
| 67 | 67 | $base = Director::absoluteBaseURL(); |
| 68 | 68 | return [ |
| 69 | - 'basename' => Director::baseURL() . $this->getCurrentEnvironment()->Link('overview'), |
|
| 69 | + 'basename' => Director::baseURL().$this->getCurrentEnvironment()->Link('overview'), |
|
| 70 | 70 | 'dispatchers' => [ |
| 71 | - 'git' => $base . $this->getCurrentProject()->Link('git'), |
|
| 72 | - 'plan' => $base . $this->getCurrentEnvironment()->Link('plan'), |
|
| 73 | - 'deploys' => $base . $this->getCurrentEnvironment()->Link('deploys') |
|
| 71 | + 'git' => $base.$this->getCurrentProject()->Link('git'), |
|
| 72 | + 'plan' => $base.$this->getCurrentEnvironment()->Link('plan'), |
|
| 73 | + 'deploys' => $base.$this->getCurrentEnvironment()->Link('deploys') |
|
| 74 | 74 | ], |
| 75 | 75 | 'api_auth' => [ |
| 76 | 76 | 'name' => $this->getSecurityToken()->getName(), |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $cache = self::get_git_cache(); |
| 161 | 161 | // we only need to clear the tag cache since everything else is cached by SHA, that is for commit and |
| 162 | 162 | // commit message. |
| 163 | - $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 163 | + $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | return true; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 334 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 335 | 335 | return $env->canRestore($member); |
| 336 | 336 | })->Count(); |
| 337 | 337 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return true; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 355 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 356 | 356 | return $env->canBackup($member); |
| 357 | 357 | })->Count(); |
| 358 | 358 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | return true; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 376 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 377 | 377 | return $env->canUploadArchive($member); |
| 378 | 378 | })->Count(); |
| 379 | 379 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | return true; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 397 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 398 | 398 | return $env->canDownloadArchive($member); |
| 399 | 399 | })->Count(); |
| 400 | 400 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | // Key-pair is available, use it. |
| 454 | 454 | $processEnv = [ |
| 455 | 455 | 'IDENT_KEY' => $this->getPrivateKeyPath(), |
| 456 | - 'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh" |
|
| 456 | + 'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh" |
|
| 457 | 457 | ]; |
| 458 | 458 | } else { |
| 459 | 459 | $processEnv = []; |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $currentMember = self::$_current_member_cache; |
| 543 | 543 | return $this->Environments() |
| 544 | - ->filterByCallBack(function ($item) use ($currentMember) { |
|
| 544 | + ->filterByCallBack(function($item) use ($currentMember) { |
|
| 545 | 545 | return $item->canView($currentMember); |
| 546 | 546 | }); |
| 547 | 547 | } |
@@ -560,14 +560,14 @@ discard block |
||
| 560 | 560 | * @return false|DNDeployment |
| 561 | 561 | */ |
| 562 | 562 | public function currentBuilds() { |
| 563 | - if (!isset(self::$relation_cache['currentBuilds.' . $this->ID])) { |
|
| 563 | + if (!isset(self::$relation_cache['currentBuilds.'.$this->ID])) { |
|
| 564 | 564 | $currentBuilds = []; |
| 565 | 565 | foreach ($this->Environments() as $env) { |
| 566 | 566 | $currentBuilds[$env->Name] = $env->CurrentBuild(); |
| 567 | 567 | } |
| 568 | - self::$relation_cache['currentBuilds.' . $this->ID] = $currentBuilds; |
|
| 568 | + self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds; |
|
| 569 | 569 | } |
| 570 | - return self::$relation_cache['currentBuilds.' . $this->ID]; |
|
| 570 | + return self::$relation_cache['currentBuilds.'.$this->ID]; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | public function getPublicKeyPath() { |
| 810 | 810 | if ($privateKey = $this->getPrivateKeyPath()) { |
| 811 | - return $privateKey . '.pub'; |
|
| 811 | + return $privateKey.'.pub'; |
|
| 812 | 812 | } |
| 813 | 813 | return null; |
| 814 | 814 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | if (!empty($keyDir)) { |
| 824 | 824 | $filter = FileNameFilter::create(); |
| 825 | 825 | $name = $filter->filter($this->Name); |
| 826 | - return $keyDir . '/' . $name; |
|
| 826 | + return $keyDir.'/'.$name; |
|
| 827 | 827 | } |
| 828 | 828 | return null; |
| 829 | 829 | } |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $filter = FileNameFilter::create(); |
| 843 | 843 | $name = $filter->filter($this->Name); |
| 844 | 844 | |
| 845 | - return $this->DNData()->getKeyDir() . '/' . $name; |
|
| 845 | + return $this->DNData()->getKeyDir().'/'.$name; |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | /** |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | /* Look for each whitelisted hostname */ |
| 869 | 869 | foreach ($interfaces as $host => $interface) { |
| 870 | 870 | /* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */ |
| 871 | - if (preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 871 | + if (preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 872 | 872 | |
| 873 | 873 | $path = $match[2]; |
| 874 | 874 | |
@@ -879,10 +879,10 @@ discard block |
||
| 879 | 879 | $components = explode('.', $host); |
| 880 | 880 | |
| 881 | 881 | foreach ($regex as $pattern => $replacement) { |
| 882 | - $path = preg_replace('/' . $pattern . '/', $replacement, $path); |
|
| 882 | + $path = preg_replace('/'.$pattern.'/', $replacement, $path); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - $uxurl = Controller::join_links($scheme . '://', $host, $path); |
|
| 885 | + $uxurl = Controller::join_links($scheme.'://', $host, $path); |
|
| 886 | 886 | |
| 887 | 887 | if (array_key_exists('commit', $interface) && $interface['commit'] == false) { |
| 888 | 888 | $commiturl = false; |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | // {@see DataObject::extendedCan()} |
| 1010 | 1010 | $isDone = $this->extend('isProjectReady'); |
| 1011 | 1011 | if ($isDone && is_array($isDone)) { |
| 1012 | - $isDone = array_filter($isDone, function ($val) { |
|
| 1012 | + $isDone = array_filter($isDone, function($val) { |
|
| 1013 | 1013 | return !is_null($val); |
| 1014 | 1014 | }); |
| 1015 | 1015 | |
@@ -1094,11 +1094,11 @@ discard block |
||
| 1094 | 1094 | return false; |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - $cachekey = $this->ID . '_commit_' . $sha; |
|
| 1097 | + $cachekey = $this->ID.'_commit_'.$sha; |
|
| 1098 | 1098 | $cache = self::get_git_cache(); |
| 1099 | 1099 | if (!($result = $cache->load($cachekey))) { |
| 1100 | 1100 | $result = $repo->getCommit($sha); |
| 1101 | - $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_' . $this->ID]); |
|
| 1101 | + $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_'.$this->ID]); |
|
| 1102 | 1102 | } |
| 1103 | 1103 | return $result; |
| 1104 | 1104 | } |
@@ -1108,11 +1108,11 @@ discard block |
||
| 1108 | 1108 | * @return string |
| 1109 | 1109 | */ |
| 1110 | 1110 | public function getCommitMessage(\Gitonomy\Git\Commit $commit) { |
| 1111 | - $cachekey = $this->ID . '_message_' . $commit->getRevision(); |
|
| 1111 | + $cachekey = $this->ID.'_message_'.$commit->getRevision(); |
|
| 1112 | 1112 | $cache = self::get_git_cache(); |
| 1113 | 1113 | if (!($result = $cache->load($cachekey))) { |
| 1114 | 1114 | $result = $commit->getMessage(); |
| 1115 | - $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_' . $this->ID]); |
|
| 1115 | + $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_'.$this->ID]); |
|
| 1116 | 1116 | } |
| 1117 | 1117 | return $result; |
| 1118 | 1118 | } |
@@ -1122,14 +1122,14 @@ discard block |
||
| 1122 | 1122 | * @return mixed |
| 1123 | 1123 | */ |
| 1124 | 1124 | public function getCommitTags(\Gitonomy\Git\Commit $commit) { |
| 1125 | - $cachekey = $this->ID . '_tags_' . $commit->getRevision(); |
|
| 1125 | + $cachekey = $this->ID.'_tags_'.$commit->getRevision(); |
|
| 1126 | 1126 | $cache = self::get_git_cache(); |
| 1127 | 1127 | $result = $cache->load($cachekey); |
| 1128 | 1128 | // we check against false, because in many cases the tag list is an empty array |
| 1129 | 1129 | if ($result === false) { |
| 1130 | 1130 | $repo = $this->getRepository(); |
| 1131 | 1131 | $result = $tags = $repo->getReferences()->resolveTags($commit->getRevision()); |
| 1132 | - $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 1132 | + $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 1133 | 1133 | } |
| 1134 | 1134 | return $result; |
| 1135 | 1135 | } |