|
|
@ -86,40 +86,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware |
|
|
|
$command = 'rm ' . $localTarGz . ' ' . $localTarGz . '.tar.gz'; |
|
|
|
$command = 'rm ' . $localTarGz . ' ' . $localTarGz . '.tar.gz'; |
|
|
|
$result = $this->runCommandLocal($command) && $result; |
|
|
|
$result = $this->runCommandLocal($command) && $result; |
|
|
|
|
|
|
|
|
|
|
|
// Count Releases |
|
|
|
$this->cleanUpReleases(); |
|
|
|
if ($this->getConfig()->release('enabled', false) == true) { |
|
|
|
|
|
|
|
$releasesDirectory = $this->getConfig()->release('directory', 'releases'); |
|
|
|
|
|
|
|
$symlink = $this->getConfig()->release('symlink', 'current'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (substr($symlink, 0, 1) == '/') { |
|
|
|
|
|
|
|
$releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$maxReleases = $this->getConfig()->release('max', false); |
|
|
|
|
|
|
|
if (($maxReleases !== false) && ($maxReleases > 0)) { |
|
|
|
|
|
|
|
$releasesList = ''; |
|
|
|
|
|
|
|
$countReleasesFetch = $this->runCommandRemote('ls -1 ' . $releasesDirectory, $releasesList); |
|
|
|
|
|
|
|
$releasesList = trim($releasesList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($countReleasesFetch && $releasesList != '') { |
|
|
|
|
|
|
|
$releasesList = explode(PHP_EOL, $releasesList); |
|
|
|
|
|
|
|
if (count($releasesList) > $maxReleases) { |
|
|
|
|
|
|
|
$releasesToDelete = array_diff($releasesList, array($this->getConfig()->getReleaseId())); |
|
|
|
|
|
|
|
sort($releasesToDelete); |
|
|
|
|
|
|
|
$releasesToDeleteCount = count($releasesToDelete) - $maxReleases; |
|
|
|
|
|
|
|
$releasesToDelete = array_slice($releasesToDelete, 0, $releasesToDeleteCount + 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($releasesToDelete as $releaseIdToDelete) { |
|
|
|
|
|
|
|
$directoryToDelete = $releasesDirectory . '/' . $releaseIdToDelete; |
|
|
|
|
|
|
|
if ($directoryToDelete != '/') { |
|
|
|
|
|
|
|
$command = 'rm -rf ' . $directoryToDelete; |
|
|
|
|
|
|
|
$result = $result && $this->runCommandRemote($command); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|