mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Get path and strategy.
This commit is contained in:
		
							parent
							
								
									4c719f5efd
								
							
						
					
					
						commit
						d52927fe07
					
				@ -35,7 +35,7 @@ class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @var array
 | 
					     * @var array
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public $linkingStrategies = array(
 | 
					    private static $linkingStrategies = array(
 | 
				
			||||||
        self::ABSOLUTE_LINKING,
 | 
					        self::ABSOLUTE_LINKING,
 | 
				
			||||||
        self::RELATIVE_LINKING
 | 
					        self::RELATIVE_LINKING
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@ -77,12 +77,7 @@ class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
        $relativeDiffPath = str_replace($this->getConfig()->deployment('to'), '', $currentCopy) . '/';
 | 
					        $relativeDiffPath = str_replace($this->getConfig()->deployment('to'), '', $currentCopy) . '/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach ($linkedEntities as $ePath) {
 | 
					        foreach ($linkedEntities as $ePath) {
 | 
				
			||||||
            if (is_array($ePath) && in_array($strategy = reset($ePath), $this->linkingStrategies)) {
 | 
					            list($entityPath, $strategy) = $this->getPath($ePath);
 | 
				
			||||||
                $entityPath = key($ePath);
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                $strategy = $linkingStrategy;
 | 
					 | 
				
			||||||
                $entityPath = $ePath;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            $sharedEntityLinkedPath = "$sharedFolderPath/$entityPath";
 | 
					            $sharedEntityLinkedPath = "$sharedFolderPath/$entityPath";
 | 
				
			||||||
            if ($strategy == self::RELATIVE_LINKING) {
 | 
					            if ($strategy == self::RELATIVE_LINKING) {
 | 
				
			||||||
                $parentFolderPath = dirname($entityPath);
 | 
					                $parentFolderPath = dirname($entityPath);
 | 
				
			||||||
@ -98,4 +93,25 @@ class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @param array|string $linkedEntity
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return array [$path, $strategy]
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private function getPath($linkedEntity)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $linkingStrategy = $this->getParameter(self::LINKED_STRATEGY, self::ABSOLUTE_LINKING);
 | 
				
			||||||
 | 
					        if (is_array($linkedEntity)) {
 | 
				
			||||||
 | 
					            list($path, $strategy) = each($linkedEntity);
 | 
				
			||||||
 | 
					            if (!in_array($strategy, self::$linkingStrategies)) {
 | 
				
			||||||
 | 
					                $strategy = $linkingStrategy;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $strategy = $linkingStrategy;
 | 
				
			||||||
 | 
					            $path = $linkedEntity;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return [$path, $strategy];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user