-
Notifications
You must be signed in to change notification settings - Fork 51
[TASK] Mitigate deprecated database configuration #629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change writes functioal test instance database configuration using doctrine/dbal identifiers and structure directly. Thus, avoiding the need for the TYPO3 ConnectionPool to transform these values on the fly. Instead of default connection array $GLOBALS['TYPO3_CONF_VARS_']['DB']['Connections'] ['Default']['tableoptions'] = [] following array is written $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'] ['Default']['defaultTableOptions'] = [] for database driver `mysqli` and `pdo_mysql`, other platforms does not suport these settings. Additionally, `COLLATION` is used instead of the replaced `COLLATE` subkey to define the table collation within the default table options. Backport to typo3/testing-framework v8 will limit this to TYPO3 v13 and for v12 using the old values. [1] doctrine/dbal#5246 [2] https://review.typo3.org/c/Packages/TYPO3.CMS/+/75211/4/typo3/sysext/core/Classes/Database/ConnectionPool.php#147 Releases: main, 8
See 86566: [WIP][TASK] test TF pull-request | https://review.typo3.org/c/Packages/TYPO3.CMS/+/86566 |
lolli42
approved these changes
Oct 12, 2024
reviewtypo3org
pushed a commit
to TYPO3/typo3
that referenced
this pull request
Oct 12, 2024
This change updates development dependency `typo3/testing-framework` to ensure latest required changes are available. Used command: ------------- > composer update testing-framework [1] TYPO3/testing-framework#629 Resolves: #105288 Releases: main Change-Id: I94873a82299993a1b0de9a954b72c50f7ea986d7 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86566 Tested-by: Christian Kuhn <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Reviewed-by: Stefan Bürk <[email protected]> Tested-by: Stefan Bürk <[email protected]> Tested-by: core-ci <[email protected]>
reviewtypo3org
pushed a commit
to TYPO3/typo3
that referenced
this pull request
Oct 14, 2024
Passing `tableoptions` through the connection params introduced with #80398 violates the PHPStan annotation since quite some time. To mitigate this, automatic transformation along with an @todo has been added to `ConnectionPool` with #97961. Doctrine DBAL meanwhile switched from `collate` to `collation` for internal table and column collate settings since `doctrine/dbal:3.3.2` [1] putting a backwards compatible layer into place. This has been removed with v4. Setting default table options could have been set manually or are set as part if the install process, but are not guaranteed in all cases. Default connection charset is ensured in several places: In ConnectionPool and during installation process. In some cases respecting MySQL/MariaDB differences, but not in other places. Deprecated connection parameter options needs to be avoided and migrated and charset should be ensured the same way in all places. This change: * Modifies `ConnectionPool` to migrate `tableoptions` to `defaultTableOptions` with `tableoptions` taking higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to migrate `collate` table option to `collation` with `collate` having higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to remove `collate` option. * Modifies `ConnectionPool` to remove `tableoptions` and `defaultTableOptions` for connections not made towards MySQL/MariaDB. * Modifes `ConnectionPool` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. * Modifies EXT:install `SetupDatabaseService` to set `defaultTableOptions` charset and collation along with connection `charset` settings during the setup process. * Modifes `SetupDatabaseService` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. Old options will be deprecated in a dedicated change. Further, `typo3/testing-framework` has been prepared as well with [2][3] and #105288. [1] doctrine/dbal#5246 [2] TYPO3/testing-framework#629 [3] TYPO3/testing-framework#628 Resolves: #105289 Related: #105288 Related: #97961 Related: #80398 Releases: main Change-Id: I8896448c5f8c487f12aabb0fdd28f47718a02359 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85658 Tested-by: Christian Kuhn <[email protected]> Reviewed-by: Stefan Bürk <[email protected]> Tested-by: Anja Leichsenring <[email protected]> Reviewed-by: Garvin Hicking <[email protected]> Tested-by: core-ci <[email protected]> Tested-by: Garvin Hicking <[email protected]> Tested-by: Stefan Bürk <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Reviewed-by: Anja Leichsenring <[email protected]>
TYPO3IncTeam
pushed a commit
to TYPO3-CMS/core
that referenced
this pull request
Oct 14, 2024
Passing `tableoptions` through the connection params introduced with #80398 violates the PHPStan annotation since quite some time. To mitigate this, automatic transformation along with an @todo has been added to `ConnectionPool` with #97961. Doctrine DBAL meanwhile switched from `collate` to `collation` for internal table and column collate settings since `doctrine/dbal:3.3.2` [1] putting a backwards compatible layer into place. This has been removed with v4. Setting default table options could have been set manually or are set as part if the install process, but are not guaranteed in all cases. Default connection charset is ensured in several places: In ConnectionPool and during installation process. In some cases respecting MySQL/MariaDB differences, but not in other places. Deprecated connection parameter options needs to be avoided and migrated and charset should be ensured the same way in all places. This change: * Modifies `ConnectionPool` to migrate `tableoptions` to `defaultTableOptions` with `tableoptions` taking higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to migrate `collate` table option to `collation` with `collate` having higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to remove `collate` option. * Modifies `ConnectionPool` to remove `tableoptions` and `defaultTableOptions` for connections not made towards MySQL/MariaDB. * Modifes `ConnectionPool` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. * Modifies EXT:install `SetupDatabaseService` to set `defaultTableOptions` charset and collation along with connection `charset` settings during the setup process. * Modifes `SetupDatabaseService` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. Old options will be deprecated in a dedicated change. Further, `typo3/testing-framework` has been prepared as well with [2][3] and #105288. [1] doctrine/dbal#5246 [2] TYPO3/testing-framework#629 [3] TYPO3/testing-framework#628 Resolves: #105289 Related: #105288 Related: #97961 Related: #80398 Releases: main Change-Id: I8896448c5f8c487f12aabb0fdd28f47718a02359 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85658 Tested-by: Christian Kuhn <[email protected]> Reviewed-by: Stefan Bürk <[email protected]> Tested-by: Anja Leichsenring <[email protected]> Reviewed-by: Garvin Hicking <[email protected]> Tested-by: core-ci <[email protected]> Tested-by: Garvin Hicking <[email protected]> Tested-by: Stefan Bürk <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Reviewed-by: Anja Leichsenring <[email protected]>
TYPO3IncTeam
pushed a commit
to TYPO3-CMS/install
that referenced
this pull request
Oct 14, 2024
Passing `tableoptions` through the connection params introduced with #80398 violates the PHPStan annotation since quite some time. To mitigate this, automatic transformation along with an @todo has been added to `ConnectionPool` with #97961. Doctrine DBAL meanwhile switched from `collate` to `collation` for internal table and column collate settings since `doctrine/dbal:3.3.2` [1] putting a backwards compatible layer into place. This has been removed with v4. Setting default table options could have been set manually or are set as part if the install process, but are not guaranteed in all cases. Default connection charset is ensured in several places: In ConnectionPool and during installation process. In some cases respecting MySQL/MariaDB differences, but not in other places. Deprecated connection parameter options needs to be avoided and migrated and charset should be ensured the same way in all places. This change: * Modifies `ConnectionPool` to migrate `tableoptions` to `defaultTableOptions` with `tableoptions` taking higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to migrate `collate` table option to `collation` with `collate` having higher priority for now. MariaDB/MySQL only. * Modifies `ConnectionPool` to remove `collate` option. * Modifies `ConnectionPool` to remove `tableoptions` and `defaultTableOptions` for connections not made towards MySQL/MariaDB. * Modifes `ConnectionPool` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. * Modifies EXT:install `SetupDatabaseService` to set `defaultTableOptions` charset and collation along with connection `charset` settings during the setup process. * Modifes `SetupDatabaseService` to use `utf8mb4` charset for MySQL/MariaDB connections and `utf8` for SQLite and PostgreSQL. Old options will be deprecated in a dedicated change. Further, `typo3/testing-framework` has been prepared as well with [2][3] and #105288. [1] doctrine/dbal#5246 [2] TYPO3/testing-framework#629 [3] TYPO3/testing-framework#628 Resolves: #105289 Related: #105288 Related: #97961 Related: #80398 Releases: main Change-Id: I8896448c5f8c487f12aabb0fdd28f47718a02359 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85658 Tested-by: Christian Kuhn <[email protected]> Reviewed-by: Stefan Bürk <[email protected]> Tested-by: Anja Leichsenring <[email protected]> Reviewed-by: Garvin Hicking <[email protected]> Tested-by: core-ci <[email protected]> Tested-by: Garvin Hicking <[email protected]> Tested-by: Stefan Bürk <[email protected]> Reviewed-by: Christian Kuhn <[email protected]> Reviewed-by: Anja Leichsenring <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change writes functioal test instance database
configuration using doctrine/dbal identifiers and
structure directly. Thus, avoiding the need for the
TYPO3 ConnectionPool to transform these values on
the fly.
Instead of default connection array
$GLOBALS['TYPO3_CONF_VARS_']['DB']['Connections']
['Default']['tableoptions'] = []
following array is written
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']
['Default']['defaultTableOptions'] = []
for database driver
mysqli
andpdo_mysql
, otherplatforms does not suport these settings.
Additionally,
COLLATION
is used instead of thereplaced
COLLATE
subkey to define the tablecollation within the default table options.
Backport to typo3/testing-framework v8 will limit
this to TYPO3 v13 and for v12 using the old values.
[1] doctrine/dbal#5246
[2] https://review.typo3.org/c/Packages/TYPO3.CMS/+/75211/4/typo3/sysext/core/Classes/Database/ConnectionPool.php#147
Releases: main, 8