Skip to content

Commit

Permalink
Rename DATABASE_TYPE to DB_ENGINE for consistency with other constants
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Aug 30, 2023
1 parent 4486eab commit 7dacf7f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
22 changes: 11 additions & 11 deletions src/wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ public static function debug_data() {
'label' => 'WP_MAX_MEMORY_LIMIT',
'value' => WP_MAX_MEMORY_LIMIT,
),
'DATABASE_TYPE' => array(
'label' => 'DATABASE_TYPE',
'value' => ( defined( 'DATABASE_TYPE' ) ? DATABASE_TYPE : __( 'Undefined' ) ),
'debug' => ( defined( 'DATABASE_TYPE' ) ? DATABASE_TYPE : 'undefined' ),
'DB_ENGINE' => array(
'label' => 'DB_ENGINE',
'value' => ( defined( 'DB_ENGINE' ) ? DB_ENGINE : __( 'Undefined' ) ),
'debug' => ( defined( 'DB_ENGINE' ) ? DB_ENGINE : 'undefined' ),
),
'WP_DEBUG' => array(
'label' => 'WP_DEBUG',
Expand Down Expand Up @@ -859,7 +859,7 @@ public static function debug_data() {
'value' => wp_date( 'c', $_SERVER['REQUEST_TIME'] ),
);

$database_type = defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ? 'sqlite' : 'mysql';
$db_engine = defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ? 'sqlite' : 'mysql';
$extension = null;
if ( 'mysql' === $database_type ) {
// Populate the database debug fields.
Expand All @@ -873,12 +873,12 @@ public static function debug_data() {

$client_version = $wpdb->dbh->client_info;

$info['wp-database']['fields']['database_type'] = array(
'label' => __( 'Database type' ),
'value' => 'sqlite' === $database_type ? 'SQLite' : 'MySQL/MariaDB',
$info['wp-database']['fields']['db_engine'] = array(
'label' => __( 'Database engine' ),
'value' => 'sqlite' === $db_engine ? 'SQLite' : 'MySQL/MariaDB',
);

if ( 'mysql' === $database_type ) {
if ( 'mysql' === $db_engine ) {
$info['wp-database']['fields']['extension'] = array(
'label' => __( 'Extension' ),
'value' => $extension,
Expand Down Expand Up @@ -911,7 +911,7 @@ public static function debug_data() {
'value' => $wpdb->dbname,
'private' => true,
);
} elseif ( 'sqlite' === $database_type ) {
} elseif ( 'sqlite' === $db_engine ) {
$info['wp-database']['fields']['database_version'] = array(
'label' => __( 'SQLite version' ),
'value' => class_exists( 'SQLite3' ) ? SQLite3::version()['versionString'] : null,
Expand All @@ -935,7 +935,7 @@ public static function debug_data() {
'private' => true,
);

if ( 'mysql' === $database_type ) {
if ( 'mysql' === $db_engine ) {
$info['wp-database']['fields']['database_charset'] = array(
'label' => __( 'Database charset' ),
'value' => $wpdb->charset,
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function prepare_sql_data() {
global $wpdb;

$mysql_server_type = $wpdb->db_server_info();
$this->is_sqlite = defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ? 'sqlite' : 'mysql';
$this->is_sqlite = defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ? 'sqlite' : 'mysql';

$this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecat
wp_check_mysql_version();
wp_cache_flush();

if ( defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ) {
if ( defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ) {
sqlite_make_db_sqlite(); // phpcs:ignore PHPCompatibility.Extensions.RemovedExtensions.sqliteRemoved
} else {
make_db_current_silent();
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/setup-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ function setup_config_display_header( $body_classes = array() ) {
*
* @ignore
*/
define( 'DATABASE_TYPE', $dbtype );
define( 'DB_ENGINE', $dbtype );
define( 'DB_NAME', $dbname );
define( 'DB_USER', $uname );
define( 'DB_PASSWORD', $pwd );
Expand All @@ -363,7 +363,7 @@ function setup_config_display_header( $body_classes = array() ) {
*
* @ignore
*/
define( 'DATABASE_TYPE', $dbtype );
define( 'DB_ENGINE', $dbtype );
define( 'DB_NAME', '' );
define( 'DB_USER', '' );
define( 'DB_PASSWORD', '' );
Expand Down Expand Up @@ -442,7 +442,7 @@ function setup_config_display_header( $body_classes = array() ) {
$padding = $match[2];

switch ( $constant ) {
case 'DATABASE_TYPE':
case 'DB_ENGINE':
case 'DB_NAME':
case 'DB_USER':
case 'DB_PASSWORD':
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ function require_wp_db() {

require_once ABSPATH . WPINC . '/class-wpdb.php';

if ( defined( 'DATABASE_TYPE' ) && 'sqlite' === DATABASE_TYPE ) {
if ( defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ) {
require_once ABSPATH . WPINC . '/sqlite/db.php';
}

Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/sqlite/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @since 1.0.0
*/

// Bail early if DATABASE_TYPE is not defined as sqlite.
if ( ! defined( 'DATABASE_TYPE' ) || 'sqlite' !== DATABASE_TYPE ) {
// Bail early if DB_ENGINE is not defined as sqlite.
if ( ! defined( 'DB_ENGINE' ) || 'sqlite' !== DB_ENGINE ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

// @TODO: Remove this. It's only here so that the PR can be tested.
define( 'DATABASE_TYPE', 'sqlite' );
define( 'DB_ENGINE', 'sqlite' );

/*
* The error_reporting() function can be disabled in php.ini. On systems where that is the case,
Expand Down
2 changes: 1 addition & 1 deletion wp-config-sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

// ** Database settings - You can get this info from your web host ** //
define( 'DATABASE_TYPE', 'mysql' );
define( 'DB_ENGINE', 'mysql' );

/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
Expand Down

0 comments on commit 7dacf7f

Please sign in to comment.