Skip to content

Commit

Permalink
[RELEASE] Version 11.0.2 with Site marker replacement and FAL driver …
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexvaar committed May 17, 2022
2 parents 1f46984 + ed0c1ff commit 927ff6f
Show file tree
Hide file tree
Showing 84 changed files with 1,483 additions and 462 deletions.
2 changes: 2 additions & 0 deletions Build/FunctionalTestsBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\TestingFramework\Core\Testbase;

call_user_func(function () {
if (!getenv('IN2PUBLISH_CONTEXT')) {
putenv('IN2PUBLISH_CONTEXT=Local');
Expand Down
6 changes: 5 additions & 1 deletion Build/UnitTestsBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@
'boot.state' => $bootState,
]);

$container = $builder->createDependencyInjectionContainer($packageManager, $dependencyInjectionContainerCache, false);
$container = $builder->createDependencyInjectionContainer(
$packageManager,
$dependencyInjectionContainerCache,
false
);

// Push the container to GeneralUtility as we want to make sure its
// makeInstance() method creates classes using the container from now on.
Expand Down
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# In2publish Core Change Log

11.0.2:

- **Everything included in the 10.2.3 release**
- [BUGFIX] Modify FAL folder identifier to work with most 3rd party drivers
- [BUGFIX] Replace deprecated FILTER_SANITIZE_STRING option from filter_var with htmlspecialchars
- [BUGFIX] Hide publish file/redirect button if the record is being published
- [BUGFIX] Resolve doctrine/dbal deprecations
- [BUGFIX] Implement missing replacement for SITE markers in TCA
- [REFACTOR] Inject a DB connection in ReplaceMarkersService to get rid of static calls
- [TASK] Apply review feedback
- [BUGFIX] Add missing SiteFinder use statement
- [TASK] Also replace SITE: markers in FlexForms
- [TASK] Add test for replaceSiteMarker functionality
- [BUGFIX] Adjust test cases for ReplaceMarkersService to match new constructor
- [FEATURE] Implement replacement of SITE: markers in TCA
- [RELEASE] Version 11.0.1 with minor bug fixes

11.0.1:

- [META] Set the EM conf version number to 11.0.1
Expand Down Expand Up @@ -119,6 +136,54 @@
- [CLEANUP] Remove outdated compatibility class SignalSlotReplacement
- [!!!][UPDATE] Require TYPO3 v11

10.2.3:

- [META] Set the EM conf version number to 10.2.3
- [BUGFIX] Correctly indent other icons in the changed content area
- [CODESTYLE] Fix indent and line length issues
- [DOCS] Add missing Event descriptions, reformat all files
- [CODESTYLE] Fix all CS issues in the Tests folder
- [BUGFIX] Add explanation to the failing TableGarbageCollectorTest result
- [CLEANUP] Remove unnecessary string concatenation from BackendUtilityTest
- [REFACTOR] Replace classes for constant access with the class that defines the constant
- [COMMENT] Add copyright blocks to new RunningRequest classes
- [BUGFIX] Deny publishing of a record that is being published, show the process in the View
- [BUGFIX] Mark all records as being published when bulk-publishing
- [BUGFIX] Write all records recursively to the running requests table
- [BUGFIX] Ensure all links in the publish overview mod in yellow rows are black
- [BUGFIX] Use a static property, because ViewHelper Singletons don't work
- [BUGFIX] Only check for publishing processes running in other processes
- [BUGFIX] Remove condition around garbage collector configuration
- [BUGFIX] Use count instead of select to count scheduler task rowsrows
- [FEATURE] Add RegisterViewHelper to set variables in templates that survive scope popping
- [BUGFIX] Move closing quote to the line it belongs
- [BUGFIX] Show the publish loader if redirects are publishing
- [BUGFIX] Use a random token to identify a request instead of the BE user token
- [BUGFIX] Set Records as not publishable if they are already publishing
- [BUGFIX] Replace publishing finished event with shutdown function
- [BUGFIX] Position the publish link instead of just the icon, show publishing records
- [FEATURE] Add Record::isPublishing to determine if a record is currently being published
- [CODESTYLE] Remove blank lines
- [BUGFIX] Fix label for missing garbage collector task
- [TASK] Add a publish tools test checking the existence of a garbage collector task for table tx_in2publishcore_running_request
- [REFACTOR] Move denial of publishing of running request from record to PublishingRequestIsRunningVoter
- [TASK] Do not show publish button if a request is running for publishing of record
- [BUGFIX] Fallback to the foreign property when identifying files
- [BUGFIX] Support doctrine/dbal < 2.11 again
- [BUGFIX] Replace what used to be fetchOne with fetchColumn
- [BUGFIX] Fix non-existing statement method calls in non-composer mode setups
- [BUGFIX] Fix array keys that are used in PHP 8 when using call_user_func_array
- [BUGFIX] Check if a TCA column MM key is set before accessing it
- [BUGFIX] Respect the actual sortby field from the TCA to detect if records were moved
- [BUGFIX] Skip FlexForm select fields without a foreign table
- [BUGFIX] Check if a key exists in the TCA instead of relying on unset key behavior
- [BUGFIX] Prevent undefined index access in DefaultRecordFinder
- [META] Replace extension/module icons
- [BUGFIX] Always preprend the eventListener for the publishing confirmation
- [BUGFIX] Set start depth to 1 for the SimplifiedOverviewAndPublishing root record
- [BUGFIX] Respect record language when attaching pages to parents
- [RELEASE] Version 10.2.2 with minor bug fixes

10.2.2:

- [META] Set the EM conf version number to 10.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@

use function array_values;
use function explode;
use function filter_var;
use function htmlspecialchars;
use function implode;
use function is_array;
use function is_string;

use const FILTER_FLAG_NO_ENCODE_QUOTES;
use const FILTER_FLAG_STRIP_HIGH;
use const FILTER_FLAG_STRIP_LOW;
use const FILTER_SANITIZE_STRING;
use const ENT_NOQUOTES;
use const PHP_EOL;

class RemoteCommandResponse
Expand Down Expand Up @@ -134,11 +131,7 @@ protected function convertAndSanitizeResponse($response): array
}
$sanitized = [];
foreach ($response as $row => $string) {
$sanitized[$row] = filter_var(
$string,
FILTER_SANITIZE_STRING,
FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_NO_ENCODE_QUOTES
);
$sanitized[$row] = htmlspecialchars($string, ENT_NOQUOTES);
}
return $sanitized;
}
Expand Down
3 changes: 2 additions & 1 deletion Classes/Component/FalHandling/Finder/DefaultFalFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ protected function getFolderInfoByIdentifier(DriverInterface $driver, string $id
{
if ($driver->folderExists($identifier)) {
$info = $driver->getFolderInfoByIdentifier($identifier);
$info['identifier'] = trim($info['identifier'], '/') . '/';
$info['uid'] = sprintf('%d:%s', $info['storage'], $info['identifier']);
} else {
$info = [];
Expand Down Expand Up @@ -811,7 +812,7 @@ protected function moveSameSysFileRecordsToRelatedRecords(array $files): array
/** @var RecordInterface[] $fileRecords */
$fileRecords = [];
foreach ($files as $idx => $file) {
$localIdentifier = $file->getLocalProperty('identifier');
$localIdentifier = $file->getLocalProperty('identifier') ?? $file->getForeignProperty('identifier');
if (isset($fileRecords[$localIdentifier])) {
$fileRecords[$localIdentifier]->addRelatedRecord($file);
unset($files[$idx]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function getFileIndexArray(string $identifier, string $side, int $uid = 0
*/
protected function determineFileType(array $fileInfo): int
{
[$fileType] = explode('/', $fileInfo['mime_type']);
[$fileType] = explode('/', $fileInfo['mime_type'] ?? '');
switch (strtolower($fileType)) {
case 'text':
$type = AbstractFile::FILETYPE_TEXT;
Expand Down
15 changes: 11 additions & 4 deletions Classes/Component/RecordHandling/DefaultRecordFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,15 @@ protected function convertPropertyArraysToRecords(
}
}
}
if (!$this->isIgnoredRecord((array)$localProperties[$key], (array)$foreignProperties[$key], $tableName)) {

$localPropertiesArray = (array)($localProperties[$key] ?? []);
$foreignPropertiesArray = (array)($foreignProperties[$key] ?? []);

if (!$this->isIgnoredRecord($localPropertiesArray, $foreignPropertiesArray, $tableName)) {
$foundRecords[$key] = $this->recordFactory->makeInstance(
$this,
(array)$localProperties[$key],
(array)$foreignProperties[$key],
$localPropertiesArray,
$foreignPropertiesArray,
[],
$tableName,
'uid',
Expand Down Expand Up @@ -1061,6 +1065,9 @@ protected function getRecordsByFlexFormRelation(
$recordId = $record->getIdentifier();
switch ($config['type']) {
case 'select':
if (empty($config['foreign_table'])) {
break;
}
$whereClause = '';
if (!empty($config['foreign_table_where'])) {
$whereClause = $config['foreign_table_where'];
Expand Down Expand Up @@ -1170,7 +1177,7 @@ protected function fetchRelatedRecordsByGroupTypeDb(
}
}
foreach ($identifierToTableMap as $tableName => $identifiers) {
if ($columnConfiguration['MM']) {
if (!empty($columnConfiguration['MM'])) {
$this->logger->alert(
'Missing implementation: GROUP MM',
[
Expand Down
11 changes: 9 additions & 2 deletions Classes/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@
use function count;
use function dirname;
use function json_encode;
use function ltrim;
use function explode;
use function is_string;
use function reset;
use function strlen;
use function strpos;
use function trim;

/**
* The FileController is responsible for the "Publish Files" Backend module "m2"
Expand Down Expand Up @@ -172,7 +175,7 @@ public function publishFileAction(int $uid, string $identifier, int $storage, bo
[$identifier] = GeneralUtility::trimExplode(',', $identifier);
}

$record = $this->tryToGetFolderInstance($storage . ':/' . ltrim(dirname($identifier), '/'));
$record = $this->tryToGetFolderInstance($storage . ':' . dirname($identifier));

if (null !== $record) {
$relatedRecords = $record->getRelatedRecordByTableAndProperty('sys_file', 'identifier', $identifier);
Expand Down Expand Up @@ -233,6 +236,10 @@ public function toggleFilterStatusAction(string $filter): ResponseInterface
*/
protected function tryToGetFolderInstance(?string $identifier): ?RecordInterface
{
if (is_string($identifier) && strpos($identifier, ':') < strlen($identifier)) {
[$storage, $name] = explode(':', $identifier);
$identifier = $storage . ':' . trim($name, '/') . '/';
}
try {
$record = $this->falFinder->findFalRecord($identifier);
} catch (TooManyFilesException $exception) {
Expand Down
8 changes: 3 additions & 5 deletions Classes/Domain/Driver/RemoteFileAbstractionLayerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ public function getFolderInfoByIdentifier($folderIdentifier): array
* @psalm-return array{identifier: string, name: string, storage: int}
*/
function () use ($folderIdentifier): array {
$folderIdentifier = $this->canonicalizeAndCheckFolderIdentifier($folderIdentifier);

if (!$this->folderExists($folderIdentifier)) {
throw new FolderDoesNotExistException(
'Folder "' . $folderIdentifier . '" does not exist.',
Expand Down Expand Up @@ -664,9 +662,9 @@ public function createFolder($newFolderName, $parentFolderIdentifier = '', $recu
EnvelopeDispatcher::CMD_CREATE_FOLDER,
[
'storage' => $this->storageUid,
'$newFolderName' => $newFolderName,
'$parentFolderIdentifier' => $parentFolderIdentifier,
'$recursive' => $recursive,
'newFolderName' => $newFolderName,
'parentFolderIdentifier' => $parentFolderIdentifier,
'recursive' => $recursive,
]
)
);
Expand Down
5 changes: 4 additions & 1 deletion Classes/Domain/Factory/RecordFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ protected function detectAndAlterMovedInstance(
} elseif (!empty($localProperties['pid']) && !empty($foreignProperties['pid'])) {
if ($localProperties['pid'] !== $foreignProperties['pid']) {
$hasBeenMoved = true;
} elseif ($localProperties['sorting'] !== $foreignProperties['sorting']) {
} elseif (
($sortField = ($GLOBALS['TCA'][$tableName]['ctrl']['sortby'] ?? null))
&& ($localProperties[$sortField] ?? null) !== ($foreignProperties[$sortField] ?? null)
) {
$hasBeenMoved = true;
}
}
Expand Down
13 changes: 13 additions & 0 deletions Classes/Domain/Model/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/

use In2code\In2publishCore\Config\ConfigContainer;
use In2code\In2publishCore\Event\DetermineIfRecordIsPublishing;
use In2code\In2publishCore\Event\VoteIfRecordIsPublishable;
use In2code\In2publishCore\Service\Configuration\TcaService;
use In2code\In2publishCore\Service\Permission\PermissionService;
Expand Down Expand Up @@ -1120,6 +1121,10 @@ public function isPublishable(): bool
if (!$this->isChangedRecursive()) {
return false;
}
if ($this->isPublishing()) {
return false;
}

$permissionService = GeneralUtility::makeInstance(PermissionService::class);
if (!$permissionService->isUserAllowedToPublish()) {
return false;
Expand All @@ -1130,6 +1135,14 @@ public function isPublishable(): bool
return $event->getVotingResult();
}

public function isPublishing(): bool
{
$eventDispatcher = GeneralUtility::makeInstance(EventDispatcher::class);
$event = new DetermineIfRecordIsPublishing($this->tableName, $this->getIdentifier());
$eventDispatcher->dispatch($event);
return $event->isPublishing();
}

public function isRemovedFromLocalDatabase(): bool
{
return $this->isForeignRecordDeleted() && !$this->isRecordRepresentByProperties($this->localProperties);
Expand Down
2 changes: 2 additions & 0 deletions Classes/Domain/Model/RecordInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,7 @@ public function getRecordLanguage(): int;

public function isPublishable(): bool;

public function isPublishing(): bool;

public function isRemovedFromLocalDatabase(): bool;
}
Loading

0 comments on commit 927ff6f

Please sign in to comment.