Skip to content

Commit

Permalink
[TASK] updates DataHandler override to be compatible with TYPO3 v13.4.5
Browse files Browse the repository at this point in the history
[TASK] updates required-dev packages and composer scripts
[CLEANUP] updates SequenceService to use new TYPO3 v13.4 API
[CLEANUP] switch to new version schema
  • Loading branch information
EvilBMP committed Feb 28, 2025
1 parent 7364d48 commit 514efd4
Show file tree
Hide file tree
Showing 8 changed files with 329 additions and 342 deletions.
5 changes: 1 addition & 4 deletions Build/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
includes:
- ../.Build/vendor/phpstan/phpstan-strict-rules/rules.neon
- ../.Build/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- ../.Build/vendor/friendsoftypo3/phpstan-typo3/extension.neon
- ../.Build/vendor/spaze/phpstan-disallowed-calls/extension.neon
- ../.Build/vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- ../.Build/vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
Expand All @@ -20,9 +19,6 @@ parameters:
analyse:
- ../Classes/DataHandling

# Allow instanceof checks, particularly in tests
checkAlwaysTrueCheckTypeFunctionCall: false

type_coverage:
return: 98
param: 98
Expand All @@ -43,6 +39,7 @@ parameters:
-
function: 'header()'
message: 'Use PSR-7 API instead'

disallowedStaticCalls:
-
method:
Expand Down
39 changes: 39 additions & 0 deletions Build/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\ValueObject\PhpVersion;
use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector;
use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
use Ssch\TYPO3Rector\Set\Typo3SetList;

return RectorConfig::configure()
->withPaths([
dirname(__DIR__) . '/Classes',
])
//->withPhpSets()
// uncomment to reach your current PHP version
->withPhpVersion(PhpVersion::PHP_83)
->withSets([
Typo3SetList::CODE_QUALITY,
Typo3SetList::GENERAL,
Typo3LevelSetList::UP_TO_TYPO3_13,
])
// To have a better analysis from PHPStan, we teach it here some more things
->withPHPStanConfigs([
Typo3Option::PHPSTAN_FOR_RECTOR_PATH,
])
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
ConvertImplicitVariablesToExplicitGlobalsRector::class,
])
->withConfiguredRule(ExtEmConfRector::class, [
ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.4.99',
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.5-13.4.99',
ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [],
])
;
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# PxDbsequencer Changelog

13.1.0 - 2025-02-28
-------------------
* [TASK] updates DataHandler override to be compatible with TYPO3 v13.4.5
* [TASK] updates required-dev packages and composer scripts
* [CLEANUP] updates SequenceService to use new TYPO3 v13.4 API
* [CLEANUP] switch to new version schema

0.13.0 - 2024-10-15
-------------------
* [TASK] updates phpstan config and updates/ adapts several classes accordingly
Expand Down
562 changes: 248 additions & 314 deletions Classes/DataHandling/DataHandler.php

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions Classes/Service/SequencerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Portrino\PxDbsequencer\Service;

use Doctrine\DBAL\Driver\Exception;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -39,12 +40,18 @@ class SequencerService
*/
private ConnectionPool $connectionPool;

/**
* @var Context
*/
private Context $context;

/**
* SequencerService constructor.
*/
public function __construct()
{
$this->connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$this->context = GeneralUtility::makeInstance(Context::class);
}

/**
Expand Down Expand Up @@ -79,7 +86,10 @@ public function getDefaultStart(): int
public function getNextIdForTable(string $table, int $depth = 0): int
{
if ($depth > 10) {
throw new \RuntimeException('The sequencer cannot return IDs for this table -' . $table . ' Too many recursions - maybe to much load?');
throw new \RuntimeException(
'The sequencer cannot return IDs for this table -' . $table . ' Too many recursions - maybe to much load?',
1740753828
);
}

/** @var QueryBuilder $queryBuilder */
Expand All @@ -104,7 +114,7 @@ public function getNextIdForTable(string $table, int $depth = 0): int

$fieldValues = [
'current' => $row['current'],
'timestamp' => $GLOBALS['EXEC_TIME'],
'timestamp' => $this->context->getPropertyFromAspect('date', 'timestamp'),
];

