| @@ -1,16 +1,19 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Main integration file. |
| 4 | + * | |
| 5 | + * @package wp-sqlite-integration | |
| 6 | + * @since 1.0.0 | |
| 4 | 7 | */ |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * Load the "SQLITE_DRIVER_VERSION" constant. |
| 8 | 11 | */ |
| 9 | -require_once __DIR__ . '/../database/version.php'; | |
| 12 | +require_once dirname( __DIR__, 2 ) . '/version.php'; | |
| 10 | 13 | |
| 11 | 14 | // Require the constants file. |
| 12 | -require_once __DIR__ . '/../../constants.php'; | |
| 15 | +require_once dirname( __DIR__, 2 ) . '/constants.php'; | |
| 13 | 16 | |
| 14 | 17 | // Bail early if DB_ENGINE is not defined as sqlite. |
| 15 | 18 | if ( ! defined( 'DB_ENGINE' ) || 'sqlite' !== DB_ENGINE ) { |
| 16 | 19 | return; |
| @@ -43,13 +46,25 @@ | ||
| 43 | 46 | 'PDO Driver for SQLite is missing.' |
| 44 | 47 | ); |
| 45 | 48 | } |
| 46 | 49 | |
| 47 | -require_once __DIR__ . '/../database/load.php'; | |
| 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'; | |
| 48 | 55 | require_once __DIR__ . '/class-wp-sqlite-db.php'; |
| 49 | 56 | require_once __DIR__ . '/install-functions.php'; |
| 50 | 57 | |
| 51 | -$db_name = defined( 'DB_NAME' ) ? DB_NAME : ''; | |
| 52 | -$GLOBALS['wpdb'] = new WP_SQLite_DB( $db_name ); | |
| 53 | - | |
| 54 | -// Boot the Query Monitor plugin if it is active. | |
| 55 | -require_once __DIR__ . '/../../integrations/query-monitor/boot.php'; | |
| 58 | +/* | |
| 59 | + * Debug: Cross-check with MySQL. | |
| 60 | + * This is for debugging purpose only and requires files | |
| 61 | + * that are present in the GitHub repository | |
| 62 | + * but not the plugin published on WordPress.org. | |
| 63 | + */ | |
| 64 | +$crosscheck_tests_file_path = dirname( __DIR__, 2 ) . '/tests/class-wp-sqlite-crosscheck-db.php'; | |
| 65 | +if ( defined( 'SQLITE_DEBUG_CROSSCHECK' ) && SQLITE_DEBUG_CROSSCHECK && file_exists( $crosscheck_tests_file_path ) ) { | |
| 66 | + require_once $crosscheck_tests_file_path; | |
| 67 | + $GLOBALS['wpdb'] = new WP_SQLite_Crosscheck_DB( DB_NAME ); | |
| 68 | +} else { | |
| 69 | + $GLOBALS['wpdb'] = new WP_SQLite_DB( DB_NAME ); | |
| 70 | +} | |