You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

13 years ago
<?php
class Mage_Command_BuiltIn_Releases
extends Mage_Command_CommandAbstract
implements Mage_Command_RequiresEnvironment
13 years ago
{
private $_release = null;
public function run()
13 years ago
{
$subcommand = $this->getConfig()->getArgument(1);
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile) && ($subcommand == 'rollback')) {
12 years ago
Mage_Console::output('<red>This environment is locked!</red>', 0, 2);
return;
}
13 years ago
// Run Tasks for Deployment
$hosts = $this->getConfig()->getHosts();
13 years ago
if (count($hosts) == 0) {
Mage_Console::output('<light_purple>Warning!</light_purple> <dark_gray>No hosts defined, unable to get releases.</dark_gray>', 1, 3);
13 years ago
} else {
foreach ($hosts as $host) {
$this->getConfig()->setHost($host);
switch ($subcommand) {
13 years ago
case 'list':
$task = Mage_Task_Factory::get('releases/list', $this->getConfig());
13 years ago
$task->init();
$result = $task->run();
break;
case 'rollback':
$releaseId = $this->getConfig()->getParameter('release', '');
$task = Mage_Task_Factory::get('releases/rollback', $this->getConfig());
$task->init();
$task->setRelease($releaseId);
$result = $task->run();
break;
13 years ago
}
}
}
}
}