Skip to content

Commit e4ba70d

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 407925c commit e4ba70d

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
);
@@ -4204,7 +4204,7 @@ public function getReservedPrefixTestData(): array {
42044204
public function testInformationSchemaIsReadonly( string $query ): void {
42054205
$this->assertQuery( 'CREATE TABLE tables (id INT)' );
42064206
$this->expectException( WP_SQLite_Driver_Exception::class );
4207-
$this->expectExceptionMessage( "Access denied for user 'sqlite'@'%' to database 'information_schema'" );
4207+
$this->expectExceptionMessage( "Access denied for user 'root'@'%' to database 'information_schema'" );
42084208
$this->assertQuery( $query );
42094209
}
42104210

@@ -4236,7 +4236,7 @@ public function getInformationSchemaIsReadonlyTestData(): array {
42364236
public function testInformationSchemaIsReadonlyWithUse( string $query ): void {
42374237
$this->assertQuery( 'CREATE TABLE tables (id INT)' );
42384238
$this->expectException( WP_SQLite_Driver_Exception::class );
4239-
$this->expectExceptionMessage( "Access denied for user 'sqlite'@'%' to database 'information_schema'" );
4239+
$this->expectExceptionMessage( "Access denied for user 'root'@'%' to database 'information_schema'" );
42404240
$this->assertQuery( 'USE information_schema' );
42414241
$this->assertQuery( $query );
42424242
}
@@ -9906,7 +9906,7 @@ public function testNonEmptyColumnMeta(): void {
99069906
// SHOW GRANTS
99079907
$this->assertQuery( 'SHOW GRANTS' );
99089908
$this->assertSame( 1, $this->engine->get_last_column_count() );
9909-
$this->assertSame( 'Grants for root@localhost', $this->engine->get_last_column_meta()[0]['name'] );
9909+
$this->assertSame( 'Grants for root@%', $this->engine->get_last_column_meta()[0]['name'] );
99109910

99119911
// SHOW VARIABLES
99129912
$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
@@ -2334,7 +2334,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
23342334
$this->set_results_from_fetched_data(
23352335
array(
23362336
(object) array(
2337-
'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',
2337+
'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',
23382338
),
23392339
)
23402340
);
@@ -2344,7 +2344,7 @@ private function execute_show_statement( WP_Parser_Node $node ): void {
23442344
'pdo_type' => PDO::PARAM_STR,
23452345
'flags' => array( 'not_null' ),
23462346
'table' => '',
2347-
'name' => 'Grants for root@localhost',
2347+
'name' => 'Grants for root@%',
23482348
'len' => 4096,
23492349
'precision' => 31,
23502350
),
@@ -5890,7 +5890,7 @@ private function new_not_supported_exception( string $cause ): WP_SQLite_Driver_
58905890
*/
58915891
private function new_access_denied_to_information_schema_exception(): WP_SQLite_Driver_Exception {
58925892
return $this->new_driver_exception(
5893-
"Access denied for user 'sqlite'@'%' to database 'information_schema'",
5893+
"Access denied for user 'root'@'%' to database 'information_schema'",
58945894
'42000'
58955895
);
58965896
}

0 commit comments

Comments
 (0)