|
|
@ -60,6 +60,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
rsort($releases); |
|
|
|
rsort($releases); |
|
|
|
|
|
|
|
$deleteCurrent = $this->getConfig()->getParameter('deleteCurrent', false); |
|
|
|
|
|
|
|
|
|
|
|
$releaseIsAvailable = false; |
|
|
|
$releaseIsAvailable = false; |
|
|
|
if ($this->getReleaseId() == '') { |
|
|
|
if ($this->getReleaseId() == '') { |
|
|
@ -86,6 +87,13 @@ class RollbackTask extends AbstractTask implements IsReleaseAware |
|
|
|
Console::output('Rollback release on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>'); |
|
|
|
Console::output('Rollback release on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>'); |
|
|
|
$rollbackTo = $releasesDirectory . '/' . $releaseId; |
|
|
|
$rollbackTo = $releasesDirectory . '/' . $releaseId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get Current Release |
|
|
|
|
|
|
|
if ($deleteCurrent) { |
|
|
|
|
|
|
|
$result = $this->runCommandRemote('ls -l ' . $symlink, $output) && $result; |
|
|
|
|
|
|
|
$currentRelease = explode('/', $output); |
|
|
|
|
|
|
|
$currentRelease = trim(array_pop($currentRelease)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Tasks |
|
|
|
// Tasks |
|
|
|
$tasks = 1; |
|
|
|
$tasks = 1; |
|
|
|
$completedTasks = 0; |
|
|
|
$completedTasks = 0; |
|
|
@ -120,8 +128,8 @@ class RollbackTask extends AbstractTask implements IsReleaseAware |
|
|
|
$userGroup = ''; |
|
|
|
$userGroup = ''; |
|
|
|
$resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup); |
|
|
|
$resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup); |
|
|
|
$command = 'rm -f ' . $symlink |
|
|
|
$command = 'rm -f ' . $symlink |
|
|
|
. ' && ' |
|
|
|
. ' && ' |
|
|
|
. 'ln -sf ' . $rollbackTo . ' ' . $symlink; |
|
|
|
. 'ln -sf ' . $rollbackTo . ' ' . $symlink; |
|
|
|
|
|
|
|
|
|
|
|
if ($resultFetch) { |
|
|
|
if ($resultFetch) { |
|
|
|
$command .= ' && chown -h ' . $userGroup . ' ' . $symlink; |
|
|
|
$command .= ' && chown -h ' . $userGroup . ' ' . $symlink; |
|
|
@ -132,6 +140,11 @@ class RollbackTask extends AbstractTask implements IsReleaseAware |
|
|
|
if ($result) { |
|
|
|
if ($result) { |
|
|
|
Console::output('<green>OK</green>', 0); |
|
|
|
Console::output('<green>OK</green>', 0); |
|
|
|
$completedTasks++; |
|
|
|
$completedTasks++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Delete Old Current Release |
|
|
|
|
|
|
|
if ($deleteCurrent && $currentRelease) { |
|
|
|
|
|
|
|
$this->runCommandRemote('rm -rf ' . $releasesDirectory . '/' . $currentRelease, $output); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Console::output('<red>FAIL</red>', 0); |
|
|
|
Console::output('<red>FAIL</red>', 0); |
|
|
|
} |
|
|
|
} |
|
|
|