Skip to content

Commit

Permalink
[RELEASE] Version 12.5.1 with fixes for redirect support
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoffmann1979 committed May 14, 2024
2 parents 06ba6e3 + 81bed85 commit 2f35546
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# In2publish Core Change Log

12.5.1:
- [BUGFIX] Correct evaluation of publishing state
- [BUGFIX] Fixes Databender for Redirects

12.5.0:

- [BUGFIX] Pass correct record to edit and history links for changed records on the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
use In2code\In2publishCore\Utility\BackendUtility;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\LinkHandling\LinkService;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

use function in_array;

Expand All @@ -50,6 +52,10 @@ class RedirectSourceHostReplacement implements SingletonInterface, LoggerAwareIn
Record::S_MOVED,
];

/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function replaceLocalWithForeignSourceHost(RecordWasSelectedForPublishing $event): void
{
$record = $event->getRecord();
Expand Down Expand Up @@ -101,6 +107,24 @@ public function replaceLocalWithForeignSourceHost(RecordWasSelectedForPublishing
return;
}

// 4. Check Target
$target = $properties['target'];
if (null !== $target && str_contains($target, 't3://')) {
$coreLinkService = GeneralUtility::makeInstance(LinkService::class);
$linkAttributes = $coreLinkService->resolveByStringRepresentation($target);
if (!empty($linkAttributes['pageuid'])) {
$url = BackendUtility::buildPreviewUri('pages', $linkAttributes['pageuid'], 'foreign');
if (null === $url) {
return;
}
$newHost = $url->getHost();

$properties['source_host'] = $newHost;
$record->setLocalProps($properties);
return;
}
}

$this->logger->alert(
'A redirect without an associated page or site is going to be published',
['uid' => $record->getId()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function calculateChangedProps(): array
// with a site or page, the local and foreign source_host must differ
if (
$this->localProps['source_host'] === $this->foreignProps['source_host']
&& '*' !== ($this->localProps['sourceHost'] ?? null)
&& '*' !== ($this->localProps['source_host'] ?? null)
&& (
null !== ($this->localProps['tx_in2publishcore_foreign_site_id'] ?? null)
|| null !== ($this->localProps['tx_in2publishcore_page_uid'] ?? null)
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'title' => 'in2publish Core',
'description' => 'Content publishing extension to connect stage and production server',
'category' => 'plugin',
'version' => '12.5.0',
'version' => '12.5.1',
'state' => 'stable',
'clearCacheOnLoad' => true,
'author' => 'Alex Kellner, Oliver Eglseder, Thomas Scheibitz, Stefan Busemann',
Expand Down

0 comments on commit 2f35546

Please sign in to comment.