Skip to content

Commit 4b5f383

Browse files
committed
Allow using the new driver for initial database creation
1 parent fac0506 commit 4b5f383

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

wp-includes/sqlite/install-functions.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* @throws PDOException If the database connection fails.
1919
*/
2020
function sqlite_make_db_sqlite() {
21+
global $wpdb;
22+
2123
include_once ABSPATH . 'wp-admin/includes/schema.php';
2224

2325
$table_schemas = wp_get_db_schema();
@@ -31,8 +33,17 @@ function sqlite_make_db_sqlite() {
3133
wp_die( $message, 'Database Error!' );
3234
}
3335

34-
$translator = new WP_SQLite_Translator( $pdo );
35-
$query = null;
36+
if ( defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER ) {
37+
$translator = new WP_SQLite_Driver(
38+
array(
39+
'database' => $wpdb->dbname,
40+
'connection' => $pdo,
41+
)
42+
);
43+
} else {
44+
$translator = new WP_SQLite_Translator( $pdo );
45+
}
46+
$query = null;
3647

3748
try {
3849
$translator->begin_transaction();

0 commit comments

Comments
 (0)