Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

sbuerk
Copy link
Collaborator

@sbuerk sbuerk commented Oct 12, 2024

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

@sbuerk sbuerk self-assigned this Oct 12, 2024
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
@sbuerk sbuerk changed the title [TASK] Mitigiate deprecated database configuration [TASK] Mitigate deprecated database configuration Oct 12, 2024
@sbuerk
Copy link
Collaborator Author

sbuerk commented Oct 12, 2024

See 86568: [WIP][TASK] test TF v8 pull-request against v12 | https://review.typo3.org/c/Packages/TYPO3.CMS/+/86568

@sbuerk sbuerk merged commit 89313ea into 8 Oct 12, 2024
8 checks passed
@sbuerk sbuerk deleted the 8-stefan-1 branch October 12, 2024 17:26
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants