Skip to content

Commit bf72e11

Browse files
committed
[RELEASE] Version 9.4.0 with redirects support
New feature: Redirects Support. This version contains a new module which allows to publish specific redirects to the foreign system. Bug fixes: Several bugs have been fixed, including * Ignore sys_domain if the table does not exist * Fixed identification of the PID in the Backend by data operations * Removed visual bug with missing background color * Type cast values to their expected type * Publishing behavior with tranlsations and originals * URL generation for deleted records * Shared runtime cache of the RecordFactory and much more Releases: https://projekte.in2code.de/issues/31914 Releases: https://projekte.in2code.de/issues/40689 Releases: https://projekte.in2code.de/issues/45262 Releases: https://projekte.in2code.de/issues/45441 Releases: https://projekte.in2code.de/issues/45453 Releases: https://projekte.in2code.de/issues/45468 Releases: https://projekte.in2code.de/issues/45430 Releases: https://projekte.in2code.de/issues/45502 Releases: https://projekte.in2code.de/issues/45509 Releases: https://projekte.in2code.de/issues/45517 Releases: https://projekte.in2code.de/issues/45441 Releases: https://projekte.in2code.de/issues/45276 Resolves: https://projekte.in2code.de/issues/45412
2 parents 134e383 + 897225f commit bf72e11

File tree

59 files changed

+2394
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2394
-135
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ indent_size = 2
5858
[.eslintrc]
5959
indent_style = space
6060
indent_size = 4
61+
62+
# https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/CodingGuidelines/CglTypoScript/Index.html
63+
[{ext_typoscript_setup.txt, *.typoscript, setup.txt, constants.txt, setup.ts, constants.ts}]
64+
indent_style = space
65+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# .gitattributes
22

3+
Build export-ignore
34
.gitkeep export-ignore
45
/.editorconfig export-ignore
56
/.gitattributes export-ignore

CHANGELOG.md

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

3+
9.4.0:
4+
5+
- [META] Set the branch alias version number to 9.4.x-dev
6+
- [META] Set the EM conf version number to 9.4.0
7+
- [BUGFIX] Fix exception when publishing deleted redirects
8+
- [TASK] remove unused import and use right indent
9+
- [TASK] enable publish deletion of redirects
10+
- [BUGFIX] Remove redundant module.m5 option, add docs for redirects support
11+
- [BUGFIX] Publish redirects which were filtered becasue they are deleted and unpublished
12+
- [BUGFIX] Add test to identify site config language differences
13+
- [BUGFIX] Provide missing icons for TYPO3 v9
14+
- [BUGFIX] Always publish language originals
15+
- [TASK] publish default and translated page
16+
- [BUGFIX] Add missing exception code
17+
- [TYPO] transission -> transmission
18+
- [BUGFIX] Never relate redirects by their PID
19+
- [BUGFIX] Share the RecordFactories runtimeCache between instances
20+
- [BUGFIX] Skip URL generation for deleted pages
21+
- [BUGFIX] Publish translation original when publishing via specific record publishing
22+
- [BUGFIX] Check if the pointer field is set before accessing it
23+
- [TASK] publish default and translated page
24+
- [BUGFIX] Do not enable redirects support when EXT:redirects is not loaded
25+
- [BUGFIX] Typecast properties to be used in str_replace
26+
- [FEATURE] Support TYPO3 redirects
27+
- [DOCS] Add known issue for missing icons in publish redirect module in v9
28+
- [CODESTYLE] Reformat TypoScript and add editorconfig rules
29+
- [BUGFIX] Add extbase table mapping for TYPO3 version 9
30+
- [BUGFIX] Remove trailing method call comma for PHP 7.2 compat
31+
- [BUGFIX] Replace Command::SUCCESS constant with 0 for TYPO3 v9
32+
- [BUGFIX] Skip constraint for deleted redirects if none are deleted on foreign
33+
- [FEATURE] Rebuild redirects cache after publishing a redirect
34+
- [BUGFIX] Hide the edit button for deleted records
35+
- [FEATURE] Exclude fully deleted redirects from the module
36+
- [BUGFIX] Include deleted redirects
37+
- [FEATURE] Remove discarded concepts, add support in simplePublish
38+
- Wip: [FEATURE] Finish backend module for redirect publishing
39+
- Wip: [FEATURE] List all redirects with state and publish button
40+
- Wip: [FEATURE] Add Backend Module to publish redirects
41+
- [BUGFIX] Ignore pages without sites
42+
- [BUGFIX] Resolve redirects recursively
43+
- [FEATURE] Resolve relations to TYPO3 v10 redirects and publish them with changed source_host
44+
- [BUGFIX] Do not log failed site searches for disconnected pages.
45+
- [BUGFIX] Output non-breaking space if no preview URL could be rendered.
46+
- [FEATURE] Show dirty properties for deleted records
47+
- [BUGFIX] Show foreign properties on dirty properties foreign side
48+
- [TASK] show properties if deleted on right side
49+
- [TASK] show deletion state and history button
50+
- [BUGFIX] Skip DataHandler cmdmap with integer keys in getPageIdentifier
51+
- [BUGFIX] Detect pid from newly created records
52+
- [REFACTOR] Move ssh connection debug option to ssh connection definer
53+
- [BUGFIX] Do not select from sys_domain if table does not exist
54+
- [GIT] Don't export the Build folder into releases
55+
- [RELEASE] Version 9.3.1 with fixes for TCA pre proc., empty pointer values and deleted records
56+
357
9.3.1:
458

