Skip to content
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

Do not show the deprecation warnings by default. #33

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Classes/Database/DatabaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use TYPO3\CMS\Core\Utility\StringUtility;

/**
* @deprecated ------------- THE WHOLE CLASS WILL BE REMOVED IN TYPO3 v9 ----------------------------------------------
* DatabaseConnection a.k.a. TYPO3_DB has been superseded by Doctrine DBAL in TYPO3 v8, and will be removed in TYPO3 v9
* THE WHOLE CLASS HAS BEEN REMOVED IN TYPO3 v9 ----------------------------------------------
* DatabaseConnection a.k.a. TYPO3_DB has been superseded by Doctrine DBAL in TYPO3 v8, and has been removed in TYPO3 v9
* ---------------------------------------------------------------------------------------------------------------------
* Contains the class "DatabaseConnection" containing functions for building SQL queries
* and mysqli wrappers, thus providing a foundational API to all database
Expand Down Expand Up @@ -178,6 +178,12 @@ class DatabaseConnection
*/
protected $postProcessHookObjects = [];

/**
* External property to mark if a deprecation log warning should be thrown.
* @var bool
*/
public $deprecationWarningActive = false;

/**
* Internal property to mark if a deprecation log warning has been thrown in this request
* in order to avoid a load of deprecation.
Expand Down Expand Up @@ -2000,7 +2006,10 @@ public function __sleep()
*/
protected function logDeprecation()
{
if (!$this->deprecationWarningThrown) {
if (
$this->deprecationWarningActive &&
!$this->deprecationWarningThrown
) {
$this->deprecationWarningThrown = true;
trigger_error('DatabaseConnection a.k.a. $["TYPO3_DB"] has been marked as deprecated in'
. ' TYPO3 v8 and will be removed in TYPO3 v9. Please use the newly available ConnectionPool and QueryBuilder'
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'author' => 'TYPO3 Community',
'author_email' => '',
'author_company' => '',
'version' => '1.2.0',
'version' => '1.2.1',
'constraints' => [
'depends' => [
'php' => '8.0.0-8.4.99',
Expand Down
8 changes: 6 additions & 2 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?php
defined('TYPO3') or die();

call_user_func(function () {
call_user_func(function ($extensionKey) {

// The autoloader might not yet be aware of the Classes folder.
include_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey) . 'Classes/Database/DatabaseConnection.php';

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['dbalAndAdodbExtraction']
= \TYPO3\CMS\Typo3DbLegacy\Updates\DbalAndAdodbExtractionUpdate::class;

Expand Down Expand Up @@ -67,4 +71,4 @@

$GLOBALS['TYPO3_DB'] = $databaseConnection;
$GLOBALS['TYPO3_DB']->initialize();
});
}, 'typo3db_legacy');