Skip to content

Commit 2f35546

Browse files
committed
[RELEASE] Version 12.5.1 with fixes for redirect support
Releases: https://projekte.in2code.de/issues/63687 Releases: https://projekte.in2code.de/issues/63755
2 parents 06ba6e3 + 81bed85 commit 2f35546

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# In2publish Core Change Log
22

3+
12.5.1:
4+
- [BUGFIX] Correct evaluation of publishing state
5+
- [BUGFIX] Fixes Databender for Redirects
6+
37
12.5.0:
48

59
- [BUGFIX] Pass correct record to edit and history links for changed records on the page

Classes/Features/RedirectsSupport/DataBender/RedirectSourceHostReplacement.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
use In2code\In2publishCore\Utility\BackendUtility;
3636
use Psr\Log\LoggerAwareInterface;
3737
use Psr\Log\LoggerAwareTrait;
38+
use TYPO3\CMS\Core\LinkHandling\LinkService;
3839
use TYPO3\CMS\Core\SingletonInterface;
40+
use TYPO3\CMS\Core\Utility\GeneralUtility;
3941

4042
use function in_array;
4143

@@ -50,6 +52,10 @@ class RedirectSourceHostReplacement implements SingletonInterface, LoggerAwareIn
5052
Record::S_MOVED,
5153
];
5254

55+
/**
56+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
57+
* @SuppressWarnings(PHPMD.NPathComplexity)
58+
*/
5359
public function replaceLocalWithForeignSourceHost(RecordWasSelectedForPublishing $event): void
5460
{
5561
$record = $event->getRecord();
@@ -101,6 +107,24 @@ public function replaceLocalWithForeignSourceHost(RecordWasSelectedForPublishing
101107
return;
102108
}
103109

110+
// 4. Check Target
111+
$target = $properties['target'];
112+
if (null !== $target && str_contains($target, 't3://')) {
113+
$coreLinkService = GeneralUtility::makeInstance(LinkService::class);
114+
$linkAttributes = $coreLinkService->resolveByStringRepresentation($target);
115+
if (!empty($linkAttributes['pageuid'])) {
116+
$url = BackendUtility::buildPreviewUri('pages', $linkAttributes['pageuid'], 'foreign');
117+
if (null === $url) {
118+
return;
119+
}
120+
$newHost = $url->getHost();
121+
122+
$properties['source_host'] = $newHost;
123+
$record->setLocalProps($properties);
124+
return;
125+
}
126+
}
127+
104128
$this->logger->alert(
105129
'A redirect without an associated page or site is going to be published',
106130
['uid' => $record->getId()],

Classes/Features/RedirectsSupport/Domain/Model/SysRedirectDatabaseRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function calculateChangedProps(): array
8080
// with a site or page, the local and foreign source_host must differ
8181
if (
8282
$this->localProps['source_host'] === $this->foreignProps['source_host']
83-
&& '*' !== ($this->localProps['sourceHost'] ?? null)
83+
&& '*' !== ($this->localProps['source_host'] ?? null)
8484
&& (
8585
null !== ($this->localProps['tx_in2publishcore_foreign_site_id'] ?? null)
8686
|| null !== ($this->localProps['tx_in2publishcore_page_uid'] ?? null)

ext_emconf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'title' => 'in2publish Core',
1010
'description' => 'Content publishing extension to connect stage and production server',
1111
'category' => 'plugin',
12-
'version' => '12.5.0',
12+
'version' => '12.5.1',
1313
'state' => 'stable',
1414
'clearCacheOnLoad' => true,
1515
'author' => 'Alex Kellner, Oliver Eglseder, Thomas Scheibitz, Stefan Busemann',

0 commit comments

Comments
 (0)