@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | printf( |
| 26 | 26 | "%s Checking status of %d pipelines... ", |
| 27 | - "[" . date("Y-m-d H:i:s") . "]", |
|
| 27 | + "[".date("Y-m-d H:i:s")."]", |
|
| 28 | 28 | $runningPipelines->count() |
| 29 | 29 | ); |
| 30 | 30 | |
@@ -32,6 +32,6 @@ discard block |
||
| 32 | 32 | $pipeline->checkPipelineStatus(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - echo "done!" . PHP_EOL; |
|
| 35 | + echo "done!".PHP_EOL; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | if(!preg_match('/^[a-f0-9]{40}$/', $sha)) { |
| 42 | 42 | $this->validationError( |
| 43 | 43 | $field, |
| 44 | - "Invalid release SHA: " . Convert::raw2xml($sha), |
|
| 44 | + "Invalid release SHA: ".Convert::raw2xml($sha), |
|
| 45 | 45 | "error" |
| 46 | 46 | ); |
| 47 | 47 | return false; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // Generate actions allowed for this user |
| 167 | 167 | $actions = new FieldList( |
| 168 | - FormAction::create('startPipeline', "Begin the release process on " . $environment->Name) |
|
| 168 | + FormAction::create('startPipeline', "Begin the release process on ".$environment->Name) |
|
| 169 | 169 | ->addExtraClass('btn btn-primary') |
| 170 | 170 | ->setAttribute('onclick', "return confirm('This will begin a release pipeline. Continue?');") |
| 171 | 171 | ); |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | ->addExtraClass('btn btn-info') |
| 176 | 176 | ->setAttribute( |
| 177 | 177 | 'onclick', |
| 178 | - "return confirm('This will begin a release pipeline, but with the following exclusions:\\n" . |
|
| 179 | - " - No messages will be sent\\n" . |
|
| 180 | - " - No capistrano actions will be invoked\\n" . |
|
| 178 | + "return confirm('This will begin a release pipeline, but with the following exclusions:\\n". |
|
| 179 | + " - No messages will be sent\\n". |
|
| 180 | + " - No capistrano actions will be invoked\\n". |
|
| 181 | 181 | " - No deployments or snapshots will be created.');" |
| 182 | 182 | ) |
| 183 | 183 | ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | ->addExtraClass('btn btn-warning') |
| 189 | 189 | ->setAttribute( |
| 190 | 190 | 'onclick', |
| 191 | - "return confirm('This will start a direct deployment, bypassing the pipeline " . |
|
| 191 | + "return confirm('This will start a direct deployment, bypassing the pipeline ". |
|
| 192 | 192 | "process in place.\\n\\nAre you sure this is necessary?');" |
| 193 | 193 | ) |
| 194 | 194 | ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | substr($sha, 0, 8), |
| 216 | 216 | $branch->LastUpdated()->TimeDiff() |
| 217 | 217 | ); |
| 218 | - $branches[$sha . '-' . $name] = $branchValue; |
|
| 218 | + $branches[$sha.'-'.$name] = $branchValue; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // Tags |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | substr($sha, 0, 8), |
| 229 | 229 | $branch->LastUpdated()->TimeDiff() |
| 230 | 230 | ); |
| 231 | - $tags[$sha . '-' . $tag] = $tagValue; |
|
| 231 | + $tags[$sha.'-'.$tag] = $tagValue; |
|
| 232 | 232 | } |
| 233 | 233 | $tags = array_reverse($tags); |
| 234 | 234 | |
@@ -36,7 +36,7 @@ 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 | 41 | if($this->upload->isError()) { |
| 42 | 42 | return false; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $file = $this->upload->getFile(); |
| 46 | 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; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | protected function getJobs() { |
| 50 | 50 | $jobs = new ArrayList(); |
| 51 | 51 | |
| 52 | - $resqueJobs = Resque::redis()->lrange('queue:' . $this->Name, 0, -1); |
|
| 52 | + $resqueJobs = Resque::redis()->lrange('queue:'.$this->Name, 0, -1); |
|
| 53 | 53 | if(!$resqueJobs) { |
| 54 | 54 | $jobs->push(new ResqueJob(array( |
| 55 | 55 | 'Name' => 'null', |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | $stdClass = json_decode($job); |
| 62 | 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, |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * Generate the package |
| 33 | 33 | */ |
| 34 | 34 | public function generatePackage($sha, $baseDir, $outputFilename, DeploynautLogFile $log) { |
| 35 | - $tempPath = TEMP_FOLDER . "/" . str_replace(".tar.gz", "", basename($outputFilename)); |
|
| 35 | + $tempPath = TEMP_FOLDER."/".str_replace(".tar.gz", "", basename($outputFilename)); |
|
| 36 | 36 | if(!file_exists($tempPath)) { |
| 37 | 37 | mkdir($tempPath); |
| 38 | 38 | } |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | // Execute these in sequence until there's a failure |
| 45 | 45 | $processes = array( |
| 46 | 46 | // Export the relevant SHA into a temp folder |
| 47 | - new Process("git archive $sha | tar -x -C " . $escapedTempPath, $baseDir), |
|
| 47 | + new Process("git archive $sha | tar -x -C ".$escapedTempPath, $baseDir), |
|
| 48 | 48 | // Run build script |
| 49 | 49 | new Process($this->buildScript, $tempPath, null, null, 3600), |
| 50 | 50 | // Compress the result |
| 51 | - new Process("tar -czf " . $escapedOutputFile . " " . $escapedTempDir, dirname($tempPath)), |
|
| 51 | + new Process("tar -czf ".$escapedOutputFile." ".$escapedTempDir, dirname($tempPath)), |
|
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | // Call at the end, regardless of success or failure |
| 55 | 55 | $cleanup = array( |
| 56 | 56 | // Delete the temporary staging folder |
| 57 | - new Process("rm -rf " . $escapedTempPath), |
|
| 57 | + new Process("rm -rf ".$escapedTempPath), |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | try { |
@@ -51,12 +51,12 @@ |
||
| 51 | 51 | public function getPackageFilename($identifier, $sha, $repositoryDir, DeploynautLogFile $log) { |
| 52 | 52 | // Fetch through the cache |
| 53 | 53 | if($this->cache) { |
| 54 | - $identifier .= '-' . get_class($this) . '-' . $this->getIdentifier(); |
|
| 54 | + $identifier .= '-'.get_class($this).'-'.$this->getIdentifier(); |
|
| 55 | 55 | return $this->cache->getPackageFilename($this, $identifier, $sha, $repositoryDir, $log); |
| 56 | 56 | |
| 57 | 57 | // Default, cacheless implementation |
| 58 | 58 | } else { |
| 59 | - $filename = TEMP_FOLDER . '/' . $sha . '.tar.gz'; |
|
| 59 | + $filename = TEMP_FOLDER.'/'.$sha.'.tar.gz'; |
|
| 60 | 60 | if($this->generatePackage($sha, $repositoryDir, $filename, $log)) { |
| 61 | 61 | return $filename; |
| 62 | 62 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | $file = sprintf('%s/%s.deploy-history.txt', DEPLOYNAUT_LOG_PATH, $environment->getFullName()); |
| 43 | 43 | $CLI_file = escapeshellarg($file); |
| 44 | - $CLI_line = escapeshellarg(date('Y-m-d H:i:s') . " => $sha"); |
|
| 44 | + $CLI_line = escapeshellarg(date('Y-m-d H:i:s')." => $sha"); |
|
| 45 | 45 | |
| 46 | 46 | // Put maintenance page up |
| 47 | 47 | $this->enableMaintenance($environment, $log, $project); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | try { |
| 74 | 74 | $args['build_filename'] = $this->packageGenerator->getPackageFilename($project->Name, $sha, $repository, $log); |
| 75 | - } catch (Exception $e) { |
|
| 75 | + } catch(Exception $e) { |
|
| 76 | 76 | $log->write($e->getMessage()); |
| 77 | 77 | throw $e; |
| 78 | 78 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } else { |
| 177 | 177 | $environment = $dataTransfer->Environment(); |
| 178 | 178 | $project = $environment->Project(); |
| 179 | - $workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID; |
|
| 179 | + $workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID; |
|
| 180 | 180 | $archive = $dataTransfer->DataArchive(); |
| 181 | 181 | |
| 182 | 182 | // extract the sspak contents, we'll need these so capistrano can restore that content |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if(!$args) { |
| 222 | 222 | $args = array(); |
| 223 | 223 | } |
| 224 | - $args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH . '/'); |
|
| 224 | + $args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH.'/'); |
|
| 225 | 225 | |
| 226 | 226 | // Inject env string directly into the command. |
| 227 | 227 | // Capistrano doesn't like the $process->setEnv($env) we'd normally do below. |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | $data = DNData::inst(); |
| 237 | 237 | // Generate a capfile from a template |
| 238 | - $capTemplate = file_get_contents(BASE_PATH . '/deploynaut/Capfile.template'); |
|
| 238 | + $capTemplate = file_get_contents(BASE_PATH.'/deploynaut/Capfile.template'); |
|
| 239 | 239 | $cap = str_replace( |
| 240 | 240 | array('<config root>', '<ssh key>', '<base path>'), |
| 241 | 241 | array($data->getEnvironmentDir(), DEPLOYNAUT_SSH_KEY, BASE_PATH), |
@@ -245,13 +245,13 @@ discard block |
||
| 245 | 245 | if(defined('DEPLOYNAUT_CAPFILE')) { |
| 246 | 246 | $capFile = DEPLOYNAUT_CAPFILE; |
| 247 | 247 | } else { |
| 248 | - $capFile = ASSETS_PATH . '/Capfile'; |
|
| 248 | + $capFile = ASSETS_PATH.'/Capfile'; |
|
| 249 | 249 | } |
| 250 | 250 | file_put_contents($capFile, $cap); |
| 251 | 251 | |
| 252 | - $command = "{$envString}cap -f " . escapeshellarg($capFile) . " -vv $name $action ROLES=$roles"; |
|
| 252 | + $command = "{$envString}cap -f ".escapeshellarg($capFile)." -vv $name $action ROLES=$roles"; |
|
| 253 | 253 | foreach($args as $argName => $argVal) { |
| 254 | - $command .= ' -s ' . escapeshellarg($argName) . '=' . escapeshellarg($argVal); |
|
| 254 | + $command .= ' -s '.escapeshellarg($argName).'='.escapeshellarg($argVal); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $log->write(sprintf('Running command: %s', $command)); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $filepathBase = $dataArchive->generateFilepath($dataTransfer); |
| 286 | 286 | mkdir($filepathBase, 0700, true); |
| 287 | 287 | |
| 288 | - $databasePath = $filepathBase . DIRECTORY_SEPARATOR . 'database.sql'; |
|
| 288 | + $databasePath = $filepathBase.DIRECTORY_SEPARATOR.'database.sql'; |
|
| 289 | 289 | |
| 290 | 290 | // Backup database |
| 291 | 291 | if(in_array($dataTransfer->Mode, array('all', 'db'))) { |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | $sspakFilename = sprintf('%s.sspak', $dataArchive->generateFilename($dataTransfer)); |
| 319 | - $sspakFilepath = $filepathBase . DIRECTORY_SEPARATOR . $sspakFilename; |
|
| 319 | + $sspakFilepath = $filepathBase.DIRECTORY_SEPARATOR.$sspakFilename; |
|
| 320 | 320 | |
| 321 | 321 | try { |
| 322 | 322 | $dataArchive->attachFile($sspakFilepath, $dataTransfer); |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | // Restore database into target environment |
| 382 | 382 | if(in_array($dataTransfer->Mode, array('all', 'db'))) { |
| 383 | 383 | $log->write(sprintf('Restore of database to "%s" started', $name)); |
| 384 | - $args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'database.sql'); |
|
| 384 | + $args = array('data_path' => $workingDir.DIRECTORY_SEPARATOR.'database.sql'); |
|
| 385 | 385 | $command = $this->getCommand('data:pushdb', 'db', $environment, $args, $log); |
| 386 | 386 | $command->run(function($type, $buffer) use($log) { |
| 387 | 387 | $log->write($buffer); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | // Restore assets into target environment |
| 399 | 399 | if(in_array($dataTransfer->Mode, array('all', 'assets'))) { |
| 400 | 400 | $log->write(sprintf('Restore of assets to "%s" started', $name)); |
| 401 | - $args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'assets'); |
|
| 401 | + $args = array('data_path' => $workingDir.DIRECTORY_SEPARATOR.'assets'); |
|
| 402 | 402 | $command = $this->getCommand('data:pushassets', 'web', $environment, $args, $log); |
| 403 | 403 | $command->run(function($type, $buffer) use($log) { |
| 404 | 404 | $log->write($buffer); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | throw new \LogicException("Can't use PackageCache without setting BaseDir"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $buildPath = $this->baseDir . '/' . $this->sanitiseDirName($identifier); |
|
| 55 | + $buildPath = $this->baseDir.'/'.$this->sanitiseDirName($identifier); |
|
| 56 | 56 | $filename = "$buildPath/$sha.tar.gz"; |
| 57 | 57 | |
| 58 | 58 | if(!file_exists($this->baseDir)) { |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @param DeploynautLogFile $log The log to send removal status messages to |
| 104 | 104 | */ |
| 105 | 105 | protected function reduceDirSizeTo($dir, $count, DeploynautLogFile $log) { |
| 106 | - $files = glob($dir . '/*.tar.gz'); |
|
| 106 | + $files = glob($dir.'/*.tar.gz'); |
|
| 107 | 107 | if(sizeof($files) > $count) { |
| 108 | 108 | usort($files, function($a, $b) { |
| 109 | 109 | return filemtime($a) > filemtime($b); |
| 110 | 110 | }); |
| 111 | 111 | |
| 112 | 112 | for($i = 0; $i < sizeof($files) - $count; $i++) { |
| 113 | - $log->write("Removing " . $files[$i] . " from package cache"); |
|
| 113 | + $log->write("Removing ".$files[$i]." from package cache"); |
|
| 114 | 114 | unlink($files[$i]); |
| 115 | 115 | } |
| 116 | 116 | } |