| @@ -8,12 +8,12 @@ | ||
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Load the "SQLITE_DRIVER_VERSION" constant. |
| 11 | 11 | */ |
| 12 | -require_once __DIR__ . '/../database/version.php'; | |
| 12 | +require_once dirname( __DIR__, 2 ) . '/version.php'; | |
| 13 | 13 | |
| 14 | 14 | // Require the constants file. |
| 15 | -require_once __DIR__ . '/../../constants.php'; | |
| 15 | +require_once dirname( __DIR__, 2 ) . '/constants.php'; | |
| 16 | 16 | |
| 17 | 17 | // Bail early if DB_ENGINE is not defined as sqlite. |
| 18 | 18 | if ( ! defined( 'DB_ENGINE' ) || 'sqlite' !== DB_ENGINE ) { |
| 19 | 19 | return; |
| @@ -46,36 +46,16 @@ | ||
| 46 | 46 | 'PDO Driver for SQLite is missing.' |
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if ( defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER ) { | |
| 51 | - require_once __DIR__ . '/../database/load.php'; | |
| 52 | -} else { | |
| 53 | - require_once __DIR__ . '/php-polyfills.php'; | |
| 54 | - require_once __DIR__ . '/class-wp-sqlite-lexer.php'; | |
| 55 | - require_once __DIR__ . '/class-wp-sqlite-query-rewriter.php'; | |
| 56 | - require_once __DIR__ . '/class-wp-sqlite-translator.php'; | |
| 57 | - require_once __DIR__ . '/class-wp-sqlite-token.php'; | |
| 58 | - require_once __DIR__ . '/class-wp-sqlite-pdo-user-defined-functions.php'; | |
| 59 | -} | |
| 50 | +require_once __DIR__ . '/class-wp-sqlite-lexer.php'; | |
| 51 | +require_once __DIR__ . '/class-wp-sqlite-query-rewriter.php'; | |
| 52 | +require_once __DIR__ . '/class-wp-sqlite-translator.php'; | |
| 53 | +require_once __DIR__ . '/class-wp-sqlite-token.php'; | |
| 54 | +require_once __DIR__ . '/class-wp-sqlite-pdo-user-defined-functions.php'; | |
| 60 | 55 | require_once __DIR__ . '/class-wp-sqlite-db.php'; |
| 61 | 56 | require_once __DIR__ . '/install-functions.php'; |
| 62 | 57 | |
| 63 | -/** | |
| 64 | - * The DB_NAME constant is required by the new SQLite driver. | |
| 65 | - * | |
| 66 | - * There are some existing projects in which the DB_NAME constant is missing in | |
| 67 | - * wp-config.php. To enable easier early adoption and testing of the new SQLite | |
| 68 | - * driver, let's allow using a default database name when DB_NAME is not set. | |
| 69 | - * | |
| 70 | - * TODO: For version 3.0, enforce the DB_NAME constant and remove the fallback. | |
| 71 | - */ | |
| 72 | -if ( defined( 'DB_NAME' ) && '' !== DB_NAME ) { | |
| 73 | - $db_name = DB_NAME; | |
| 74 | -} else { | |
| 75 | - $db_name = apply_filters( 'wp_sqlite_default_db_name', 'database_name_here' ); | |
| 76 | -} | |
| 77 | - | |
| 78 | 58 | /* |
| 79 | 59 | * Debug: Cross-check with MySQL. |
| 80 | 60 | * This is for debugging purpose only and requires files |
| 81 | 61 | * that are present in the GitHub repository |
| @@ -80,14 +60,11 @@ | ||
| 80 | 60 | * This is for debugging purpose only and requires files |
| 81 | 61 | * that are present in the GitHub repository |
| 82 | 62 | * but not the plugin published on WordPress.org. |
| 83 | 63 | */ |
| 84 | -$crosscheck_tests_file_path = __DIR__ . '/class-wp-sqlite-crosscheck-db.php'; | |
| 64 | +$crosscheck_tests_file_path = dirname( __DIR__, 2 ) . '/tests/class-wp-sqlite-crosscheck-db.php'; | |
| 85 | 65 | if ( defined( 'SQLITE_DEBUG_CROSSCHECK' ) && SQLITE_DEBUG_CROSSCHECK && file_exists( $crosscheck_tests_file_path ) ) { |
| 86 | 66 | require_once $crosscheck_tests_file_path; |
| 87 | - $GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB( $db_name ); | |
| 67 | + $GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB( DB_NAME ); | |
| 88 | 68 | } else { |
| 89 | - $GLOBALS['wpdb'] = new WP_SQLite_DB( $db_name ); | |
| 90 | - | |
| 91 | - // Boot the Query Monitor plugin if it is active. | |
| 92 | - require_once __DIR__ . '/../../integrations/query-monitor/boot.php'; | |
| 69 | + $GLOBALS['wpdb'] = new WP_SQLite_DB( DB_NAME ); | |
| 93 | 70 | } |