magallanes/Mage/Task/BuiltIn/Deployment/Releases.php

33 lines
1 KiB
PHP
Raw Normal View History

<?php
class Mage_Task_BuiltIn_Deployment_Releases
extends Mage_Task_TaskAbstract
{
public function getName()
{
return 'Releasing [built-in]';
}
public function run()
{
if ($this->_config->release('enabled', false) == true) {
$releasesDirectory = $this->_config->release('directory', 'releases');
$symlink = $this->_config->release('symlink', 'current');
$currentCopy = $releasesDirectory . '/' . $this->_config->getReleaseId();
2012-01-01 21:10:25 +01:00
$userGroup = '';
$resultFetch = $this->_runRemoteCommand('ls -ld ' . $currentCopy . ' | awk \'{print \$3\":\"\$4}\'', $userGroup);
$command = 'rm -f ' . $symlink
. ' && '
. 'ln -sf ' . $currentCopy . ' ' . $symlink
. ' && '
. 'chown -h ' . $userGroup . ' ' . $symlink;
$result = $this->_runRemoteCommand($command);
return $result;
} else {
return false;
}
}
}