Skip to content

File tree

58 files changed

+843
-110
lines changed

Some content is hidden

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

58 files changed

+843
-110
lines changed

CHANGELOG.md

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

3+
10.2.4:
4+
5+
- [META] Set the EM conf version number to 10.2.4
6+
- [BUGFIX] Prevent infinite recursion when collecting records that are going to be published
7+
- [BUGFIX] Remove the HostNameValidator
8+
- [BUGFIX] Override database state if sys_file records have been changed
9+
- [BUGFIX] Early fail the UniqueStorageTargetTest when EXT:scheduler is not installed
10+
- [BUGFIX] Remove duplicate line which should have been removed
11+
- [BUGFIX] Prevent undefined array key access in DatabaseUtility
12+
- [TASK] Fix TestLabelLocalizer error
13+
- [BUGFIX] Allow input fields with renderType inputLink
14+
- [BUGFIX] Do not exclude columns which have an itemsProcFunc
15+
- [BUGFIX] Do not ignore MM-records to excluded tables
16+
- [BUGFIX] Use the group MM tablenames field instead of true/false
17+
- [BUGFIX] Fix type error in FileEdgeCacheInvalidationService class
18+
- [BUGFIX] Fallback to the foreignUid if localUid is null
19+
- [BUGFIX] Add conditions to not break resetting backend user preferences
20+
- [BUGFIX] Update the list of required tables
21+
- [BUGFIX] Allow envelopes to grow arbitrarily huge
22+
- [TESTS] Add missing ticket annotations for command tests
23+
- [TESTS] Add functional test to assert that MM records can be marked as publishing
24+
- [BUGFIX] Allow MM records to be marked as running
25+
- [BUGFIX] Make RunTasksInQueueCommand compatible with symfony/console 4.4 and add test
26+
- [TESTS] Fix tests for different dbal and TYPO3 versions
27+
- [TESTS] Mock Result class which exists in composerMinInstall
28+
- [TESTS] Fix DbConfigTestCommandTest, remove BackupCommandTest
29+
- [BUGFIX] Ensure all (testable) commands are executable
30+
- [BUGFIX] Modify FAL folder identifier to work with most 3rd party drivers
31+
- [RELEASE] Version 10.2.3 with publishing indicator
32+
333
10.2.3:
434

535
- [META] Set the EM conf version number to 10.2.3

Classes/Command/Foreign/RemoteProcedureCall/ExecuteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
112112
return static::EXIT_EXECUTION_FAILED;
113113
}
114114

115-
return Command::SUCCESS;
115+
return 0;
116116
}
117117
}

Classes/Command/Foreign/Status/AllCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5656
$this->cmdRegistry->getCommandByIdentifier(DbInitQueryEncodedCommand::IDENTIFIER)->execute($input, $output);
5757
$this->cmdRegistry->getCommandByIdentifier(ShortSiteConfigurationCommand::IDENTIFIER)->execute($input, $output);
5858
$this->cmdRegistry->getCommandByIdentifier(DbConfigTestCommand::IDENTIFIER)->execute($input, $output);
59-
return Command::SUCCESS;
59+
return 0;
6060
}
6161
}

Classes/Command/Foreign/Status/AllSitesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5454
{
5555
$sites = $this->siteFinder->getAllSites(false);
5656
$output->writeln('Sites: ' . base64_encode(serialize($sites)));
57-
return Command::SUCCESS;
57+
return 0;
5858
}
5959
}

Classes/Command/Foreign/Status/ConfigFormatTestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6666
$definition->validate($this->validationContainer, $actual);
6767
$errors = $this->validationContainer->getErrors();
6868
$output->writeln('Config Format Test: ' . base64_encode(json_encode(array_column($errors, 'configuration'))));
69-
return Command::SUCCESS;
69+
return 0;
7070
}
7171
}

Classes/Command/Foreign/Status/CreateMasksCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4141
{
4242
$output->writeln('FileCreateMask: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask']);
4343
$output->writeln('FolderCreateMask: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']);
44-
return Command::SUCCESS;
44+
return 0;
4545
}
4646
}

