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.
44 lines
1.5 KiB
44 lines
1.5 KiB
13 years ago
|
<?php
|
||
12 years ago
|
class Mage_Task_BuiltIn_Deployment_Release
|
||
13 years ago
|
extends Mage_Task_TaskAbstract
|
||
12 years ago
|
implements Mage_Task_Releases_BuiltIn, Mage_Task_Releases_SkipOnOverride
|
||
13 years ago
|
{
|
||
|
public function getName()
|
||
|
{
|
||
|
return 'Releasing [built-in]';
|
||
|
}
|
||
|
|
||
|
public function run()
|
||
|
{
|
||
13 years ago
|
if ($this->getConfig()->release('enabled', false) == true) {
|
||
|
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
||
|
$symlink = $this->getConfig()->release('symlink', 'current');
|
||
13 years ago
|
|
||
13 years ago
|
if (substr($symlink, 0, 1) == '/') {
|
||
13 years ago
|
$releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
|
||
13 years ago
|
}
|
||
|
|
||
13 years ago
|
$currentCopy = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
|
||
13 years ago
|
|
||
13 years ago
|
// Fetch the user and group from base directory
|
||
|
$userGroup = '33:33';
|
||
|
$resultFetch = $this->_runRemoteCommand('ls -ld . | awk \'{print \$3\":\"\$4}\'', $userGroup);
|
||
13 years ago
|
|
||
13 years ago
|
// Remove symlink if exists; create new symlink and change owners
|
||
13 years ago
|
$command = 'rm -f ' . $symlink
|
||
13 years ago
|
. ' ; '
|
||
13 years ago
|
. 'ln -sf ' . $currentCopy . ' ' . $symlink
|
||
|
. ' && '
|
||
13 years ago
|
. 'chown -h ' . $userGroup . ' ' . $symlink
|
||
|
. ' && '
|
||
13 years ago
|
. 'chown -R ' . $userGroup . ' ' . $currentCopy;
|
||
13 years ago
|
$result = $this->_runRemoteCommand($command);
|
||
13 years ago
|
|
||
13 years ago
|
return $result;
|
||
13 years ago
|
|
||
|
} else {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|