Commit d780c0b5 authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[TASK] Deprecate pdo cache backend

The 'pdo' cache backend is of rather little use since
the Typo3DatabaseBackend supports the casual DBMS via
doctrine/dbal.

The backend is also pretty much unmaintained and didn't
receive any optimizations over the years in contrast to
the Typo3DatabaseBackend.

The patch deprecates PdoBackend.

Resolves: #94664
Releases: master
Change-Id: I584c150b754f0e3bb226dae998051eb389284e10
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70129

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 7a347e83
...@@ -23,6 +23,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; ...@@ -23,6 +23,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
* A PDO database cache backend * A PDO database cache backend
*
* @deprecated since v11, will be removed in v12. Use Typo3DatabaseBackend instead.
* Drop Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql when class is dropped.
*/ */
class PdoBackend extends AbstractBackend implements TaggableBackendInterface class PdoBackend extends AbstractBackend implements TaggableBackendInterface
{ {
...@@ -51,6 +54,12 @@ class PdoBackend extends AbstractBackend implements TaggableBackendInterface ...@@ -51,6 +54,12 @@ class PdoBackend extends AbstractBackend implements TaggableBackendInterface
*/ */
protected $pdoDriver; protected $pdoDriver;
public function __construct($context, array $options = [])
{
trigger_error(__CLASS__ . ' will be removed in TYPO3 v12, use Typo3DatabaseBackend instead.', E_USER_DEPRECATED);
parent::__construct($context, $options);
}
/** /**
* Sets the DSN to use * Sets the DSN to use
* *
......
.. include:: ../../Includes.txt
=======================================
Deprecation: #94664 - Pdo cache backend
=======================================
See :issue:`94664`
Description
===========
The Caching framework backend implementation :php:`TYPO3\CMS\Core\Cache\Backend\PdoBackend`
is superseded by the :php:`TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend` since
introduction of doctrine dbal. There is little reason to use the pdo backend instead
of the :php:`Typo3DatabaseBackend` and the latter is optimized much better.
The pdo cache backend has thus been deprecated and should not be used anymore.
Impact
======
The implementation has been marked as deprecated, usages trigger
a deprecation level log entry.
Affected Installations
======================
Some instances *may* use this cache backend, but chances are low. This can
be verified in the backend "Configuration" module, section "TYPO3_CONF_VARS",
searching for string "PdoBackend".
Migration
=========
TYPO3 cache backend configuration is usually done in :file:`LocalConfiguration.php`.
Affected instances should switch to :php:`Typo3DatabaseBackend` and eventually update
database schema.
LocalConfiguration example before:
.. code-block:: php
'SYS' => [
'caching' => [
'cacheConfigurations' => [
'aCache' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\PdoBackend',
...
LocalConfiguration example after:
.. code-block:: php
'SYS' => [
'caching' => [
'cacheConfigurations' => [
'aCache' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
...
In case this cache backend is still used for whatever reason and can't be dropped
easily, the class should be copied to an own extension having an own namespace. The
instance configuration needs to be adapted accordingly. Note there is an additional
schema definition file in :file:`EXT:core/Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql`,
that should be copied along the way with it's location being updated in the cache class.
.. index:: LocalConfiguration, PHP-API, NotScanned, ext:core
...@@ -15,7 +15,7 @@ declare(strict_types=1); ...@@ -15,7 +15,7 @@ declare(strict_types=1);
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend; namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Cache\Backend;
use TYPO3\CMS\Core\Cache\Backend\PdoBackend; use TYPO3\CMS\Core\Cache\Backend\PdoBackend;
use TYPO3\CMS\Core\Cache\Exception; use TYPO3\CMS\Core\Cache\Exception;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment