2011-11-23 04:17:06 +01:00
|
|
|
<?php
|
|
|
|
abstract class Mage_Task_TaskAbstract
|
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
protected $_config = null;
|
|
|
|
|
2011-11-23 04:17:06 +01:00
|
|
|
public abstract function getName();
|
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
public abstract function run();
|
|
|
|
|
|
|
|
public final function __construct($config)
|
|
|
|
{
|
|
|
|
$this->_config = $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
}
|
2011-11-23 04:17:06 +01:00
|
|
|
|
2012-01-01 16:36:41 +01:00
|
|
|
protected final function _runLocalCommand($command, &$output = null)
|
2011-11-23 04:17:06 +01:00
|
|
|
{
|
2012-01-01 16:36:41 +01:00
|
|
|
return Mage_Console::executeCommand($command, $output);
|
2011-11-23 04:17:06 +01:00
|
|
|
}
|
|
|
|
|
2012-01-01 16:36:41 +01:00
|
|
|
protected final function _runRemoteCommand($command, &$output = null)
|
2011-11-23 04:17:06 +01:00
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
$localCommand = 'ssh '
|
2011-11-28 03:41:53 +01:00
|
|
|
. $this->_config['deploy']['deployment']['user'] . '@' . $this->_config['deploy']['host'] . ' '
|
|
|
|
. '"cd ' . $this->_config['deploy']['deployment']['to'] . ' && '
|
2011-11-23 12:38:52 +01:00
|
|
|
. $command . '"';
|
|
|
|
|
2012-01-01 16:36:41 +01:00
|
|
|
return $this->_runLocalCommand($localCommand, $output);
|
2011-11-23 04:17:06 +01:00
|
|
|
}
|
|
|
|
}
|