Skip to content

Commit

Permalink
TASK: fix redirectHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
zaveryukha authored and aertmann committed Jan 30, 2018
1 parent 376bce0 commit e379961
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Classes/Service/NodeRedirectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ class NodeRedirectService implements NodeRedirectServiceInterface
* {@inheritdoc}
*/
public function createRedirectsForPublishedNode(NodeInterface $node, Workspace $targetWorkspace)
{
try {
$this->executeRedirectsForPublishedNode($node, $targetWorkspace);
} catch (\Exception $exception) {
$this->systemLogger->log(sprintf('Can not create redirect for the node = %s in workspace = %s. See original exception: "%s"', $node->getContextPath(), $targetWorkspace->getName(), $exception->getMessage()), LOG_WARNING);
}
}

/**
* Creates a redirect for the node if it is a 'TYPO3.Neos:Document' node and its URI has changed
*
* @param NodeInterface $node The node that is about to be published
* @param Workspace $targetWorkspace
* @return void
* @throws Exception
*/
protected function executeRedirectsForPublishedNode(NodeInterface $node, Workspace $targetWorkspace)
{
$nodeType = $node->getNodeType();
if ($targetWorkspace->getName() !== 'live' || !$nodeType->isOfType('TYPO3.Neos:Document')) {
Expand Down Expand Up @@ -137,7 +154,7 @@ public function createRedirectsForPublishedNode(NodeInterface $node, Workspace $

$q = new FlowQuery([$node]);
foreach ($q->children('[instanceof TYPO3.Neos:Document]') as $childrenNode) {
$this->createRedirectsForPublishedNode($childrenNode, $targetWorkspace);
$this->executeRedirectsForPublishedNode($childrenNode, $targetWorkspace);
}
}

Expand Down

0 comments on commit e379961

Please sign in to comment.