Skip to content

Commit 01a0126

Browse files
committed
Unify database user name to "root"
Using "root" as the user name makes sense considering that with the SQLite driver, the user gets all available permissions.
1 parent c0f28cc commit 01a0126

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tests/WP_SQLite_Driver_Tests.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,7 +2834,7 @@ public function testShowGrantsFor() {
28342834
$result,
28352835
array(
28362836
(object) array(
2837-
'Grants for root@localhost' => 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION',
2837+
'Grants for root@%' => 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION',
28382838
),
28392839
)
28402840
);
@@ -4188,7 +4188,7 @@ public function getReservedPrefixTestData(): array {
41884188
public function testInformationSchemaIsReadonly( string $query ): void {
41894189
$this->assertQuery( 'CREATE TABLE t1 (id INT)' );
41904190
$this->expectException( WP_SQLite_Driver_Exception::class );
4191-
$this->expectExceptionMessage( "Access denied for user 'sqlite'@'%' to database 'information_schema'" );
4191+
$this->expectExceptionMessage( "Access denied for user 'root'@'%' to database 'information_schema'" );
41924192
$this->assertQuery( $query );
41934193
}
41944194

@@ -4220,7 +4220,7 @@ public function getInformationSchemaIsReadonlyTestData(): array {
42204220
public function testInformationSchemaIsReadonlyWithUse( string $query ): void {
42214221
$this->assertQuery( 'CREATE TABLE t1 (id INT)' );
42224222
$this->expectException( WP_SQLite_Driver_Exception::class );
4223-
$this->expectExceptionMessage( "Access denied for user 'sqlite'@'%' to database 'information_schema'" );
4223+
$this->expectExceptionMessage( "Access denied for user 'root'@'%' to database 'information_schema'" );
42244224
$this->assertQuery( 'USE information_schema' );
42254225
$this->assertQuery( $query );
42264226
}
@@ -9808,7 +9808,7 @@ public function testNonEmptyColumnMeta(): void {
98089808
// SHOW GRANTS
98099809
$this->assertQuery( 'SHOW GRANTS' );
98109810
$this->assertSame( 1, $this->engine->get_last_column_count() );
9811-
$this->assertSame( 'Grants for root@localhost', $this->engine->get_last_column_meta()[0]['name'] );
9811+
$this->assertSame( 'Grants for root@%', $this->engine->get_last_column_meta()[0]['name'] );
98129812

98139813
// SHOW VARIABLES
98149814
$this->assertQuery( 'SHOW VARIABLES' );

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
23122312
$this->set_results_from_fetched_data(
23132313
array(
23142314
(object) array(
2315-
'Grants for root@localhost' => 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION',
2315+
'Grants for root@%' => 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION',
23162316
),
23172317
)
23182318
);
@@ -2322,7 +2322,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
23222322
'pdo_type' => PDO::PARAM_STR,
23232323
'flags' => array( 'not_null' ),
23242324
'table' => '',
2325-
'name' => 'Grants for root@localhost',
2325+
'name' => 'Grants for root@%',
23262326
'len' => 4096,
23272327
'precision' => 31,
23282328
),
@@ -5846,7 +5846,7 @@ private function new_not_supported_exception( string $cause ): WP_SQLite_Driver_
58465846
*/
58475847
private function new_access_denied_to_information_schema_exception(): WP_SQLite_Driver_Exception {
58485848
return $this->new_driver_exception(
5849-
"Access denied for user 'sqlite'@'%' to database 'information_schema'",
5849+
"Access denied for user 'root'@'%' to database 'information_schema'",
58505850
'42000'
58515851
);
58525852
}

0 commit comments

Comments
 (0)