559
- [META] Set the EM conf version number to 9.3.1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace In2code\In2publishCore\Command\Status;
6+
7+
/*
8+
* Copyright notice
9+
*
10+
* (c) 2021 in2code.de and the following authors:
11+
* Oliver Eglseder <[email protected]>
12+
*
13+
* All rights reserved
14+
*
15+
* This script is part of the TYPO3 project. The TYPO3 project is
16+
* free software; you can redistribute it and/or modify
17+
* it under the terms of the GNU General Public License as published by
18+
* the Free Software Foundation; either version 3 of the License, or
19+
* (at your option) any later version.
20+
*
21+
* The GNU General Public License can be found at
22+
* http://www.gnu.org/copyleft/gpl.html.
23+
*
24+
* This script is distributed in the hope that it will be useful,
25+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
26+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+
* GNU General Public License for more details.
28+
*
29+
* This copyright notice MUST APPEAR in all copies of the script!
30+
*/
31+
32+
use Symfony\Component\Console\Command\Command;
33+
use Symfony\Component\Console\Input\InputInterface;
34+
use Symfony\Component\Console\Output\OutputInterface;
35+
use TYPO3\CMS\Core\Site\SiteFinder;
36+
use TYPO3\CMS\Core\Utility\GeneralUtility;
37+
38+
use function base64_encode;
39+
use function serialize;
40+
41+
class AllSitesCommand extends Command
42+
{
43+
public const DESCRIPTION = 'Prints all Sites serialized and encoded. Internal CLI API.';
44+
public const IDENTIFIER = 'in2publish_core:status:allsites';
45+
46+
protected function configure(): void
47+
{
48+
$this->setDescription(self::DESCRIPTION)
49+
->setHidden(true);
50+
}
51+
52+
protected function execute(InputInterface $input, OutputInterface $output): int
53+
{
54+
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
55+
$sites = $siteFinder->getAllSites(false);
56+
$output->writeln('Sites: ' . base64_encode(serialize($sites)));
57+
return 0;
58+
}
59+
}

Classes/Command/Status/SiteConfigurationCommand.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,52 +30,59 @@
3030
*/
3131

3232
use In2code\In2publishCore\Command\Status\Exception\InvalidPageIdArgumentTypeException;
33-
use In2code\In2publishCore\Utility\ExtensionUtility;
3433
use Symfony\Component\Console\Command\Command;
3534
use Symfony\Component\Console\Input\InputArgument;
3635
use Symfony\Component\Console\Input\InputInterface;
3736
use Symfony\Component\Console\Output\OutputInterface;
37+
use TYPO3\CMS\Core\Exception\Page\PageNotFoundException;
3838
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
3939
use TYPO3\CMS\Core\Site\SiteFinder;
4040
use TYPO3\CMS\Core\Utility\GeneralUtility;
4141

42+
use TYPO3\CMS\Core\Utility\RootlineUtility;
43+
4244
use function base64_encode;
4345
use function serialize;
4446

