|
|
|
@ -23,12 +23,6 @@ use Mage\Task\Releases\RollbackAware;
|
|
|
|
|
*/ |
|
|
|
|
class RollbackTask extends AbstractTask implements IsReleaseAware |
|
|
|
|
{ |
|
|
|
|
/** |
|
|
|
|
* The Relase ID to Rollback To |
|
|
|
|
* @var integer |
|
|
|
|
*/ |
|
|
|
|
protected $release = null; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* (non-PHPdoc) |
|
|
|
|
* @see \Mage\Task\AbstractTask::getName() |
|
|
|
@ -38,24 +32,13 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
|
|
|
|
|
return 'Rollback release [built-in]'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets the Release ID to Rollback To |
|
|
|
|
* @param integer $releaseId |
|
|
|
|
* @return \Mage\Task\BuiltIn\Releases\RollbackTask |
|
|
|
|
*/ |
|
|
|
|
public function setRelease($releaseId) |
|
|
|
|
{ |
|
|
|
|
$this->release = $releaseId; |
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets the Release ID to Rollback To |
|
|
|
|
* @return integer |
|
|
|
|
*/ |
|
|
|
|
public function getRelease() |
|
|
|
|
public function getReleaseId() |
|
|
|
|
{ |
|
|
|
|
return $this->release; |
|
|
|
|
return $this->getConfig()->getReleaseId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -79,25 +62,25 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
|
|
|
|
|
rsort($releases); |
|
|
|
|
|
|
|
|
|
$releaseIsAvailable = false; |
|
|
|
|
if ($this->getRelease() == '') { |
|
|
|
|
if ($this->getReleaseId() == '') { |
|
|
|
|
$releaseId = $releases[0]; |
|
|
|
|
$releaseIsAvailable = true; |
|
|
|
|
|
|
|
|
|
} else if ($this->getRelease() <= 0) { |
|
|
|
|
$index = $this->getRelease() * -1; |
|
|
|
|
} else if ($this->getReleaseId() <= 0) { |
|
|
|
|
$index = $this->getReleaseId() * -1; |
|
|
|
|
if (isset($releases[$index])) { |
|
|
|
|
$releaseId = $releases[$index]; |
|
|
|
|
$releaseIsAvailable = true; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (in_array($this->getRelease(), $releases)) { |
|
|
|
|
$releaseId = $this->getRelease(); |
|
|
|
|
if (in_array($this->getReleaseId(), $releases)) { |
|
|
|
|
$releaseId = $this->getReleaseId(); |
|
|
|
|
$releaseIsAvailable = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$releaseIsAvailable) { |
|
|
|
|
Console::output('Release <dark_gray>' . $this->getRelease() . '</dark_gray> is invalid or unavailable for <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> ... <red>FAIL</red>'); |
|
|
|
|
Console::output('Release <dark_gray>' . $this->getReleaseId() . '</dark_gray> is invalid or unavailable for <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> ... <red>FAIL</red>'); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
Console::output('Rollback release on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>'); |
|
|
|
|