Skip to content

Commit 5dfd5fa

Browse files
authored
Merge pull request #1 from Automattic/ast-sqlite-driver
2 parents b870b2a + 9c0c9b5 commit 5dfd5fa

32 files changed

+10438
-1512
lines changed

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ phpunit.xml.dist export-ignore
88
/.github export-ignore
99
/grammar-tools export-ignore
1010
/tests export-ignore
11-
/wip export-ignore
12-
/wp-includes/mysql export-ignore
13-
/wp-includes/parser export-ignore
1411
/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php export-ignore

activate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function ( $result ) {
7575
* When the plugin gets merged in wp-core, this is not to be ported.
7676
*/
7777
function sqlite_plugin_copy_db_file() {
78-
// Bail early if the SQLite3 class does not exist.
79-
if ( ! class_exists( 'SQLite3' ) ) {
78+
// Bail early if the PDO SQLite extension is not loaded.
79+
if ( ! extension_loaded( 'pdo_sqlite' ) ) {
8080
return;
8181
}
8282

admin-notices.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ function sqlite_plugin_admin_notice() {
1919
return;
2020
}
2121

22-
// If SQLite is not detected, bail early.
23-
if ( ! class_exists( 'SQLite3' ) ) {
22+
// If PDO SQLite is not loaded, bail early.
23+
if ( ! extension_loaded( 'pdo_sqlite' ) ) {
2424
printf(
2525
'<div class="notice notice-error"><p>%s</p></div>',
26-
esc_html__( 'The SQLite Integration plugin is active, but the SQLite3 class is missing from your server. Please make sure that SQLite is enabled in your PHP installation.', 'sqlite-database-integration' )
26+
esc_html__( 'The SQLite Integration plugin is active, but the PDO SQLite extension is missing from your server. Please make sure that PDO SQLite is enabled in your PHP installation.', 'sqlite-database-integration' )
2727
);
2828
return;
2929
}

admin-page.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ function sqlite_integration_admin_screen() {
4747
?>
4848
</p>
4949
<?php else : ?>
50-
<?php if ( ! class_exists( 'SQLite3' ) ) : ?>
51-
<div class="notice notice-error">
52-
<p><?php esc_html_e( 'We detected that the SQLite3 class is missing from your server. Please make sure that SQLite is enabled in your PHP installation before proceeding.', 'sqlite-database-integration' ); ?></p>
53-
</div>
54-
<?php elseif ( ! extension_loaded( 'pdo_sqlite' ) ) : ?>
50+
<?php if ( ! extension_loaded( 'pdo_sqlite' ) ) : ?>
5551
<div class="notice notice-error">
5652
<p><?php esc_html_e( 'We detected that the PDO SQLite driver is missing from your server (the pdo_sqlite extension is not loaded). Please make sure that SQLite is enabled in your PHP installation before proceeding.', 'sqlite-database-integration' ); ?></p>
5753
</div>
@@ -130,7 +126,8 @@ function sqlite_plugin_adminbar_item( $admin_bar ) {
130126
global $wpdb;
131127

132128
if ( defined( 'SQLITE_DB_DROPIN_VERSION' ) && defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ) {
133-
$title = '<span style="color:#46B450;">' . __( 'Database: SQLite', 'sqlite-database-integration' ) . '</span>';
129+
$suffix = defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER ? ' (AST)' : '';
130+
$title = '<span style="color:#46B450;">' . __( 'Database: SQLite', 'sqlite-database-integration' ) . $suffix . '</span>';
134131
} elseif ( stripos( $wpdb->db_server_info(), 'maria' ) !== false ) {
135132
$title = '<span style="color:#DC3232;">' . __( 'Database: MariaDB', 'sqlite-database-integration' ) . '</span>';
136133
} else {

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"issues": "https://github.com/wordpress/sqlite-database-integration/issues"
99
},
1010
"require": {
11-
"php": ">=7.0"
11+
"php": ">=7.0",
12+
"ext-pdo": "*",
13+
"ext-pdo_sqlite": "*"
1214
},
1315
"require-dev": {
1416
"ext-mbstring": "*",

0 commit comments

Comments
 (0)