Files
Magallanes/Mage/Task/TaskAbstract.php
T

40 lines
1.0 KiB
PHP
Raw Normal View History

<?php
abstract class Mage_Task_TaskAbstract
{
protected $_config = null;
2012-01-03 23:25:42 -02:00
protected $_inRollback = false;
public abstract function getName();
public abstract function run();
2012-01-03 23:25:42 -02:00
public final function __construct(Mage_Config $config, $inRollback = false)
{
$this->_config = $config;
2012-01-03 23:25:42 -02:00
$this->_inRollback = $inRollback;
}
public function inRollback()
{
return $this->_inRollback;
}
public function init()
{
}
2012-01-01 13:36:41 -02:00
protected final function _runLocalCommand($command, &$output = null)
{
2012-01-01 13:36:41 -02:00
return Mage_Console::executeCommand($command, $output);
}
2012-01-01 13:36:41 -02:00
protected final function _runRemoteCommand($command, &$output = null)
{
$localCommand = 'ssh '
. $this->_config->deployment('user') . '@' . $this->_config->getHost() . ' '
. '"cd ' . $this->_config->deployment('to') . ' && '
. $command . '"';
2012-01-01 13:36:41 -02:00
return $this->_runLocalCommand($localCommand, $output);
}
}