$this->connectionPool->getConnectionForTable($this->sequenceTable)->update(
Expand Down Expand Up @@ -133,7 +143,7 @@ private function initSequencerForTable(string $table): void
'table_name' => $table,
'current' => $start,
'offset' => $this->defaultOffset,
'timestamp' => $GLOBALS['EXEC_TIME'],
'timestamp' => $this->context->getPropertyFromAspect('date', 'timestamp'),
];

$databaseConnectionForPages = $this->connectionPool->getConnectionForTable($this->sequenceTable);
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ switch ($applicationContext[0]) {
## 3 Compatibility

| PxDbsequencer | TYPO3 | PHP | Support / Development |
|---------------|-------|-----------|--------------------------------------|
| 0.13.x | 13.4 | 8.2 - 8.3 | features, bugfixes, security updates |
| 0.12.x | 12.4 | 8.1 - 8.2 | features, bugfixes, security updates |
| 0.11.x | 11.5 | 7.4 - 8.1 | bugfixes, security updates |
| 0.10.x | 10.4 | 7.2 - 7.4 | none |
| 0.9.x | 9.5 | 7.2 - 7.4 | none |
| 0.7.x | 8.7 | 7.0 - 7.4 | none |
| 0.6.x | 7.6 | 5.5 - 7.3 | none |
|-----------|-------|-----------|--------------------------------------|
| 13.x | 13.4 | 8.2 - 8.3 | features, bugfixes, security updates |
| 12.x | 12.4 | 8.1 - 8.2 | features, bugfixes, security updates |
| 11.x | 11.5 | 7.4 - 8.1 | bugfixes, security updates |
| 10.x | 10.4 | 7.2 - 7.4 | none |
| 9.x | 9.5 | 7.2 - 7.4 | none |
| 0.7.x | 8.7 | 7.0 - 7.4 | none |
| 0.6.x | 7.6 | 5.5 - 7.3 | none |

## 4 Authors

Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
},
"require": {
"php": "^8.2",
"typo3/cms-backend": "^13.4"
"typo3/cms-backend": "^13.4.5"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.44",
"friendsofphp/php-cs-fixer": "^3.64",
"friendsoftypo3/phpstan-typo3": "^0.9",
"helmich/typo3-typoscript-lint": "^3.1",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-strict-rules": "^1.6",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"seld/jsonlint": "^1.11",
"spaze/phpstan-disallowed-calls": "^3.5",
"tomasvotruba/cognitive-complexity": "^0.2.3",
"tomasvotruba/type-coverage": "^0.3.1",
"spaze/phpstan-disallowed-calls": "^4.0",
"ssch/typo3-rector": "^3.0",
"tomasvotruba/cognitive-complexity": "^1.0",
"tomasvotruba/type-coverage": "^2.0",
"typo3/coding-standards": "^0.8"
},
"replace": {
Expand Down Expand Up @@ -84,17 +84,17 @@
"ci:php": [
"@ci:php:cs-fixer",
"@ci:php:lint",
"@ci:php:rector",
"@ci:php:stan"
],
"ci:php:cs-fixer": "./.Build/bin/php-cs-fixer fix --config ./Build/php-cs-fixer.php -v --dry-run --using-cache no --diff",
"ci:php:lint": "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -r -0 -n 1 -P 4 php -l",
"ci:php:rector": "./.Build/bin/rector process --ansi --config ./Build/rector.php --dry-run --no-progress-bar",
"ci:php:stan": "./.Build/bin/phpstan analyse -c ./Build/phpstan.neon --no-progress",
"ci:static": [
"@ci:composer:normalize",
"@ci:json:lint",
"@ci:php:cs-fixer",
"@ci:php:lint",
"@ci:php:stan",
"@ci:php",
"@ci:ts:lint",
"@ci:yaml:lint"
],
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '0.13.0',
'version' => '13.1.0',
'constraints' => [
'depends' => [
'typo3' => '13.4.0-13.99.99',
'typo3' => '13.4.5-13.4.99',
],
'conflicts' => [
],
Expand Down

0 comments on commit 514efd4

Please sign in to comment.