Skip to content

Commit 44a61c0

Browse files
committed
Load the renamed MySQL-on-SQLite API by default
Detect the renamed single-file and packaged layouts before consulting the legacy AST opt-in. Keep the older layouts as compatibility fallbacks.
1 parent 94894fc commit 44a61c0

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎src/SQLiteDatabaseIntegrationLoader.php‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,25 @@ public static function load_plugin() {
8181
define( 'SQLITE_DB_DROPIN_VERSION', $sqlite_plugin_version ); // phpcs:ignore
8282
}
8383

84-
$new_driver_enabled = defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER;
85-
$old_structure = file_exists( $plugin_directory . '/php-polyfills.php' );
84+
$old_structure = file_exists( $plugin_directory . '/php-polyfills.php' );
8685

8786
if ( $old_structure ) {
8887
require_once $plugin_directory . '/php-polyfills.php';
8988
}
9089
require_once $plugin_directory . '/constants.php';
9190

91+
if ( file_exists( $plugin_directory . '/class-wp-mysql-on-sqlite.php' ) ) {
92+
require_once $plugin_directory . '/class-wp-mysql-on-sqlite.php';
93+
return;
94+
}
95+
96+
$new_driver_file = $plugin_directory . '/wp-includes/database/sqlite/class-wp-mysql-on-sqlite.php';
97+
if ( file_exists( $new_driver_file ) ) {
98+
require_once $plugin_directory . '/wp-includes/database/load.php';
99+
return;
100+
}
101+
102+
$new_driver_enabled = defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER;
92103
if ( $new_driver_enabled && file_exists( $plugin_directory . '/wp-pdo-mysql-on-sqlite.php' ) ) {
93104
require_once $plugin_directory . '/wp-pdo-mysql-on-sqlite.php';
94105
} elseif ( $new_driver_enabled && file_exists( $plugin_directory . '/wp-includes/database/load.php' ) ) {

0 commit comments

Comments
 (0)