PluginProbe
SQLite Database Integration / 2.2.0
SQLite Database Integration v2.2.0
3.0.2 3.0.1 trunk 2.1.13 2.1.14 2.1.15 2.1.16 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.17 2.2.18 2.2.19 2.2.2 2.2.20 2.2.21 2.2.22 2.2.23 2.2.3 All 32 releases
sqlite-database-integration / wp-includes / sqlite / db.php

db.php in SQLite Database Integration 2.2.0, at wp-includes/sqlite/db.php

71 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main integration file.
4 *
5 * @package wp-sqlite-integration
6 * @since 1.0.0
7 */
8
9 /**
10 * Load the "SQLITE_DRIVER_VERSION" constant.
11 */
12 require_once dirname( __DIR__, 2 ) . '/version.php';
13
14 // Require the constants file.
15 require_once dirname( __DIR__, 2 ) . '/constants.php';
16
17 // Bail early if DB_ENGINE is not defined as sqlite.
18 if ( ! defined( 'DB_ENGINE' ) || 'sqlite' !== DB_ENGINE ) {
19 return;
20 }
21
22 if ( ! extension_loaded( 'pdo' ) ) {
23 wp_die(
24 new WP_Error(
25 'pdo_not_loaded',
26 sprintf(
27 '<h1>%1$s</h1><p>%2$s</p>',
28 'PHP PDO Extension is not loaded',
29 'Your PHP installation appears to be missing the PDO extension which is required for this version of WordPress and the type of database you have specified.'
30 )
31 ),
32 'PHP PDO Extension is not loaded.'
33 );
34 }
35
36 if ( ! extension_loaded( 'pdo_sqlite' ) ) {
37 wp_die(
38 new WP_Error(
39 'pdo_driver_not_loaded',
40 sprintf(
41 '<h1>%1$s</h1><p>%2$s</p>',
42 'PDO Driver for SQLite is missing',
43 'Your PHP installation appears not to have the right PDO drivers loaded. These are required for this version of WordPress and the type of database you have specified.'
44 )
45 ),
46 'PDO Driver for SQLite is missing.'
47 );
48 }
49
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';
55 require_once __DIR__ . '/class-wp-sqlite-db.php';
56 require_once __DIR__ . '/install-functions.php';
57
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 }
71