Skip to content

Commit 6452601

Browse files
authored
Merge pull request #34 from Automattic/fix-site-health-warnings
Fix warnings on site health screen
2 parents 3faa553 + 6e83c19 commit 6452601

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/WP_SQLite_Metadata_Tests.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testInformationSchemaTables() {
7878
$this->assertEquals(
7979
array(
8080
'TABLE_CATALOG' => 'def',
81-
'TABLE_SCHEMA' => 'database',
81+
'TABLE_SCHEMA' => '',
8282
'TABLE_NAME' => 'wp_options',
8383
'TABLE_TYPE' => 'BASE TABLE',
8484
'ENGINE' => 'InnoDB',

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -1528,14 +1528,16 @@ private function execute_select() {
15281528

15291529
if ( $table_name && str_starts_with( strtolower( $table_name ), 'information_schema' ) ) {
15301530
$this->is_information_schema_query = true;
1531-
$updated_query = preg_replace(
1531+
1532+
$database_name = $this->pdo->quote( defined( 'DB_NAME' ) ? DB_NAME : '' );
1533+
$updated_query = preg_replace(
15321534
'/' . $table_name . '\.tables/i',
15331535
/**
15341536
* TODO: Return real values for hardcoded column values.
15351537
*/
15361538
"(SELECT
15371539
'def' as TABLE_CATALOG,
1538-
'database' as TABLE_SCHEMA,
1540+
$database_name as TABLE_SCHEMA,
15391541
name as TABLE_NAME,
15401542
CASE type
15411543
WHEN 'table' THEN 'BASE TABLE'

0 commit comments

Comments
 (0)