Database: Reinstate wpdb::$use_mysqli property.

Partial revert of [56475] to reinstate the private `wpdb::$use_mysqli` property and set to its default to true. This private property was / is accessible through the magic methods. Though Core's usage of this property was removed by [56475], plugins are using the property. Reinstating it resolves the BC break.

Follow up to [56475].

Reviewed by jorbin.
Merges [57089] to the 6.4 branch.

Props jason_the_adams, joemcgill, johnbillion, johnjamesjacoby, jrf, rajinsharwar, renehermi.
Fixes #59846.

git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57090 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2023-11-08 20:36:13 +00:00
parent 299ba76a50
commit 9133c83dea
2 changed files with 28 additions and 0 deletions

View File

@ -690,6 +690,21 @@ class wpdb {
*/
private $allow_unsafe_unquoted_parameters = true;
/**
* Whether to use the mysqli extension over mysql. This is no longer used as the mysql
* extension is no longer supported.
*
* Default true.
*
* @since 3.9.0
* @since 6.4.0 This property was removed.
* @since 6.4.1 This property was reinstated and its default value was changed to true.
* The property is no longer used in core but may be accessed externally.
*
* @var bool
*/
private $use_mysqli = true;
/**
* Whether we've managed to successfully connect at some point.
*

View File

@ -2469,4 +2469,17 @@ class Tests_DB extends WP_UnitTestCase {
),
);
}
/**
* This private property is no longer used but needs to be retained as it can be
* accessed externally due to the `__get()` magic method.
*
* @ticket 59118
* @ticket 59846
*/
public function test_use_mysqli_property_access() {
global $wpdb;
$this->assertTrue( $wpdb->use_mysqli );
}
}