mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Ensure symlink is always created
This commit is contained in:
@@ -24,4 +24,11 @@ abstract class AbstractStaticMode extends AbstractServerMode
|
|||||||
|
|
||||||
parent::__construct($mapping);
|
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)
|
public function getUrl($pathFile)
|
||||||
{
|
{
|
||||||
|
$this->ensureSymlink($pathFile);
|
||||||
|
|
||||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($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)
|
public function getUrl($pathFile)
|
||||||
{
|
{
|
||||||
|
$this->ensureSymlink($pathFile);
|
||||||
|
|
||||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,4 +86,9 @@ class SymLinker
|
|||||||
$this->getSymlinkBasePath($pathFile)
|
$this->getSymlinkBasePath($pathFile)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasSymlink($pathFile)
|
||||||
|
{
|
||||||
|
return file_exists($this->getSymlinkPath($pathFile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user