Fix github comments

This commit is contained in:
Nicolas Le Goff
2014-05-30 11:47:43 +02:00
parent df013d4f21
commit 9ba9533925
6 changed files with 19 additions and 69 deletions

View File

@@ -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);