Skip to content

Commit

Permalink
Remove v12 upgrade findings
Browse files Browse the repository at this point in the history
Ignore false positives for extension scanner.
Migrate TCA and keep old v11 within condition for backwards
compatibility.

Relates: #110
  • Loading branch information
DanielSiepmann committed May 11, 2023
1 parent 38a2be2 commit 19b7fff
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 15 deletions.
1 change: 1 addition & 0 deletions Classes/Domain/Repository/Pageview.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private function getFieldsFromModel(Model $pageview): array
'crdate' => $pageview->getCrdate()->format('U'),
'tstamp' => $pageview->getCrdate()->format('U'),
'type' => $pageview->getPageType(),
// @extensionScannerIgnoreLine
'sys_language_uid' => $pageview->getLanguage()->getLanguageId(),
'url' => $pageview->getUrl(),
'user_agent' => $pageview->getUserAgent(),
Expand Down
1 change: 1 addition & 0 deletions Classes/Domain/Repository/Recordview.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private function getFieldsFromModel(Model $recordview): array
'pid' => $recordview->getPageUid(),
'crdate' => $recordview->getCrdate()->format('U'),
'tstamp' => $recordview->getCrdate()->format('U'),
// @extensionScannerIgnoreLine
'sys_language_uid' => $recordview->getLanguage()->getLanguageId(),
'url' => $recordview->getUrl(),
'user_agent' => $recordview->getUserAgent(),
Expand Down
23 changes: 16 additions & 7 deletions Configuration/TCA/tx_tracking_pageview.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

return [
$tca = [
'ctrl' => [
'label' => 'url',
'label_alt' => 'crdate',
'label_alt_force' => true,
'default_sortby' => 'crdate DESC',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'title' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.pageview',
Expand All @@ -32,9 +31,7 @@
'crdate' => [
'label' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.pageview.crdate',
'config' => [
'type' => 'input',
'eval' => 'datetime',
'renderType' => 'inputDateTime',
'type' => 'datetime',
],
],
'sys_language_uid' => [
Expand All @@ -58,9 +55,8 @@
'type' => [
'label' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.pageview.type',
'config' => [
'type' => 'input',
'type' => 'number',
'readOnly' => true,
'eval' => 'int',
],
],
'url' => [
Expand All @@ -73,3 +69,16 @@
],
],
];

if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() < 12) {
$tca['ctrl']['cruser_id'] = 'cruser_id';

$tca['columns']['crdate']['config']['type'] = 'input';
$tca['columns']['crdate']['config']['renderType'] = 'inputDateTime';
$tca['columns']['crdate']['config']['eval'] = 'datetime';

$tca['columns']['type']['config']['type'] = 'input';
$tca['columns']['type']['config']['eval'] = 'int';
}

return $tca;
17 changes: 12 additions & 5 deletions Configuration/TCA/tx_tracking_recordview.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

return [
$tca = [
'ctrl' => [
'label' => 'record',
'label_alt' => 'crdate',
'label_alt_force' => true,
'default_sortby' => 'crdate DESC',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'title' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.recordview',
Expand All @@ -32,9 +31,7 @@
'crdate' => [
'label' => 'LLL:EXT:tracking/Resources/Private/Language/locallang_tca.xlf:table.recordview.crdate',
'config' => [
'type' => 'input',
'eval' => 'datetime',
'renderType' => 'inputDateTime',
'type' => 'inputDateTime',
],
],
'sys_language_uid' => [
Expand Down Expand Up @@ -75,3 +72,13 @@
],
],
];

if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() < 12) {
$tca['ctrl']['cruser_id'] = 'cruser_id';

$tca['columns']['crdate']['config']['type'] = 'input';
$tca['columns']['crdate']['config']['renderType'] = 'inputDateTime';
$tca['columns']['crdate']['config']['eval'] = 'datetime';
}

return $tca;
9 changes: 6 additions & 3 deletions Documentation/Changelog/2.5.1.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2.6.0
2.5.1
=====

Breaking
Expand All @@ -9,8 +9,6 @@ Nothing
Features
--------

Nothing

Fixes
-----

Expand All @@ -27,6 +25,11 @@ Tasks

* Migrate test fixtures to PHP Data Sets using `codappix/typo3-php-datasets <https://packagist.org/packages/codappix/typo3-php-datasets>`_

* Remove false positives of extension scanner in v12.

* Remove TCA migrations in v12.
Stay compatible with v11 via condition within code.

Deprecation
-----------

Expand Down
1 change: 1 addition & 0 deletions Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ in order to extract further information from them with future updates.
Installation
Pageview
Recordview
Maintenance
Changelog
14 changes: 14 additions & 0 deletions Documentation/Maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Maintenance
===========

List of changes that need to be done for maintenance reasons.
Those affect the extension itself, not users of the extension.

E.g. changes once we drop a certain TYPO3 version.
We might have new code backported for compatibility in older TYPO3 versions.
Those changes are documented so we know what to do once we drop an older version.

.. toctree::
:glob:

Maintenance/*
8 changes: 8 additions & 0 deletions Documentation/Maintenance/v11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
V11
===

Remove TCA fallback wrapped in version constraint in:

- ``Configuration/TCA/tx_tracking_pageview.php``

- ``Configuration/TCA/tx_tracking_recordview.php``

0 comments on commit 19b7fff

Please sign in to comment.