Commit 487b0f83 authored by mickadoo's avatar mickadoo

68: Remove publishURLBase

parent b1947cae
...@@ -8,7 +8,6 @@ use AppBundle\Model\Version; ...@@ -8,7 +8,6 @@ use AppBundle\Model\Version;
use Monolog\Logger; use Monolog\Logger;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use AppBundle\Model\Library; use AppBundle\Model\Library;
...@@ -50,13 +49,6 @@ class Publisher { ...@@ -50,13 +49,6 @@ class Publisher {
private $publishingMessages = []; private $publishingMessages = [];
/** /**
* @var string
*/
protected $publishURLBase;
/**
*
* @param RequestStack $requestStack
* @param LoggerInterface $logger * @param LoggerInterface $logger
* @param Filesystem $fs * @param Filesystem $fs
* @param Library $library * @param Library $library
...@@ -65,7 +57,6 @@ class Publisher { ...@@ -65,7 +57,6 @@ class Publisher {
* @param Paths $paths * @param Paths $paths
*/ */
public function __construct( public function __construct(
RequestStack $requestStack,
Logger $logger, Logger $logger,
Filesystem $fs, Filesystem $fs,
Library $library, Library $library,
...@@ -79,13 +70,6 @@ class Publisher { ...@@ -79,13 +70,6 @@ class Publisher {
$this->git = $git; $this->git = $git;
$this->mkDocs = $mkDocs; $this->mkDocs = $mkDocs;
$this->paths = $paths; $this->paths = $paths;
if ($requestStack->getCurrentRequest()) {
$this->publishURLBase
= $requestStack->getCurrentRequest()->getUriForPath('');
} else {
$this->publishURLBase = '/';
}
} }
/** /**
...@@ -214,7 +198,6 @@ class Publisher { ...@@ -214,7 +198,6 @@ class Publisher {
$this->addMessage('INFO', $msg); $this->addMessage('INFO', $msg);
$fullIdentifier = "{$book->slug}/{$language->code}/" . "{$version->branch}"; $fullIdentifier = "{$book->slug}/{$language->code}/" . "{$version->branch}";
$publishURLFull = "{$this->publishURLBase}/{$fullIdentifier}";
$repoURL = $language->repo; $repoURL = $language->repo;
$publishPath = $this->paths->getPublishPathRoot() . "/{$fullIdentifier}"; $publishPath = $this->paths->getPublishPathRoot() . "/{$fullIdentifier}";
...@@ -234,8 +217,8 @@ class Publisher { ...@@ -234,8 +217,8 @@ class Publisher {
$this->git->pull($repoPath); $this->git->pull($repoPath);
$this->build($book, $language, $version, $repoPath, $publishPath); $this->build($book, $language, $version, $repoPath, $publishPath);
$format = "Book published successfully at <a href='%s'>%s</a>."; $format = "<a href='/%s'>Book published successfully</a>.";
$msg = sprintf($format, $publishURLFull, $publishURLFull); $msg = sprintf($format, $fullIdentifier);
$this->addMessage('INFO', $msg); $this->addMessage('INFO', $msg);
$this->setupSymlinks($book, $language, $version, $publishPath); $this->setupSymlinks($book, $language, $version, $publishPath);
...@@ -379,9 +362,8 @@ class Publisher { ...@@ -379,9 +362,8 @@ class Publisher {
// Add new symlinks // Add new symlinks
foreach ($version->aliases as $alias) { foreach ($version->aliases as $alias) {
$this->fs->symlink($publishPath, "$path/$alias"); $this->fs->symlink($publishPath, "$path/$alias");
$url = "{$this->publishURLBase}/{$book->slug}/{$language->code}/$alias"; $msg = sprintf("Adding alias '%s' for %s.", $alias, $version->name);
$a = "<a href='$url'>$url</a>"; $this->addMessage('INFO', $msg);
$this->addMessage('INFO', "Adding alias '{$alias}' at $a.");
} }
} }
...@@ -400,5 +382,4 @@ class Publisher { ...@@ -400,5 +382,4 @@ class Publisher {
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment