PHPStorm refactoring.

This commit is contained in:
Andrés Montañez
2014-08-06 14:01:39 -03:00
parent 4c584b2634
commit fddeebe59a
48 changed files with 2011 additions and 1996 deletions
+242 -242
View File
@@ -23,287 +23,287 @@ use Exception;
*/
abstract class AbstractTask
{
/**
* Stage Constant for Pre Deployment
* @var string
*/
const STAGE_PRE_DEPLOY = 'pre-deploy';
/**
* Stage Constant for Pre Deployment
* @var string
*/
const STAGE_PRE_DEPLOY = 'pre-deploy';
/**
* Stage Constant for Deployment
* @var string
*/
const STAGE_DEPLOY = 'deploy';
/**
* Stage Constant for Deployment
* @var string
*/
const STAGE_DEPLOY = 'deploy';
/**
* Stage Constant for Post Deployment
* @var string
*/
const STAGE_POST_DEPLOY = 'post-deploy';
/**
* Stage Constant for Post Deployment
* @var string
*/
const STAGE_POST_DEPLOY = 'post-deploy';
/**
* Stage Constant for Post Release
* @var string
*/
const STAGE_POST_RELEASE = 'post-release';
/**
* Stage Constant for Post Release
* @var string
*/
const STAGE_POST_RELEASE = 'post-release';
/**
* Configuration
* @var Config;
*/
protected $config = null;
/**
* Configuration
* @var Config;
*/
protected $config = null;
/**
* Indicates if the Task is running in a Rollback
* @var boolean
*/
protected $inRollback = false;
/**
* Indicates if the Task is running in a Rollback
* @var boolean
*/
protected $inRollback = false;
/**
* Indicates the Stage the Task is running ing
* @var string
*/
protected $stage = null;
/**
* Indicates the Stage the Task is running ing
* @var string
*/
protected $stage = null;
/**
* Extra parameters
* @var array
*/
protected $parameters = array();
/**
* Extra parameters
* @var array
*/
protected $parameters = array();
/**
* Returns the Title of the Task
* @return string
*/
public abstract function getName();
/**
* Returns the Title of the Task
* @return string
*/
public abstract function getName();
/**
* Runs the task
*
* @return boolean
* @throws Exception
* @throws ErrorWithMessageException
* @throws SkipException
*/
public abstract function run();
/**
* Runs the task
*
* @return boolean
* @throws Exception
* @throws ErrorWithMessageException
* @throws SkipException
*/
public abstract function run();
/**
* Task Constructor
*
* @param Config $config
* @param boolean $inRollback
* @param string $stage
* @param array $parameters
*/
public final function __construct(Config $config, $inRollback = false, $stage = null, $parameters = array())
{
$this->config = $config;
$this->inRollback = $inRollback;
$this->stage = $stage;
$this->parameters = $parameters;
}
/**
* Task Constructor
*
* @param Config $config
* @param boolean $inRollback
* @param string $stage
* @param array $parameters
*/
public final function __construct(Config $config, $inRollback = false, $stage = null, $parameters = array())
{
$this->config = $config;
$this->inRollback = $inRollback;
$this->stage = $stage;
$this->parameters = $parameters;
}
/**
* Indicates if the Task is running in a Rollback operation
* @return boolean
*/
public function inRollback()
{
return $this->inRollback;
}
/**
* Indicates if the Task is running in a Rollback operation
* @return boolean
*/
public function inRollback()
{
return $this->inRollback;
}
/**
* Gets the Stage of the Deployment:
* - pre-deploy
* - deploy
* - post-deploy
* - post-release
* @return string
*/
public function getStage()
{
return $this->stage;
}
/**
* Gets the Stage of the Deployment:
* - pre-deploy
* - deploy
* - post-deploy
* - post-release
* @return string
*/
public function getStage()
{
return $this->stage;
}
/**
* Gets the Configuration
* @return Config;
*/
public function getConfig()
{
return $this->config;
}
/**
* Gets the Configuration
* @return Config;
*/
public function getConfig()
{
return $this->config;
}
/**
* Initializes the Task, optional to implement
*/
public function init()
{
}
/**
* Initializes the Task, optional to implement
*/
public function init()
{
}
/**
* Returns a Parameter, or a default if not found
*
* @param string $name
* @param mixed $default
* @return mixed
*/
public function getParameter($name, $default = null)
{
return $this->getConfig()->getParameter($name, $default, $this->getParameters());
}
/**
* Returns a Parameter, or a default if not found
*
* @param string $name
* @param mixed $default
* @return mixed
*/
public function getParameter($name, $default = null)
{
return $this->getConfig()->getParameter($name, $default, $this->getParameters());
}
/**
* @return array
*/
protected function getParameters()
{
return $this->parameters;
}
/**
* @return array
*/
protected function getParameters()
{
return $this->parameters;
}
/**
* Runs a Shell Command Localy
* @param string $command
* @param string $output
* @return boolean
*/
protected final function runCommandLocal($command, &$output = null)
{
return Console::executeCommand($command, $output);
}
/**
* Runs a Shell Command Localy
* @param string $command
* @param string $output
* @return boolean
*/
protected final function runCommandLocal($command, &$output = null)
{
return Console::executeCommand($command, $output);
}
/**
* Runs a Shell Command on the Remote Host
* @param string $command
* @param string $output
* @param boolean $cdToDirectoryFirst
* @return boolean
*/
protected final function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
{
if ($this->getConfig()->release('enabled', false) == true) {
if ($this instanceOf IsReleaseAware) {
$releasesDirectory = '';
/**
* Runs a Shell Command on the Remote Host
* @param string $command
* @param string $output
* @param boolean $cdToDirectoryFirst
* @return boolean
*/
protected final function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
{
if ($this->getConfig()->release('enabled', false) == true) {
if ($this instanceOf IsReleaseAware) {
$releasesDirectory = '';
} else {
$releasesDirectory = '/'
. $this->getConfig()->release('directory', 'releases')
. '/'
. $this->getConfig()->getReleaseId();
}
} else {
$releasesDirectory = '/'
. $this->getConfig()->release('directory', 'releases')
. '/'
. $this->getConfig()->getReleaseId();
}
} else {
$releasesDirectory = '';
}
} else {
$releasesDirectory = '';
}
// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
$needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? '-t' : '');
// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
$needs_tty = ($this->getConfig()->general('ssh_needs_tty', false) ? '-t' : '');
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName();
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName();
$remoteCommand = str_replace('"', '\"', $command);
if($cdToDirectoryFirst){
$remoteCommand = 'cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && ' . $remoteCommand;
}
$localCommand .= ' ' . '"sh -c \"' . $remoteCommand . '\""';
$remoteCommand = str_replace('"', '\"', $command);
if ($cdToDirectoryFirst) {
$remoteCommand = 'cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && ' . $remoteCommand;
}
$localCommand .= ' ' . '"sh -c \"' . $remoteCommand . '\""';
Console::log('Run remote command ' . $remoteCommand);
Console::log('Run remote command ' . $remoteCommand);
return $this->runCommandLocal($localCommand, $output);
}
return $this->runCommandLocal($localCommand, $output);
}
/**
* Runs a Shell Command Localy or in the Remote Host based on the Task Stage.
* If the stage is "deploy" then it will be executed in the remote host.
* @param string $command
* @param string $output
* @return boolean
*/
protected final function runCommand($command, &$output = null)
{
if ($this->getStage() == self::STAGE_DEPLOY) {
return $this->runCommandRemote($command, $output);
} else {
return $this->runCommandLocal($command, $output);
}
}
/**
* Runs a Shell Command Localy or in the Remote Host based on the Task Stage.
* If the stage is "deploy" then it will be executed in the remote host.
* @param string $command
* @param string $output
* @return boolean
*/
protected final function runCommand($command, &$output = null)
{
if ($this->getStage() == self::STAGE_DEPLOY) {
return $this->runCommandRemote($command, $output);
} else {
return $this->runCommandLocal($command, $output);
}
}
/**
* adds a cd to the needed release if we work with releases.
*
* @param string $command
* @return string
*/
protected function getReleasesAwareCommand($command)
{
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
/**
* adds a cd to the needed release if we work with releases.
*
* @param string $command
* @return string
*/
protected function getReleasesAwareCommand($command)
{
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
return 'cd ' . $deployToDirectory . ' && ' . $command;
}
$deployToDirectory = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
return 'cd ' . $deployToDirectory . ' && ' . $command;
}
return $command;
}
return $command;
}
/**
* @param integer $releaseId
* @return bool
*/
protected function tarRelease($releaseId)
{
$result = true;
// for given release, check if tarred
$output = '';
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
protected function tarRelease($releaseId)
{
$result = true;
// for given release, check if tarred
$output = '';
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$currentReleaseDirectory = $releasesDirectory . '/' . $releaseId;
$currentReleaseDirectoryTemp = $currentReleaseDirectory . '_tmp/';
$currentRelease = $currentReleaseDirectory . '/' . $releaseId . '.tar.gz';
$currentReleaseDirectory = $releasesDirectory . '/' . $releaseId;
$currentReleaseDirectoryTemp = $currentReleaseDirectory . '_tmp/';
$currentRelease = $currentReleaseDirectory . '/' . $releaseId . '.tar.gz';
$command = 'test -e ' . $currentRelease . ' && echo "true" || echo ""';
$this->runCommandRemote($command, $output);
$command = 'test -e ' . $currentRelease . ' && echo "true" || echo ""';
$this->runCommandRemote($command, $output);
// if not, do so
if (!$output) {
$commands = array();
$commands[] = 'mv ' . $currentReleaseDirectory . ' ' . $currentReleaseDirectoryTemp;
$commands[] = 'mkdir ' . $currentReleaseDirectory;
$commands[] = 'tar cfz ' . $currentRelease . ' ' . $currentReleaseDirectoryTemp;
$commands[] = 'rm -rf ' . $currentReleaseDirectoryTemp;
$command = implode(' && ', $commands);
$result = $this->runCommandRemote($command, $output);
return $result;
}
return $result;
}
// if not, do so
if (!$output) {
$commands = array();
$commands[] = 'mv ' . $currentReleaseDirectory . ' ' . $currentReleaseDirectoryTemp;
$commands[] = 'mkdir ' . $currentReleaseDirectory;
$commands[] = 'tar cfz ' . $currentRelease . ' ' . $currentReleaseDirectoryTemp;
$commands[] = 'rm -rf ' . $currentReleaseDirectoryTemp;
$command = implode(' && ', $commands);
$result = $this->runCommandRemote($command, $output);
return $result;
}
return $result;
}
protected function untarRelease($releaseId)
{
$result = true;
// for given release, check if tarred
$output = '';
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
protected function untarRelease($releaseId)
{
$result = true;
// for given release, check if tarred
$output = '';
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$currentReleaseDirectory = $releasesDirectory . '/' . $releaseId;
$currentReleaseDirectoryTemp = $currentReleaseDirectory . '_tmp/';
$currentRelease = $currentReleaseDirectory . '/' . $releaseId . '.tar.gz';
$currentReleaseDirectory = $releasesDirectory . '/' . $releaseId;
$currentReleaseDirectoryTemp = $currentReleaseDirectory . '_tmp/';
$currentRelease = $currentReleaseDirectory . '/' . $releaseId . '.tar.gz';
$command = 'test -e ' . $currentRelease . ' && echo "true" || echo ""';
$this->runCommandRemote($command, $output);
$command = 'test -e ' . $currentRelease . ' && echo "true" || echo ""';
$this->runCommandRemote($command, $output);
// if tarred, untar now
if ($output) {
$commands = array();
$commands[] = 'tar xfz ' . $currentRelease;
$commands[] = 'rm -rf ' . $currentReleaseDirectory;
$commands[] = 'mv ' .$currentReleaseDirectoryTemp . ' ' . $currentReleaseDirectory;
$command = implode(' && ', $commands);
$result = $this->runCommandRemote($command, $output);
return $result;
}
return $result;
}
// if tarred, untar now
if ($output) {
$commands = array();
$commands[] = 'tar xfz ' . $currentRelease;
$commands[] = 'rm -rf ' . $currentReleaseDirectory;
$commands[] = 'mv ' . $currentReleaseDirectoryTemp . ' ' . $currentReleaseDirectory;
$command = implode(' && ', $commands);
$result = $this->runCommandRemote($command, $output);
return $result;
}
return $result;
}
}
+70 -70
View File
@@ -21,86 +21,86 @@ use Mage\Task\Releases\SkipOnOverride;
*/
class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Releasing [built-in]';
}
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Releasing [built-in]';
}
/**
* Releases a Deployment: points the current symbolic link to the release directory
* @see \Mage\Task\AbstractTask::run()
*/
public function run()
{
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
/**
* Releases a Deployment: points the current symbolic link to the release directory
* @see \Mage\Task\AbstractTask::run()
*/
public function run()
{
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;
}
if (substr($symlink, 0, 1) == '/') {
$releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
}
$releaseId = $this->getConfig()->getReleaseId();
$releaseId = $this->getConfig()->getReleaseId();
if ($this->getConfig()->release('compressreleases', false) == true) {
// Tar.gz releases
$result = $this->tarReleases() && $result;
// Untar new release
$result = $this->untarRelease($releaseId) && $result;
}
if ($this->getConfig()->release('compressreleases', false) == true) {
// Tar.gz releases
$result = $this->tarReleases() && $result;
// Untar new release
$result = $this->untarRelease($releaseId) && $result;
}
$currentCopy = $releasesDirectory . '/' . $releaseId;
$currentCopy = $releasesDirectory . '/' . $releaseId;
//Check if target user:group is specified
$userGroup = $this->getConfig()->deployment('owner');
// Fetch the user and group from base directory; defaults usergroup to 33:33
if(empty($userGroup)){
$user = '33';
$group = '33';
$directoryInfos = '';
// Get raw directory info and parse it in php.
// "stat" command don't behave the same on different systems, ls output format also varies
// and awk parameters need special care depending on the executing shell
$resultFetch = $this->runCommandRemote("ls -ld .", $directoryInfos);
if(!empty($directoryInfos)){
//uniformize format as it depends on the system deployed on
$directoryInfos = trim(str_replace(array(" ", "\t"), ' ', $directoryInfos));
$infoArray = explode(' ', $directoryInfos);
if(!empty($infoArray[2])) {
$user = $infoArray[2];
}
if(!empty($infoArray[3])) {
$group = $infoArray[3];
}
$userGroup = $user . ':' . $group;
}
}
//Check if target user:group is specified
$userGroup = $this->getConfig()->deployment('owner');
// Fetch the user and group from base directory; defaults usergroup to 33:33
if (empty($userGroup)) {
$user = '33';
$group = '33';
$directoryInfos = '';
// Get raw directory info and parse it in php.
// "stat" command don't behave the same on different systems, ls output format also varies
// and awk parameters need special care depending on the executing shell
$resultFetch = $this->runCommandRemote("ls -ld .", $directoryInfos);
if (!empty($directoryInfos)) {
//uniformize format as it depends on the system deployed on
$directoryInfos = trim(str_replace(array(" ", "\t"), ' ', $directoryInfos));
$infoArray = explode(' ', $directoryInfos);
if (!empty($infoArray[2])) {
$user = $infoArray[2];
}
if (!empty($infoArray[3])) {
$group = $infoArray[3];
}
$userGroup = $user . ':' . $group;
}
}
// Remove symlink if exists; create new symlink and change owners
$command = 'rm -f ' . $symlink
. ' ; '
. 'ln -sf ' . $currentCopy . ' ' . $symlink;
// Remove symlink if exists; create new symlink and change owners
$command = 'rm -f ' . $symlink
. ' ; '
. 'ln -sf ' . $currentCopy . ' ' . $symlink;
if ($resultFetch && $userGroup != '') {
$command .= ' && '
. 'chown -h ' . $userGroup . ' ' . $symlink
. ' && '
. 'chown -R ' . $userGroup . ' ' . $currentCopy
. ' && '
. 'chown ' . $userGroup . ' ' . $releasesDirectory;
}
if ($resultFetch && $userGroup != '') {
$command .= ' && '
. 'chown -h ' . $userGroup . ' ' . $symlink
. ' && '
. 'chown -R ' . $userGroup . ' ' . $currentCopy
. ' && '
. 'chown ' . $userGroup . ' ' . $releasesDirectory;
}
$result = $this->runCommandRemote($command);
$result = $this->runCommandRemote($command);
return $result;
return $result;
} else {
return false;
}
}
} else {
return false;
}
}
}
@@ -32,7 +32,7 @@ abstract class BaseStrategyTaskAbstract extends AbstractTask implements IsReleas
if ($overrideRelease == true) {
$releaseToOverride = false;
$resultFetch = $this->runCommandRemote('ls -ld '.$symlink.' | cut -d"/" -f2', $releaseToOverride);
$resultFetch = $this->runCommandRemote('ls -ld ' . $symlink . ' | cut -d"/" -f2', $releaseToOverride);
if ($resultFetch && is_numeric($releaseToOverride)) {
$this->getConfig()->setReleaseId($releaseToOverride);
}
@@ -21,10 +21,10 @@ use Mage\Task\SkipException;
*/
class DisabledTask extends AbstractTask implements IsReleaseAware
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Disabled Deployment [built-in]';
@@ -44,8 +44,8 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
}
@@ -78,11 +78,11 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$result = $this->runCommandRemote($command) && $result;
// Stash if Working Copy is not clean
if(!$status) {
if (!$status) {
$stashResult = '';
$command = $this->getReleasesAwareCommand('git stash');
$result = $this->runCommandRemote($command, $stashResult) && $result;
if($stashResult != "No local changes to save") {
if ($stashResult != "No local changes to save") {
$stashed = true;
}
}
@@ -21,10 +21,10 @@ use Mage\Task\Releases\IsReleaseAware;
*/
class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
if ($this->getConfig()->release('enabled', false) == true) {
@@ -32,14 +32,14 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
return 'Deploy via Rsync (with Releases override) [built-in]';
} else {
$rsync_copy = $this->getConfig()->deployment("rsync");
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
return 'Deploy via Rsync (with Releases) [built-in, incremental]';
} else {
return 'Deploy via Rsync (with Releases) [built-in]';
}
}
} else {
return 'Deploy via Rsync [built-in]';
return 'Deploy via Rsync [built-in]';
}
}
@@ -61,8 +61,8 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$currentRelease = false;
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
Console::log('Deploy to ' . $deployToDirectory);
$resultFetch = $this->runCommandRemote('ls -ld ' . $symlink . ' | cut -d"/" -f2', $currentRelease);
@@ -72,10 +72,10 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
// rsync: { copy: yes }
$rsync_copy = $this->getConfig()->deployment('rsync');
// If copy_tool_rsync, use rsync rather than cp for finer control of what is copied
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync']) ) {
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync'])) {
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
} elseif ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
} elseif ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
} else {
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
@@ -84,10 +84,10 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
}
$command = 'rsync -avz '
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
. $this->excludes($excludes) . ' '
. $this->getConfig()->deployment('from') . ' '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
. $this->excludes($excludes) . ' '
. $this->getConfig()->deployment('from') . ' '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
$result = $this->runCommandLocal($command);
@@ -21,10 +21,10 @@ use Mage\Task\Releases\IsReleaseAware;
*/
class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
if ($this->getConfig()->release('enabled', false) == true) {
@@ -34,7 +34,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
return 'Deploy via TarGz (with Releases) [built-in]';
}
} else {
return 'Deploy via TarGz [built-in]';
return 'Deploy via TarGz [built-in]';
}
}
@@ -53,10 +53,10 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
$output = null;
$this->runCommandRemote('mkdir -p ' . $deployToDirectory, $output , false);
$this->runCommandRemote('mkdir -p ' . $deployToDirectory, $output, false);
}
// Create Tar Gz
@@ -68,19 +68,19 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
}
$command = 'tar cfz ' . $localTarGz . '.tar.gz ' . $excludeCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
$result = $this->runCommandLocal($command);
$result = $this->runCommandLocal($command);
// Copy Tar Gz to Remote Host
$command = 'scp ' . $this->getConfig()->getHostIdentityFileOption() . '-P ' . $this->getConfig()->getHostPort() . ' ' . $localTarGz . '.tar.gz '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
$result = $this->runCommandLocal($command) && $result;
// Copy Tar Gz to Remote Host
$command = 'scp ' . $this->getConfig()->getHostIdentityFileOption() . '-P ' . $this->getConfig()->getHostPort() . ' ' . $localTarGz . '.tar.gz '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
$result = $this->runCommandLocal($command) && $result;
// Extract Tar Gz
$command = $this->getReleasesAwareCommand('tar xfz ' . $remoteTarGz . '.tar.gz');
$command = $this->getReleasesAwareCommand('tar xfz ' . $remoteTarGz . '.tar.gz');
$result = $this->runCommandRemote($command) && $result;
// Delete Tar Gz from Remote Host
$command = $this->getReleasesAwareCommand('rm ' . $remoteTarGz . '.tar.gz');
$command = $this->getReleasesAwareCommand('rm ' . $remoteTarGz . '.tar.gz');
$result = $this->runCommandRemote($command) && $result;
// Delete Tar Gz from Local
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class ClearCacheTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Magento - Clean Cache [built-in]';
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class ClearFullPageCacheTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Magento - Clean Full Page Cache [built-in]';
+14 -14
View File
@@ -54,22 +54,22 @@ class ListTask extends AbstractTask implements IsReleaseAware
Console::output('<dark_gray>No releases available</dark_gray> ... ', 2);
} else {
rsort($releases);
$releases = array_slice($releases, 0, 10);
$releases = array_slice($releases, 0, 10);
foreach ($releases as $releaseIndex => $release) {
$release = trim($release);
$releaseIndex = str_pad($releaseIndex * -1, 2, ' ', STR_PAD_LEFT);
$releaseDate = $release[0] . $release[1] . $release[2] .$release[3]
. '-'
. $release[4] . $release[5]
. '-'
. $release[6] . $release[7]
. ' '
. $release[8] . $release[9]
. ':'
. $release[10] . $release[11]
. ':'
. $release[12] . $release[13];
$releaseDate = $release[0] . $release[1] . $release[2] . $release[3]
. '-'
. $release[4] . $release[5]
. '-'
. $release[6] . $release[7]
. ' '
. $release[8] . $release[9]
. ':'
. $release[10] . $release[11]
. ':'
. $release[12] . $release[13];
$isCurrent = '';
if ($currentRelease == $release) {
@@ -80,8 +80,8 @@ class ListTask extends AbstractTask implements IsReleaseAware
Console::output(
'Release: <purple>' . $release . '</purple> '
. '- Date: <dark_gray>' . $releaseDate . '</dark_gray> '
. '- Index: <dark_gray>' . $releaseIndex . '</dark_gray>' . $dateDiff . $isCurrent, 2);
. '- Date: <dark_gray>' . $releaseDate . '</dark_gray> '
. '- Index: <dark_gray>' . $releaseIndex . '</dark_gray>' . $dateDiff . $isCurrent, 2);
}
}
+146 -146
View File
@@ -23,179 +23,179 @@ use Mage\Task\Releases\RollbackAware;
*/
class RollbackTask extends AbstractTask implements IsReleaseAware
{
/**
* The Relase ID to Rollback To
* @var integer
*/
protected $release = null;
/**
* The Relase ID to Rollback To
* @var integer
*/
protected $release = null;
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Rollback release [built-in]';
}
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
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;
}
/**
* 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()
{
return $this->release;
}
/**
* Gets the Release ID to Rollback To
* @return integer
*/
public function getRelease()
{
return $this->release;
}
/**
* Performs a Rollback Operation
* @see \Mage\Task\AbstractTask::run()
*/
public function run()
{
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
/**
* Performs a Rollback Operation
* @see \Mage\Task\AbstractTask::run()
*/
public function run()
{
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
$output = '';
$result = $this->runCommandRemote('ls -1 ' . $releasesDirectory, $output);
$releases = ($output == '') ? array() : explode(PHP_EOL, $output);
$output = '';
$result = $this->runCommandRemote('ls -1 ' . $releasesDirectory, $output);
$releases = ($output == '') ? array() : explode(PHP_EOL, $output);
if (count($releases) == 0) {
Console::output('Release are not available for <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> ... <red>FAIL</red>');
if (count($releases) == 0) {
Console::output('Release are not available for <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> ... <red>FAIL</red>');
} else {
rsort($releases);
} else {
rsort($releases);
$releaseIsAvailable = false;
if ($this->getRelease() == '') {
$releaseId = $releases[0];
$releaseIsAvailable = true;
$releaseIsAvailable = false;
if ($this->getRelease() == '') {
$releaseId = $releases[0];
$releaseIsAvailable = true;
} else if ($this->getRelease() <= 0) {
$index = $this->getRelease() * -1;
if (isset($releases[$index])) {
$releaseId = $releases[$index];
$releaseIsAvailable = true;
}
} else {
if (in_array($this->getRelease(), $releases)) {
$releaseId = $this->getRelease();
$releaseIsAvailable = true;
}
}
} else if ($this->getRelease() <= 0) {
$index = $this->getRelease() * -1;
if (isset($releases[$index])) {
$releaseId = $releases[$index];
$releaseIsAvailable = true;
}
} else {
if (in_array($this->getRelease(), $releases)) {
$releaseId = $this->getRelease();
$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>');
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>');
} else {
Console::output('Rollback release on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>');
$rollbackTo = $releasesDirectory . '/' . $releaseId;
} else {
Console::output('Rollback release on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>');
$rollbackTo = $releasesDirectory . '/' . $releaseId;
// Tasks
$tasks = 1;
$completedTasks = 0;
$tasksToRun = $this->getConfig()->getTasks();
$this->getConfig()->setReleaseId($releaseId);
// Tasks
$tasks = 1;
$completedTasks = 0;
$tasksToRun = $this->getConfig()->getTasks();
$this->getConfig()->setReleaseId($releaseId);
// Run Deploy Tasks
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_DEPLOY);
$task->init();
Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
// Run Deploy Tasks
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_DEPLOY);
$task->init();
Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
if ($task instanceOf RollbackAware) {
$tasks++;
$result = $task->run();
if ($task instanceOf RollbackAware) {
$tasks++;
$result = $task->run();
if ($result == true) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
} else {
Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
if ($result == true) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
} else {
Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
if ($this->getConfig()->release('compressreleases', false) == true) {
// Tar the current
$result = $this->tarReleases() && $result;
// Untar the rollbackto
$result = $this->untarRelease($releaseId) && $result;
}
if ($this->getConfig()->release('compressreleases', false) == true) {
// Tar the current
$result = $this->tarReleases() && $result;
// Untar the rollbackto
$result = $this->untarRelease($releaseId) && $result;
}
// Changing Release
Console::output('Running <purple>Rollback Release [id=' . $releaseId . ']</purple> ... ', 2, false);
// Changing Release
Console::output('Running <purple>Rollback Release [id=' . $releaseId . ']</purple> ... ', 2, false);
$userGroup = '';
$resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
$command = 'rm -f ' . $symlink
. ' && '
. 'ln -sf ' . $rollbackTo . ' ' . $symlink;
$userGroup = '';
$resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
$command = 'rm -f ' . $symlink
. ' && '
. 'ln -sf ' . $rollbackTo . ' ' . $symlink;
if ($resultFetch) {
$command .= ' && chown -h ' . $userGroup . ' ' . $symlink;
}
if ($resultFetch) {
$command .= ' && chown -h ' . $userGroup . ' ' . $symlink;
}
$result = $this->runCommandRemote($command);
$result = $this->runCommandRemote($command);
if ($result) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
if ($result) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
// Run Post Release Tasks
$tasksToRun = $this->getConfig()->getTasks(AbstractTask::STAGE_POST_DEPLOY);
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_POST_DEPLOY);
$task->init();
Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
// Run Post Release Tasks
$tasksToRun = $this->getConfig()->getTasks(AbstractTask::STAGE_POST_DEPLOY);
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_POST_DEPLOY);
$task->init();
Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
if ($task instanceOf RollbackAware) {
$tasks++;
$result = $task->run();
if ($task instanceOf RollbackAware) {
$tasks++;
$result = $task->run();
if ($result == true) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
} else {
Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
if ($result == true) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
} else {
Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
if ($completedTasks == $tasks) {
$tasksColor = 'green';
} else {
$tasksColor = 'red';
}
if ($completedTasks == $tasks) {
$tasksColor = 'green';
} else {
$tasksColor = 'red';
}
Console::output('Release rollback on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
}
}
Console::output('Release rollback on <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
}
}
return $result;
return $result;
} else {
return false;
}
}
} else {
return false;
}
}
}
+33 -33
View File
@@ -21,16 +21,16 @@ use Mage\Task\ErrorWithMessageException;
*/
class ChangeBranchTask extends AbstractTask
{
/**
* Branch the executiong began with
* @var string
*/
protected static $startingBranch = 'master';
/**
* Branch the executiong began with
* @var string
*/
protected static $startingBranch = 'master';
/**
* Name of the Task
* @var string
*/
/**
* Name of the Task
* @var string
*/
private $name = 'SCM Changing branch [built-in]';
/**
@@ -48,7 +48,7 @@ class ChangeBranchTask extends AbstractTask
*/
public function init()
{
$scmType = $this->getConfig()->general('scm');
$scmType = $this->getConfig()->general('scm');
switch ($scmType) {
case 'git':
@@ -65,35 +65,35 @@ class ChangeBranchTask extends AbstractTask
{
switch ($this->getConfig()->general('scm')) {
case 'git':
if ($this->getParameter('_changeBranchRevert', false)) {
$command = 'git checkout ' . self::$startingBranch;
$result = $this->runCommandLocal($command);
if ($this->getParameter('_changeBranchRevert', false)) {
$command = 'git checkout ' . self::$startingBranch;
$result = $this->runCommandLocal($command);
} else {
$command = 'git branch | grep \'*\' | cut -d\' \' -f 2';
$currentBranch = 'master';
$result = $this->runCommandLocal($command, $currentBranch);
} else {
$command = 'git branch | grep \'*\' | cut -d\' \' -f 2';
$currentBranch = 'master';
$result = $this->runCommandLocal($command, $currentBranch);
$scmData = $this->getConfig()->deployment('scm', false);
$scmData = $this->getConfig()->deployment('scm', false);
if ($result && is_array($scmData) && isset($scmData['branch']) && $scmData['branch'] != $currentBranch) {
$command = 'git branch | grep \'' . $scmData['branch'] . '\' | tr -s \' \' | sed \'s/^[ ]//g\'';
$isBranchTracked = '';
$result = $this->runCommandLocal($command, $isBranchTracked);
if ($result && is_array($scmData) && isset($scmData['branch']) && $scmData['branch'] != $currentBranch) {
$command = 'git branch | grep \'' . $scmData['branch'] . '\' | tr -s \' \' | sed \'s/^[ ]//g\'';
$isBranchTracked = '';
$result = $this->runCommandLocal($command, $isBranchTracked);
if ($isBranchTracked == '') {
throw new ErrorWithMessageException('The branch <purple>' . $scmData['branch'] . '</purple> must be tracked.');
}
if ($isBranchTracked == '') {
throw new ErrorWithMessageException('The branch <purple>' . $scmData['branch'] . '</purple> must be tracked.');
}
$branch = $this->getParameter('branch', $scmData['branch']);
$command = 'git checkout ' . $branch;
$result = $this->runCommandLocal($command) && $result;
$branch = $this->getParameter('branch', $scmData['branch']);
$command = 'git checkout ' . $branch;
$result = $this->runCommandLocal($command) && $result;
self::$startingBranch = $currentBranch;
} else {
throw new SkipException;
}
}
self::$startingBranch = $currentBranch;
} else {
throw new SkipException;
}
}
break;
default:
+6 -6
View File
@@ -20,10 +20,10 @@ use Mage\Task\SkipException;
*/
class CloneTask extends AbstractTask
{
/**
* Name of the Task
* @var string
*/
/**
* Name of the Task
* @var string
*/
private $name = 'SCM Clone [built-in]';
/**
@@ -66,12 +66,12 @@ class CloneTask extends AbstractTask
case 'git':
// Clone Repo
$command = 'cd ' . $this->source['temporal'] . ' ; '
. 'git clone ' . $this->source['repository'] . ' . ';
. 'git clone ' . $this->source['repository'] . ' . ';
$result = $this->runCommandLocal($command);
// Checkout Branch
$command = 'cd ' . $this->source['temporal'] . ' ; '
. 'git checkout ' . $this->source['from'];
. 'git checkout ' . $this->source['from'];
$result = $result && $this->runCommandLocal($command);
$this->getConfig()->setFrom($this->source['temporal']);
+6 -6
View File
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class RemoveCloneTask extends AbstractTask
{
/**
* Name of the Task
* @var string
*/
/**
* Name of the Task
* @var string
*/
private $name = 'SCM Remove Clone [built-in]';
/**
@@ -49,8 +49,8 @@ class RemoveCloneTask extends AbstractTask
$this->source = $this->getConfig()->deployment('source');
switch ($this->source['type']) {
case 'git':
$this->name = 'SCM Remove Clone (GIT) [built-in]';
break;
$this->name = 'SCM Remove Clone (GIT) [built-in]';
break;
}
}
+4 -4
View File
@@ -20,10 +20,10 @@ use Mage\Task\SkipException;
*/
class UpdateTask extends AbstractTask
{
/**
* Name of the Task
* @var string
*/
/**
* Name of the Task
* @var string
*/
private $name = 'SCM Update [built-in]';
/**
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class AsseticDumpTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Symfony v2 - Assetic Dump [built-in]';
@@ -34,8 +34,8 @@ class AsseticDumpTask extends AbstractTask
*/
public function run()
{
// Options
$env = $this->getParameter('env', 'dev');
// Options
$env = $this->getParameter('env', 'dev');
$command = 'app/console assetic:dump --env=' . $env;
$result = $this->runCommand($command);
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class AssetsInstallTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Symfony v2 - Assets Install [built-in]';
@@ -34,17 +34,17 @@ class AssetsInstallTask extends AbstractTask
*/
public function run()
{
// Options
$target = $this->getParameter('target', 'web');
$symlink = $this->getParameter('symlink', false);
$relative = $this->getParameter('relative', false);
$env = $this->getParameter('env', 'dev');
// Options
$target = $this->getParameter('target', 'web');
$symlink = $this->getParameter('symlink', false);
$relative = $this->getParameter('relative', false);
$env = $this->getParameter('env', 'dev');
if ($relative) {
$symlink = true;
}
if ($relative) {
$symlink = true;
}
$command = 'app/console assets:install ' . ($symlink ? '--symlink' : '') . ' ' . ($relative ? '--relative' : '') . ' --env=' . $env . ' ' . $target;
$command = 'app/console assets:install ' . ($symlink ? '--symlink' : '') . ' ' . ($relative ? '--relative' : '') . ' --env=' . $env . ' ' . $target;
$result = $this->runCommand($command);
return $result;
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class CacheClearTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Symfony v2 - Cache Clear [built-in]';
@@ -34,8 +34,8 @@ class CacheClearTask extends AbstractTask
*/
public function run()
{
// Options
$env = $this->getParameter('env', 'dev');
// Options
$env = $this->getParameter('env', 'dev');
$command = 'app/console cache:clear --env=' . $env;
$result = $this->runCommand($command);
@@ -19,10 +19,10 @@ use Mage\Task\AbstractTask;
*/
class CacheWarmupTask extends AbstractTask
{
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
/**
* (non-PHPdoc)
* @see \Mage\Task\AbstractTask::getName()
*/
public function getName()
{
return 'Symfony v2 - Cache Warmup [built-in]';
@@ -34,8 +34,8 @@ class CacheWarmupTask extends AbstractTask
*/
public function run()
{
// Options
$env = $this->getParameter('env', 'dev');
// Options
$env = $this->getParameter('env', 'dev');
$command = 'app/console cache:warmup --env=' . $env;
$result = $this->runCommand($command);
+2 -2
View File
@@ -56,8 +56,8 @@ class Factory
$instance = new $className($taskConfig, $inRollback, $stage, $taskParameters);
if (!is_a($instance,'Mage\Task\AbstractTask')) {
throw new Exception('The Task ' . $taskName . ' must be an instance of Mage\Task\AbstractTask.');
if (!is_a($instance, 'Mage\Task\AbstractTask')) {
throw new Exception('The Task ' . $taskName . ' must be an instance of Mage\Task\AbstractTask.');
}
return $instance;