4547
class SiteConfigurationCommand extends Command
4648
{
4749
public const ARG_PAGE_ID = 'pageId';
4850
public const ARG_PAGE_ID_DESCRIPTION = 'The page id to retrieve the site config for';
49-
public const DESCRIPTION = 'Prints the version number of the currently installed in2publish_core extension';
51+
public const DESCRIPTION = 'Outputs the requested Site serialized and encoded.';
5052
public const EXIT_NO_SITE = 250;
53+
public const EXIT_PAGE_HIDDEN_OR_DISCONNECTED = 251;
5154
public const IDENTIFIER = 'in2publish_core:status:siteconfiguration';
5255

53-
protected function configure()
56+
protected function configure(): void
5457
{
5558
$this->setDescription(self::DESCRIPTION)
5659
->addArgument(self::ARG_PAGE_ID, InputArgument::REQUIRED, self::ARG_PAGE_ID_DESCRIPTION)
5760
->setHidden(true);
5861
}
5962

60-
protected function initialize(InputInterface $input, OutputInterface $output)
63+
protected function initialize(InputInterface $input, OutputInterface $output): void
6164
{
6265
$pageId = $input->getArgument(self::ARG_PAGE_ID);
6366
if ($pageId !== (string)(int)$pageId) {
6467
throw InvalidPageIdArgumentTypeException::fromGivenPageId($pageId);
6568
}
6669
}
6770

68-
protected function execute(InputInterface $input, OutputInterface $output)
71+
protected function execute(InputInterface $input, OutputInterface $output): int
6972
{
7073
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
74+
$pageId = (int)$input->getArgument(self::ARG_PAGE_ID);
7175
try {
72-
$pageId = (int)$input->getArgument(self::ARG_PAGE_ID);
7376
$site = $siteFinder->getSiteByPageId($pageId);
7477
} catch (SiteNotFoundException $e) {
78+
try {
79+
GeneralUtility::makeInstance(RootlineUtility::class, $pageId, null)->get();
80+
} catch (PageNotFoundException $e) {
81+
return static::EXIT_PAGE_HIDDEN_OR_DISCONNECTED;
82+
}
7583
return static::EXIT_NO_SITE;
7684
}
7785
$output->writeln('Site: ' . base64_encode(serialize($site)));
78-
$output->writeln('Version: ' . ExtensionUtility::getExtensionVersion('in2publish_core'));
7986
return 0;
8087
}
8188
}

Classes/Config/Definer/In2publishCoreDefiner.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ public function getLocalDefinition()
241241
'debug',
242242
Builder::start()
243243
->addBoolean('disableParentRecords', false)
244-
->addBoolean('showForeignKeyFingerprint', false)
245244
->addBoolean('showRecordDepth', false)
246245
->addBoolean('showExecutionTime', true)
247246
->addBoolean('allInformation', false)

Classes/Config/Definer/SshConnectionDefiner.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public function getLocalDefinition()
6464
->addString('foreignKeyFingerprintHashingMethod', 'SSH2_FINGERPRINT_MD5')
6565
->addBoolean('ignoreChmodFail', false)
6666
)
67+
->addArray(
68+
'debug',
69+
Builder::start()
70+
->addBoolean('showForeignKeyFingerprint', false)
71+
)
6772
->end();
6873
}
6974

Classes/Controller/FrontendController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FrontendController extends AbstractController
4949
*/
5050
public function previewAction($identifier = 1)
5151
{
52-
$this->view->assign('local_preview', BackendUtility::buildPreviewUri('pages', $identifier, 'local'));
53-
$this->view->assign('foreign_preview', BackendUtility::buildPreviewUri('pages', $identifier, 'foreign'));
52+
$this->view->assign('local_preview', (string)BackendUtility::buildPreviewUri('pages', $identifier, 'local'));
53+
$this->view->assign('foreign_preview', (string)BackendUtility::buildPreviewUri('pages', $identifier, 'foreign'));
5454
}
5555
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace In2code\In2publishCore\Controller;
6+
7+
/*
8+
* Copyright notice
9+
*
10+
* (c) 2021 in2code.de and the following authors:
11+
* Oliver Eglseder <[email protected]>
12+
*
13+
* All rights reserved
14+
*
15+
* This script is part of the TYPO3 project. The TYPO3 project is
16+
* free software; you can redistribute it and/or modify
17+
* it under the terms of the GNU General Public License as published by
18+
* the Free Software Foundation; either version 3 of the License, or
19+
* (at your option) any later version.
20+
*
21+
* The GNU General Public License can be found at
22+
* http://www.gnu.org/copyleft/gpl.html.
23+
*
24+
* This script is distributed in the hope that it will be useful,
25+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
26+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+
* GNU General Public License for more details.
28+
*
29+
* This copyright notice MUST APPEAR in all copies of the script!
30+
*/
31+
32+
class RedirectController extends \In2code\In2publishCore\Features\RedirectsSupport\Controller\RedirectController
33+
{
34+
}

