mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Ensure symlink is always created
This commit is contained in:
@@ -24,4 +24,11 @@ abstract class AbstractStaticMode extends AbstractServerMode
|
||||
|
||||
parent::__construct($mapping);
|
||||
}
|
||||
|
||||
protected function ensureSymlink($pathFile)
|
||||
{
|
||||
if (false === $this->symlinker->hasSymlink($pathFile)) {
|
||||
$this->symlinker->symlink($pathFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,8 @@ class Apache extends AbstractStaticMode implements StaticFileModeInterface
|
||||
*/
|
||||
public function getUrl($pathFile)
|
||||
{
|
||||
$this->ensureSymlink($pathFile);
|
||||
|
||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,8 @@ class Nginx extends AbstractStaticMode implements StaticFileModeInterface
|
||||
*/
|
||||
public function getUrl($pathFile)
|
||||
{
|
||||
$this->ensureSymlink($pathFile);
|
||||
|
||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||
}
|
||||
|
||||
|
@@ -86,4 +86,9 @@ class SymLinker
|
||||
$this->getSymlinkBasePath($pathFile)
|
||||
);
|
||||
}
|
||||
|
||||
public function hasSymlink($pathFile)
|
||||
{
|
||||
return file_exists($this->getSymlinkPath($pathFile));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user