Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit ad3beb8

Browse files
committed
Pass $dbname into WP_SQLite_DB
1 parent 91ca58f commit ad3beb8

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

.github/workflows/wp-tests-phpunit-run.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ const fs = require( 'fs' );
1111
const path = require( 'path' );
1212

1313
const expectedErrors = [
14-
'Tests_Admin_wpSiteHealth::test_object_cache_default_thresholds_non_multisite',
15-
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #0',
16-
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #1',
17-
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #2',
18-
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #3',
19-
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #4',
2014
'Tests_Comment_WpComment::test_get_instance_should_succeed_for_float_that_is_equal_to_post_id',
2115
'Tests_Cron_getCronArray::test_get_cron_array_output_validation with data set "null"',
2216
'Tests_DB_Charset::test_strip_invalid_text',
@@ -33,6 +27,8 @@ const expectedErrors = [
3327
];
3428

3529
const expectedFailures = [
30+
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #2',
31+
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #3',
3632
'Tests_Comment::test_wp_new_comment_respects_comment_field_lengths',
3733
'Tests_Comment::test_wp_update_comment',
3834
'Tests_DB_dbDelta::test_spatial_indices',

wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
class WP_SQLite_Crosscheck_DB_ extends WP_SQLite_DB {
44

5-
public function __construct() {
6-
parent::__construct();
5+
public function __construct( string $dbname ) {
6+
parent::__construct( $dbname );
77
$GLOBALS['sqlite'] = $this;
88
$GLOBALS['mysql'] = new wpdb(
99
DB_USER,

wp-includes/sqlite/class-wp-sqlite-db.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ class WP_SQLite_DB extends wpdb {
3131
private $allow_unsafe_unquoted_parameters = true;
3232

3333
/**
34-
* Constructor
34+
* Connects to the SQLite database.
3535
*
36-
* Unlike wpdb, no credentials are needed.
36+
* Unlike for MySQL, no credentials and host are needed.
37+
*
38+
* @param string $dbname Database name.
3739
*/
38-
public function __construct() {
39-
parent::__construct( '', '', '', '' );
40+
public function __construct( $dbname ) {
41+
parent::__construct( '', '', $dbname, '' );
4042
$this->charset = 'utf8mb4';
4143
}
4244

wp-includes/sqlite/db.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
$crosscheck_tests_file_path = dirname( __DIR__, 2 ) . '/tests/class-wp-sqlite-crosscheck-db.php';
6060
if ( defined( 'SQLITE_DEBUG_CROSSCHECK' ) && SQLITE_DEBUG_CROSSCHECK && file_exists( $crosscheck_tests_file_path ) ) {
6161
require_once $crosscheck_tests_file_path;
62-
$GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB();
62+
$GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB( DB_NAME );
6363
} else {
64-
$GLOBALS['wpdb'] = new WP_SQLite_DB();
64+
$GLOBALS['wpdb'] = new WP_SQLite_DB( DB_NAME );
6565
}

0 commit comments

Comments
 (0)