Skip to content

File tree

58 files changed

+1025
-215
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

+1025
-215
lines changed

Build/FunctionalTestsBootstrap.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?php
2-
3-
use TYPO3\TestingFramework\Core\Testbase;
4-
52
/*
63
* This file is part of the TYPO3 CMS project.
74
*

CHANGELOG.md

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

3+
11.0.3:
4+
5+
- [META] Set the EM conf version number to 11.0.3
6+
- [CLEANUP] Remove useless parentheses
7+
- [QA] Update QA tools
8+
- [BUGFIX] Set the correct return type for FileController::getRecordToPublish
9+
- [COMMENT] Update rFALd::getFoldersInFolder return annotation
10+
- [BUGFIX] Call the correct (renamed) method rebuildAll for TYPO3 v11
11+
- [COMMENT] Update the return annotation of findRedirectsByDynamicTarget
12+
- [BUGFIX] Ensure the rowCount is always an integer
13+
- [BUGFIX] Don't try to bulkInsert an empty data set
14+
- [REFACTOR] Reduce cyclomatic and npath complexity
15+
- [QA] Force installation of unsigned phars (like phpmd) and add all phars to PATH
16+
- [TESTS] Remove duplicate import of RuntimeException
17+
- [TESTS] Remove duplicate import of Testbase
18+
- [BUGFIX] Prevent infinite recursion when collecting records that are going to be published
19+
- [BUGFIX] Remove the HostNameValidator
20+
- [BUGFIX] Override database state if sys_file records have been changed
21+
- [BUGFIX] Early fail the UniqueStorageTargetTest when EXT:scheduler is not installed
22+
- [BUGFIX] Remove duplicate line which should have been removed
23+
- [BUGFIX] Prevent undefined array key access in DatabaseUtility
24+
- [BUGFIX] Set correct flash message severity when file publishing fails and show collected failures
25+
- [DOCS] Add UPGRADING for v10 to v11 and some publish files module screenshots
26+
- [TASK] Fix TestLabelLocalizer error
27+
- [BUGFIX] Add missing slash in combined folder identifier
28+
- [BUGFIX] Allow input fields with renderType inputLink
29+
- [BUGFIX] Do not exclude columns which have an itemsProcFunc
30+
- [BUGFIX] Do not ignore MM-records to excluded tables
31+
- [BUGFIX] Use the group MM tablenames field instead of true/false
32+
- [BUGFIX] Fix type error in FileEdgeCacheInvalidationService class
33+
- [BUGFIX] Fallback to the foreignUid if localUid is null
34+
- [BUGFIX] Add conditions to not break resetting backend user preferences
35+
- [BUGFIX] Update the list of required tables
36+
- [BUGFIX] Fetch all RPC rows instead of just the first
37+
- [BUGFIX] Allow envelopes to grow arbitrarily huge
38+
- [TESTS] Add missing ticket annotations for command tests
39+
- [TESTS] Add functional test to assert that MM records can be marked as publishing
40+
- [BUGFIX] Allow MM records to be marked as running
41+
- [BUGFIX] Make RunTasksInQueueCommand compatible with symfony/console 4.4 and add test
42+
- [TESTS] Fix tests for different dbal and TYPO3 versions
43+
- [TESTS] Mock Result class which exists in composerMinInstall
44+
- [TESTS] Fix DbConfigTestCommandTest, remove BackupCommandTest
45+
- [BUGFIX] Ensure all (testable) commands are executable
46+
347
11.0.2:
448

549
- **Everything included in the 10.2.3 release**
@@ -136,6 +180,36 @@
136180
- [CLEANUP] Remove outdated compatibility class SignalSlotReplacement
137181
- [!!!][UPDATE] Require TYPO3 v11
138182

183+
10.2.4:
184+
185+
- [META] Set the EM conf version number to 10.2.4
186+
- [BUGFIX] Prevent infinite recursion when collecting records that are going to be published
187+
- [BUGFIX] Remove the HostNameValidator
188+
- [BUGFIX] Override database state if sys_file records have been changed
189+
- [BUGFIX] Early fail the UniqueStorageTargetTest when EXT:scheduler is not installed
190+
- [BUGFIX] Remove duplicate line which should have been removed
191+
- [BUGFIX] Prevent undefined array key access in DatabaseUtility
192+
- [TASK] Fix TestLabelLocalizer error
193+
- [BUGFIX] Allow input fields with renderType inputLink
194+
- [BUGFIX] Do not exclude columns which have an itemsProcFunc
195+
- [BUGFIX] Do not ignore MM-records to excluded tables
196+
- [BUGFIX] Use the group MM tablenames field instead of true/false
197+
- [BUGFIX] Fix type error in FileEdgeCacheInvalidationService class
198+
- [BUGFIX] Fallback to the foreignUid if localUid is null
199+
- [BUGFIX] Add conditions to not break resetting backend user preferences
200+
- [BUGFIX] Update the list of required tables
201+
- [BUGFIX] Allow envelopes to grow arbitrarily huge
202+
- [TESTS] Add missing ticket annotations for command tests
203+
- [TESTS] Add functional test to assert that MM records can be marked as publishing
204+
- [BUGFIX] Allow MM records to be marked as running
205+
- [BUGFIX] Make RunTasksInQueueCommand compatible with symfony/console 4.4 and add test
206+
- [TESTS] Fix tests for different dbal and TYPO3 versions
207+
- [TESTS] Mock Result class which exists in composerMinInstall
208+
- [TESTS] Fix DbConfigTestCommandTest, remove BackupCommandTest
209+
- [BUGFIX] Ensure all (testable) commands are executable
210+
- [BUGFIX] Modify FAL folder identifier to work with most 3rd party drivers
211+
- [RELEASE] Version 10.2.3 with publishing indicator
212+
139213
10.2.3:
140214

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

Classes/Communication/RemoteProcedureCall/Envelope.php

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

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

3836
class Envelope
3937
{
4038
protected int $uid = 0;
4139

4240
protected string $command = '';
4341

44-
protected string $request = '';
42+
protected array $request = [];
4543

46-
protected string $response = '';
44+
/** @var mixed */
45+
protected $response = '';
4746