Classes/Command/Foreign/Status/DbConfigTestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6262
$queryBuilder->select('*')->from('tx_in2code_in2publish_task')->where($predicates);
6363
$result = $queryBuilder->execute()->fetchAll();
6464
$output->writeln('DB Config: ' . base64_encode(json_encode(array_column($result, 'configuration'))));
65-
return Command::SUCCESS;
65+
return 0;
6666
}
6767
}

Classes/Command/Foreign/Status/DbInitQueryEncodedCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4747
$dbInit = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['initCommands'];
4848
}
4949
$output->writeln('DBinit: ' . base64_encode(json_encode($dbInit)));
50-
return Command::SUCCESS;
50+
return 0;
5151
}
5252
}

Classes/Command/Foreign/Status/EncryptionKeyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ class EncryptionKeyCommand extends Command
4242
protected function execute(InputInterface $input, OutputInterface $output): int
4343
{
4444
$output->writeln('EKey: ' . base64_encode($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']));
45-
return Command::SUCCESS;
45+
return 0;
4646
}
4747
}

Classes/Command/Foreign/Status/GlobalConfigurationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4444
: $GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'];
4545
$output->writeln('Utf8Filesystem: ' . $utf8fileSystem);
4646
$output->writeln('adminOnly: ' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] ?? 'empty'));
47-
return Command::SUCCESS;
47+
return 0;
4848
}
4949
}

Classes/Command/Foreign/Status/ShortSiteConfigurationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6060
];
6161
}
6262
$output->writeln('ShortSiteConfig: ' . base64_encode(json_encode($shortInfo)));
63-
return Command::SUCCESS;
63+
return 0;
6464
}
6565
}

Classes/Command/Foreign/Status/SiteConfigurationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8787
return static::EXIT_NO_SITE;
8888
}
8989
$output->writeln('Site: ' . base64_encode(serialize($site)));
90-
return Command::SUCCESS;
90+
return 0;
9191
}
9292
}

Classes/Command/Foreign/Status/Typo3VersionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public function __construct(Typo3Version $typo3Version, string $name = null)
5050
protected function execute(InputInterface $input, OutputInterface $output): int
5151
{
5252
$output->writeln('TYPO3: ' . $this->typo3Version->getVersion());
53-
return Command::SUCCESS;
53+
return 0;
5454
}
5555
}

Classes/Command/Foreign/Status/VersionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ class VersionCommand extends Command
4141
protected function execute(InputInterface $input, OutputInterface $output): int
4242
{
4343
$output->writeln('Version: ' . ExtensionUtility::getExtensionVersion('in2publish_core'));
44-
return Command::SUCCESS;
44+
return 0;
4545
}
4646
}

Classes/Command/Local/Table/BackupCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6565
$tableName = $input->getArgument(self::ARG_TABLE_NAME);
6666
$this->logger->notice('Called Backup Table Command for table "' . $tableName . '"');
6767
DatabaseUtility::backupTable($this->localDatabase, $tableName);
68-
return Command::SUCCESS;
68+
return 0;
6969
}
7070
}

Classes/Command/Local/Table/ImportCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
124124
$errOutput->writeln(sprintf('Could not truncate local table "%s". Skipping import', $tableName));
125125
}
126126

127-
return Command::SUCCESS;
127+
return 0;
128128
}
129129
}

Classes/Command/Local/Table/PublishCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
145145
$errOutput->writeln(sprintf('Could not truncate foreign table "%s". Skipping import', $tableName));
146146
}
147147

148-
return Command::SUCCESS;
148+
return 0;
149149
}
150150
}

Classes/Command/Tools/TestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
}
104104

105105
$output->writeln('All tests passed', OutputInterface::VERBOSITY_VERBOSE);
106-
return Command::SUCCESS;
106+
return 0;
107107
}
108108
}

