mirror of https://github.com/hauke68/Magallanes
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.
59 lines
2.3 KiB
59 lines
2.3 KiB
<?php |
|
class Mage_Task_BuiltIn_Releases_List |
|
extends Mage_Task_TaskAbstract |
|
implements Mage_Task_Releases_BuiltIn |
|
{ |
|
public function getName() |
|
{ |
|
return 'Listing releases [built-in]'; |
|
} |
|
|
|
public function run() |
|
{ |
|
if ($this->_config->release('enabled', false) == true) { |
|
$releasesDirectory = $this->_config->release('directory', 'releases'); |
|
$symlink = $this->_config->release('symlink', 'current'); |
|
|
|
Mage_Console::output('Releases available on <dark_gray>' . $this->_config->getHost() . '</dark_gray>'); |
|
|
|
$output = ''; |
|
$result = $this->_runRemoteCommand('ls -1 ' . $releasesDirectory, $output); |
|
$releases = ($output == '') ? array() : explode(PHP_EOL, $output); |
|
|
|
if (count($releases) == 0) { |
|
Mage_Console::output('<dark_gray>No releases available</dark_gray> ... ', 2); |
|
} else { |
|
rsort($releases); |
|
$releases = array_slice($releases, 0, 10); |
|
|
|
foreach ($releases as $releaseIndex => $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]; |
|
|
|
Mage_Console::output( |
|
'Release: <purple>' . $release . '</purple> ' |
|
. '- Date: <dark_gray>' . $releaseDate . '</dark_gray> ' |
|
. '- Index: <dark_gray>' . $releaseIndex . '</dark_gray>', 2); |
|
} |
|
} |
|
|
|
Mage_Console::output(''); |
|
return $result; |
|
|
|
} else { |
|
Mage_Console::output(''); |
|
return false; |
|
} |
|
} |
|
|
|
} |