4847
/**
4948
* @param string $command
@@ -94,26 +93,26 @@ public function setCommand(string $command): void
9493
*/
9594
public function getRequest()
9695
{
97-
return unserialize($this->request);
96+
return $this->request;
9897
}
9998

10099
/**
101100
* @param mixed $request
102101
*/
103102
public function setRequest(array $request): void
104103
{
105-
if ('' !== $this->request) {
104+
if ([] !== $this->request) {
106105
throw new LogicException('Can not overrule an envelope\'s request', 1474386975);
107106
}
108-
$this->request = serialize($request);
107+
$this->request = $request;
109108
}
110109

111110
/**
112111
* @return mixed
113112
*/
114113
public function getResponse()
115114
{
116-
return unserialize($this->response);
115+
return $this->response;
117116
}
118117

119118
/**
@@ -124,7 +123,7 @@ public function setResponse($response): void
124123
if ('' !== $this->response) {
125124
throw new LogicException('Can not overrule an envelope\'s response', 1474386986);
126125
}
127-
$this->response = serialize($response);
126+
$this->response = $response;
128127
}
129128

130129
public function toArray(): array

Classes/Communication/RemoteProcedureCall/Letterbox.php

Lines changed: 91 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@
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
protected ContextService $contextService;
49-
5053
protected bool $keepEnvelopes;
5154

5255
public function __construct(ContextService $contextService, ConfigContainer $configContainer)
@@ -73,14 +76,9 @@ public function sendEnvelope(Envelope $envelope)
7376

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

76-
if (0 === $uid || 0 === $database->count('uid', static::TABLE, ['uid' => $uid])) {
79+
if (0 === $uid || 0 === $database->count('uid', 'tx_in2code_rpc_request', ['uid' => $uid])) {
7780
try {
78-
$database->insert(static::TABLE, $envelope->toArray());
79-
if ($uid <= 0) {
80-
$uid = (int)$database->lastInsertId();
81-
$envelope->setUid($uid);
82-
}
83-
return $uid;
81+
return $this->insertNewEnvelope($database, $envelope);
8482
} catch (Throwable $exception) {
8583
$this->logger->error(
8684
'Failed to send envelope [' . $uid . ']',
@@ -91,7 +89,7 @@ public function sendEnvelope(Envelope $envelope)
9189
}
9290

9391
try {
94-
$database->update(static::TABLE, $envelope->toArray(), ['uid' => $uid]);
92+
$this->updateEnvelope($database, $envelope, $uid);
9593
return true;
9694
} catch (Throwable $exception) {
9795
$this->logger->error(
@@ -124,23 +122,47 @@ public function receiveEnvelope(int $uid, bool $burnEnvelope = true)
124122

125123
$query = $database->createQueryBuilder();
126124
$query->getRestrictions()->removeAll();
127-
$query->select('command', 'request', 'response', 'uid')
128-
->from(static::TABLE)
125+
$query->select('req.uid', 'req.command', 'data.payload', 'data.data_type', 'data.sorting')
126+
->from('tx_in2code_rpc_request', 'req')
127+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
129128
->where($query->expr()->eq('uid', $uid))
130-
->setMaxResults(1);
129+
->orderBy('data.sorting');
131130
try {
132131
$result = $query->execute();
133-
$envelopeData = $result->fetchAssociative();
132+
$rows = $result->fetchAllAssociative();
134133
} catch (Throwable $exception) {
135134
$this->logger->error(
136135
'Failed to receive envelope [' . $uid . '] "' . $exception . '"',
137136
['exception' => $exception]
138137
);
139138
return false;
140139
}
141-
$envelope = Envelope::fromArray($envelopeData);
140+
141+
$uid = $rows[0]['uid'];
142+
$command = $rows[0]['command'];
143+
144+
$request = '';
145+
$response = null;
146+
foreach ($rows as $row) {
147+
if ('request' === $row['data_type']) {
148+
$request .= $row['payload'];
149+
}
150+
if ('response' === $row['data_type']) {
151+
if (null === $response) {
152+
$response = '';
153+
}
154+
$response .= $row['payload'];
155+
}
156+
}
157+
158+
if (is_string($response)) {
159+
$response = unserialize($response);
160+
}
161+
$envelope = new Envelope($command, unserialize($request), $response, $uid);
162+
142163
if (!$this->keepEnvelopes && $burnEnvelope) {
143-
$database->delete(static::TABLE, ['uid' => $uid]);
164+
$database->delete('tx_in2code_rpc_request', ['uid' => $uid]);
165+
$database->delete('tx_in2code_rpc_data', ['request' => $uid]);
144166
}
145167
return $envelope;
146168
}
@@ -156,7 +178,10 @@ public function hasUnAnsweredEnvelopes(): bool
156178
if ($database instanceof Connection && $database->isConnected()) {
157179
$query = $database->createQueryBuilder();
158180
$query->getRestrictions()->removeAll();
159-
$query->count('uid')->from(static::TABLE)->where($query->expr()->isNotNull('response'));
181+
$query->count('uid')
182+
->from('tx_in2code_rpc_request', 'req')
183+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
184+
->where($query->expr()->eq('data.data_type', $query->createNamedParameter('response')));
160185
return $query->execute()->fetchOne() > 0;
161186
}
162187
return false;
@@ -171,6 +196,53 @@ public function removeAnsweredEnvelopes(): void
171196
}
172197
$query = $database->createQueryBuilder();
173198
$query->getRestrictions()->removeAll();
174-
$query->delete(static::TABLE)->where($query->expr()->isNotNull('response'))->execute();
199+
$query->select('uid')
200+
->from('tx_in2code_rpc_request', 'req')
201+
->join('req', 'tx_in2code_rpc_data', 'data', 'req.uid = data.request')
202+
->where($query->expr()->eq('data.data_type', $query->createNamedParameter('response')));
203+
$uid = $query->execute()->fetchColumn();
204+
$database->delete('tx_in2code_rpc_request', ['uid' => $uid]);
205+
$database->delete('tx_in2code_rpc_data', ['request' => $uid]);
206+
}
207+
208+
protected function insertNewEnvelope(Connection $database, Envelope $envelope): int
209+
{
210+
$database->beginTransaction();
211+
212+
$database->insert('tx_in2code_rpc_request', [
213+
'command' => $envelope->getCommand(),
214+
]);
215+
$uid = (int)$database->lastInsertId();
216+
217+
$request = serialize($envelope->getRequest());
218+
$chunks = str_split($request, self::CHUNK_SIZE);
219+
foreach ($chunks as $sorting => $chunk) {
220+
$database->insert('tx_in2code_rpc_data', [
221+
'request' => $uid,
222+
'data_type' => 'request',
223+
'payload' => $chunk,
224+
'sorting' => $sorting,
225+
]);
226+
}
227+
228+
$database->commit();
229+
return $uid;
230+
}
231+
232+
protected function updateEnvelope(Connection $database, Envelope $envelope, int $uid): void
233+
{
234+
$database->beginTransaction();
235+
236+
$response = serialize($envelope->getResponse());
237+
$chunks = str_split($response, self::CHUNK_SIZE);
238+
foreach ($chunks as $sorting => $chunk) {
239+
$database->insert('tx_in2code_rpc_data', [
240+
'request' => $uid,
241+
'data_type' => 'response',
242+
'payload' => $chunk,
243+
'sorting' => $sorting,
244+
]);
245+
}
246+
$database->commit();
175247
}
176248
}

Classes/Component/FalHandling/Finder/DefaultFalFinder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
use function array_map;
5858
use function array_merge;
5959
use function array_values;
60+
use function ltrim;
6061
use function sprintf;
6162

6263
/**
@@ -498,7 +499,7 @@ protected function getFolderInfoByIdentifier(DriverInterface $driver, string $id
498499
if ($driver->folderExists($identifier)) {
499500
$info = $driver->getFolderInfoByIdentifier($identifier);
500501
$info['identifier'] = trim($info['identifier'], '/') . '/';
501-
$info['uid'] = sprintf('%d:%s', $info['storage'], $info['identifier']);
502+
$info['uid'] = sprintf('%d:/%s', $info['storage'], ltrim($info['identifier'], '/'));
502503
} else {
503504
$info = [];
504505
}

Classes/Component/FalHandling/Finder/Factory/FileIndexFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,15 @@ public function updateFileIndexInfo(
126126
string $foreignIdentifier
127127
): void {
128128
$uid = $record->getIdentifier();
129-
$record->addAdditionalProperty('recordDatabaseState', $record->getState());
130129
$localFileInfo = $this->getFileIndexArray($localIdentifier, 'local', $uid);
131130
$foreignFileInfo = $this->getFileIndexArray($foreignIdentifier, 'foreign', $uid);
131+
132+
$originalState = $record->getState();
133+
if (isset($localFileInfo['uid'], $foreignFileInfo['uid'])) {
134+
$originalState = RecordInterface::RECORD_STATE_CHANGED;
135+
}
136+
$record->addAdditionalProperty('recordDatabaseState', $originalState);
137+
132138
// only set new file info if the file exists at least on one side, else we only deal with the database record
133139
if (!empty($localFileInfo) || !empty($foreignFileInfo)) {
134140
$record->setLocalProperties($localFileInfo);

0 commit comments

Comments
 (0)