Classes/Communication/RemoteProcedureCall/Envelope.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
use LogicException;
3333

3434
use function array_filter;
35-
use function serialize;
36-
use function unserialize;
3735

3836
class Envelope
3937
{
@@ -94,7 +92,7 @@ public function setCommand(string $command): void
9492
*/
9593
public function getRequest()
9694
{
97-
return unserialize($this->request);
95+
return $this->request;
9896
}
9997

10098
/**
@@ -105,15 +103,15 @@ public function setRequest(array $request): void
105103
if ('' !== $this->request) {
106104
throw new LogicException('Can not overrule an envelope\'s request', 1474386975);
107105
}
108-
$this->request = serialize($request);
106+
$this->request = $request;
109107
}
110108

111109
/**
112110
* @return mixed
113111
*/
114112
public function getResponse()
115113
{
116-
return unserialize($this->response);
114+
return $this->response;
117115
}
118116

119117
/**
@@ -124,7 +122,7 @@ public function setResponse($response): void
124122
if ('' !== $this->response) {
125123
throw new LogicException('Can not overrule an envelope\'s response', 1474386986);
126124
}
127-
$this->response = serialize($response);
125+
$this->response = $response;
128126
}
129127

130128
public function toArray(): array

Classes/Communication/RemoteProcedureCall/Letterbox.php

Lines changed: 80 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@
3939
use TYPO3\CMS\Core\Database\Connection;
4040
use TYPO3\CMS\Core\SingletonInterface;
4141

42+
use function is_string;
43+
use function serialize;
44+
use function str_split;
45+
use function unserialize;
46+
4247
class Letterbox implements LoggerAwareInterface, SingletonInterface
4348
{
4449
use LoggerAwareTrait;
4550

46-
public const TABLE = 'tx_in2code_in2publish_envelope';
47-
51+
protected const CHUNK_SIZE = 65000;
4852
/** @var ContextService */
4953
protected $contextService;
50-
5154
/** @var bool */
5255
protected $keepEnvelopes;
5356

@@ -74,13 +77,28 @@ public function sendEnvelope(Envelope $envelope)
7477

7578
$uid = $envelope->getUid();
7679

77-
if (0 === $uid || 0 === $database->count('uid', static::TABLE, ['uid' => $uid])) {
80+
if (0 === $uid || 0 === $database->count('uid', 'tx_in2code_rpc_request', ['uid' => $uid])) {
7881
try {
79-
$database->insert(static::TABLE, $envelope->toArray());
80-
if ($uid <= 0) {
81-
$uid = (int)$database->lastInsertId();
82-
$envelope->setUid($uid);
82+
$database->beginTransaction();
83+
84+
$database->insert('tx_in2code_rpc_request', [
85+
'command' => $envelope->getCommand(),
86+
]);
87+
$uid = (int)$database->lastInsertId();
88+
89+
$request = serialize($envelope->getRequest());
90+
$chunks = str_split($request, self::CHUNK_SIZE);
91+
foreach ($chunks as $sorting => $chunk) {
92+
$database->insert('tx_in2code_rpc_data', [
93+
'request' => $uid,
94+
'data_type' => 'request',
95+
'payload' => $chunk,
96+
'sorting' => $sorting,
97+
]);
8398
}
99+
100+
$database->commit();
101+
84102
return $uid;
85103
} catch (Throwable $exception) {
86104
$this->logger->error(
@@ -92,7 +110,19 @@ public function sendEnvelope(Envelope $envelope)
92110
}
93111

94112
try {
95-
$database->update(static::TABLE, $envelope->toArray(), ['uid' => $uid]);
113+
$database->beginTransaction();
114+
115+
$response = serialize($envelope->getResponse());
116+
$chunks = str_split($response, self::CHUNK_SIZE);
117+
foreach ($chunks as $sorting => $chunk) {
118+
$database->insert('tx_in2code_rpc_data', [
119+
'request' => $uid,
120+
'data_type' => 'response',
121+
'payload' => $chunk,
122+
'sorting' => $sorting,
123+
]);
124+
}
125+
$database->commit();
96126
return true;
97127
} catch (Throwable $exception) {
98128
$this->logger->error(
@@ -123,23 +153,47 @@ public function receiveEnvelope(int $uid, bool $burnEnvelope = true)
123153

124154
$query = $database->createQueryBuilder();
125155
$query->getRestrictions()->removeAll();
126-
$query->select('command', 'request', 'response', 'uid')
127-
->from(static::TABLE)
156+
$query->select('req.uid', 'req.command', 'data.payload', 'data.data_type', 'data.sorting')
157+
->from('tx_in2code_rpc_request', 'req')
158+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
128159
->where($query->expr()->eq('uid', $uid))
129-
->setMaxResults(1);
160+
->orderBy('data.sorting');
130161
try {
131162
$result = $query->execute();
132-
$envelopeData = $result->fetch();
163+
$rows = $result->fetchAll();
133164
} catch (Throwable $exception) {
134165
$this->logger->error(
135166
'Failed to receive envelope [' . $uid . '] "' . $exception . '"',
136167
['exception' => $exception]
137168
);
138169
return false;
139170
}
140-
$envelope = Envelope::fromArray($envelopeData);
171+
172+
$uid = $rows[0]['uid'];
173+
$command = $rows[0]['command'];
174+
175+
$request = '';
176+
$response = null;
177+
foreach ($rows as $row) {
178+
if ('request' === $row['data_type']) {
179+
$request .= $row['payload'];
180+
}
181+
if ('response' === $row['data_type']) {
182+
if (null === $response) {
183+
$response = '';
184+
}
185+
$response .= $row['payload'];
186+
}
187+
}
188+
189+
if (is_string($response)) {
190+
$response = unserialize($response);
191+
}
192+
$envelope = new Envelope($command, unserialize($request), $response, $uid);
193+
141194
if (!$this->keepEnvelopes && $burnEnvelope) {
142-
$database->delete(static::TABLE, ['uid' => $uid]);
195+
$database->delete('tx_in2code_rpc_request', ['uid' => $uid]);
196+
$database->delete('tx_in2code_rpc_data', ['request' => $uid]);
143197
}
144198
return $envelope;
145199
}
@@ -155,7 +209,10 @@ public function hasUnAnsweredEnvelopes(): bool
155209
if ($database instanceof Connection && $database->isConnected()) {
156210
$query = $database->createQueryBuilder();
157211
$query->getRestrictions()->removeAll();
158-
$query->count('uid')->from(static::TABLE)->where($query->expr()->isNotNull('response'));
212+
$query->count('uid')
213+
->from('tx_in2code_rpc_request', 'req')
214+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
215+
->where($query->expr()->eq('data.data_type', $query->createNamedParameter('response')));
159216
return $query->execute()->fetchColumn() > 0;
160217
}
161218
return false;
@@ -170,6 +227,12 @@ public function removeAnsweredEnvelopes(): void
170227
}
171228
$query = $database->createQueryBuilder();
172229
$query->getRestrictions()->removeAll();
173-
$query->delete(static::TABLE)->where($query->expr()->isNotNull('response'))->execute();
230+
$query->select('uid')
231+
->from('tx_in2code_rpc_request', 'req')
232+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
233+
->where($query->expr()->eq('data.data_type', $query->createNamedParameter('response')));
234+
$uid = $query->execute()->fetchColumn();
235+
$database->delete('tx_in2code_rpc_request', ['uid' => $uid]);
236+
$database->delete('tx_in2code_rpc_data', ['request' => $uid]);
174237
}
175238
}

Classes/Component/PostPublishTaskExecution/Command/Foreign/RunTasksInQueueCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7979
$result[] = 'There was nothing to execute';
8080
}
8181
$output->write(json_encode($result));
82-
return Command::SUCCESS;
82+
return 0;
8383
}
8484
}

0 commit comments

Comments
 (0)