mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Fix github comments
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Http\StaticFile;
|
||||
|
||||
use Alchemy\Phrasea\Http\AbstractServerMode;
|
||||
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
|
||||
use Guzzle\Http\Url;
|
||||
|
||||
abstract class AbstractStaticMode extends AbstractServerMode
|
||||
{
|
||||
@@ -25,7 +26,22 @@ abstract class AbstractStaticMode extends AbstractServerMode
|
||||
parent::__construct($mapping);
|
||||
}
|
||||
|
||||
protected function ensureSymlink($pathFile)
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUrl($pathFile)
|
||||
{
|
||||
$this->ensureSymlink($pathFile);
|
||||
|
||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a link if it does not exists
|
||||
*
|
||||
* @param $pathFile
|
||||
*/
|
||||
private function ensureSymlink($pathFile)
|
||||
{
|
||||
if (false === $this->symlinker->hasSymlink($pathFile)) {
|
||||
$this->symlinker->symlink($pathFile);
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\Http\AbstractServerMode;
|
||||
use Guzzle\Http\Url;
|
||||
|
||||
class Apache extends AbstractStaticMode implements StaticFileModeInterface
|
||||
{
|
||||
@@ -35,16 +33,6 @@ class Apache extends AbstractStaticMode implements StaticFileModeInterface
|
||||
$this->mapping = $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUrl($pathFile)
|
||||
{
|
||||
$this->ensureSymlink($pathFile);
|
||||
|
||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\Http\AbstractServerMode;
|
||||
use Guzzle\Http\Url;
|
||||
|
||||
class Nginx extends AbstractStaticMode implements StaticFileModeInterface
|
||||
{
|
||||
@@ -35,16 +33,6 @@ class Nginx extends AbstractStaticMode implements StaticFileModeInterface
|
||||
$this->mapping = $mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUrl($pathFile)
|
||||
{
|
||||
$this->ensureSymlink($pathFile);
|
||||
|
||||
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@@ -35,7 +35,7 @@ class SymLinker
|
||||
$app['phraseanet.thumb-symlinker-encoder'],
|
||||
$app['filesystem'],
|
||||
$app['phraseanet.registry'],
|
||||
isset($app['phraseanet.configuration']['static-file']['symlink-directory']) ? $app['phraseanet.configuration']['static-file']['symlink-directory'] : null
|
||||
isset($app['phraseanet.configuration']['static-file']['symlink-directory']) ? $app['phraseanet.configuration']['static-file']['symlink-directory'] : $app['root.path'] . '/symlinks'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,10 +43,6 @@ class SymLinker
|
||||
{
|
||||
$this->encoder = $encoder;
|
||||
$this->fs = $fs;
|
||||
|
||||
if (!$symlinkDir) {
|
||||
throw new InvalidArgumentException("Symlink directory is not defined");
|
||||
}
|
||||
$this->symlinkDir = rtrim($symlinkDir, '/');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user