|
|
@ -5,21 +5,44 @@ use Mage\Task\AbstractTask; |
|
|
|
use Mage\Task\Releases\IsReleaseAware; |
|
|
|
use Mage\Task\Releases\IsReleaseAware; |
|
|
|
use Mage\Task\SkipException; |
|
|
|
use Mage\Task\SkipException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Class LinkSharedFilesTask |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @package Mage\Task\BuiltIn\Filesystem |
|
|
|
|
|
|
|
* @author Andrey Kolchenko <a.j.kolchenko@baltsoftservice.ru> |
|
|
|
|
|
|
|
*/ |
|
|
|
class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware |
|
|
|
class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Linked folders parameter name |
|
|
|
|
|
|
|
*/ |
|
|
|
const LINKED_FOLDERS = 'linked_folders'; |
|
|
|
const LINKED_FOLDERS = 'linked_folders'; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Linking strategy parameter name |
|
|
|
|
|
|
|
*/ |
|
|
|
const LINKED_STRATEGY = 'linking_strategy'; |
|
|
|
const LINKED_STRATEGY = 'linking_strategy'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Absolute linked strategy |
|
|
|
|
|
|
|
*/ |
|
|
|
const ABSOLUTE_LINKING = 'absolute'; |
|
|
|
const ABSOLUTE_LINKING = 'absolute'; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Relative linked strategy |
|
|
|
|
|
|
|
*/ |
|
|
|
const RELATIVE_LINKING = 'relative'; |
|
|
|
const RELATIVE_LINKING = 'relative'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @var array |
|
|
|
|
|
|
|
*/ |
|
|
|
public $linkingStrategies = array( |
|
|
|
public $linkingStrategies = array( |
|
|
|
self::ABSOLUTE_LINKING, |
|
|
|
self::ABSOLUTE_LINKING, |
|
|
|
self::RELATIVE_LINKING |
|
|
|
self::RELATIVE_LINKING |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the Title of the Task |
|
|
|
* Returns the Title of the Task |
|
|
|
|
|
|
|
* |
|
|
|
* @return string |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getName() |
|
|
|
public function getName() |
|
|
@ -64,7 +87,10 @@ class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware |
|
|
|
if ($strategy == self::RELATIVE_LINKING) { |
|
|
|
if ($strategy == self::RELATIVE_LINKING) { |
|
|
|
$parentFolderPath = dirname($entityPath); |
|
|
|
$parentFolderPath = dirname($entityPath); |
|
|
|
$relativePath = $parentFolderPath == '.' ? $relativeDiffPath : $relativeDiffPath . $parentFolderPath . '/'; |
|
|
|
$relativePath = $parentFolderPath == '.' ? $relativeDiffPath : $relativeDiffPath . $parentFolderPath . '/'; |
|
|
|
$sharedEntityLinkedPath = ltrim(preg_replace('/(\w+\/)/', '../', $relativePath),'/').$sharedFolderName .'/'. $entityPath; |
|
|
|
$sharedEntityLinkedPath = ltrim( |
|
|
|
|
|
|
|
preg_replace('/(\w+\/)/', '../', $relativePath), |
|
|
|
|
|
|
|
'/' |
|
|
|
|
|
|
|
) . $sharedFolderName . '/' . $entityPath; |
|
|
|
} |
|
|
|
} |
|
|
|
$command = "ln -nfs $sharedEntityLinkedPath $currentCopy/$entityPath"; |
|
|
|
$command = "ln -nfs $sharedEntityLinkedPath $currentCopy/$entityPath"; |
|
|
|
$this->runCommandRemote($command); |
|
|
|
$this->runCommandRemote($command); |
|
|
|