Classes/Domain/Factory/RecordFactory.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use In2code\In2publishCore\Service\Configuration\TcaService;
3939
use TYPO3\CMS\Core\Log\Logger;
4040
use TYPO3\CMS\Core\Log\LogManager;
41+
use TYPO3\CMS\Core\SingletonInterface;
4142
use TYPO3\CMS\Core\Utility\GeneralUtility;
4243
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
4344
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
@@ -59,7 +60,7 @@
5960
* records and any of the related records related records and so on to the extend
6061
* of the setting maximumRecursionDepth
6162
*/
62-
class RecordFactory
63+
class RecordFactory implements SingletonInterface
6364
{
6465
public const DEPRECATION_METHOD_NO_TABLE_ARG = 'Calling %s without tableName is deprecated. tableName will be a non-optional argument in in2publish_core version 10.';
6566

@@ -342,6 +343,13 @@ protected function findRelatedRecordsForContentRecord(
342343
$this->findTranslations($record, $commonRepository);
343344

344345
$record = $commonRepository->enrichRecordWithRelatedRecords($record, $excludedTableNames);
346+
347+
$this->signalSlotDispatcher->dispatch(
348+
RecordFactory::class,
349+
'addAdditionalRelatedRecords',
350+
[$record, $this]
351+
);
352+
345353
$this->relatedRecordsDepth--;
346354
}
347355
return $record;

Classes/Domain/Model/Record.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,17 @@ public function setDirtyProperties(): RecordInterface
502502
return $this;
503503
}
504504

505+
/**
506+
* @param RecordInterface $record
507+
* @return bool
508+
*/
509+
public function isTranslationOriginal(RecordInterface $record): bool
510+
{
511+
$tcaService = GeneralUtility::makeInstance(TcaService::class);
512+
$pointerField = $tcaService->getTransOrigPointerField($this->getTableName());
513+
return !empty($pointerField) && $record->getIdentifier() === $this->getMergedProperty($pointerField);
514+
}
515+
505516
/**
506517
* @param string $propertyName
507518
*
@@ -653,6 +664,7 @@ public function addRelatedRecord(RecordInterface $record)
653664
// beneath its new parent anyway.
654665
if (!($this->isPagesTable() && $record->isPagesTable())
655666
|| $record->getSuperordinatePageIdentifier() === $this->getIdentifier()
667+
|| $this->isTranslationOriginal($record)
656668
) {
657669
if (!$this->isParentDisabled) {
658670
$record->setParentRecord($this);

Classes/Domain/Repository/BaseRepository.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
use TYPO3\CMS\Core\Log\LogManager;
3939
use TYPO3\CMS\Core\Utility\GeneralUtility;
4040

41+
use TYPO3\CMS\Core\Utility\MathUtility;
42+
4143
use function array_column;
4244
use function array_combine;
4345
use function explode;
@@ -154,10 +156,20 @@ protected function findPropertiesByProperty(
154156
}
155157

156158
$query = $connection->createQueryBuilder();
159+
160+
if (is_array($propertyValue)) {
161+
foreach ($propertyValue as $idx => $value) {
162+
$propertyValue[$idx] = $query->getConnection()->quote($value);
163+
}
164+
$constraint = $query->expr()->in($propertyName, $propertyValue);
165+
} else {
166+
$constraint = $query->expr()->like($propertyName, $query->createNamedParameter($propertyValue));
167+
}
168+
157169
$query->getRestrictions()->removeAll();
158170
$query->select('*')
159171
->from($tableName)
160-
->where($query->expr()->like($propertyName, $query->createNamedParameter($propertyValue)));
172+
->where($constraint);
161173
if (!empty($additionalWhere)) {
162174
$query->andWhere($additionalWhere);
163175
}
@@ -184,10 +196,9 @@ protected function findPropertiesByProperty(
184196
$propertyArray[implode(',', $identifierArray)] = $row;
185197
}
186198
return $propertyArray;
187-
} else {
188-
foreach ($rows as $row) {
189-
$propertyArray[$row[$indexField]] = $row;
190-
}
199+
}
200+
foreach ($rows as $row) {
201+
$propertyArray[$row[$indexField]] = $row;
191202
}
192203

193204
return $propertyArray;
@@ -233,7 +244,11 @@ public function findPropertiesByProperties(
233244
}
234245

235246
foreach ($properties as $propertyName => $propertyValue) {
236-
$query->andWhere($query->expr()->like($propertyName, $query->createNamedParameter($propertyValue)));
247+
if (null === $propertyValue) {
248+
$query->andWhere($query->expr()->isNull($propertyName));
249+
} else {
250+
$query->andWhere($query->expr()->like($propertyName, $query->createNamedParameter($propertyValue)));
251+
}
237252
}
238253

239254
if (!empty($groupBy)) {

0 commit comments

Comments
 (0)