| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main integration file. |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Load the "SQLITE_DRIVER_VERSION" constant. |
| 8 |
*/ |
| 9 |
require_once __DIR__ . '/../database/version.php'; |
| 10 |
|
| 11 |
// Require the constants file. |
| 12 |
require_once __DIR__ . '/../../constants.php'; |
| 13 |
|
| 14 |
// Bail early if DB_ENGINE is not defined as sqlite. |
| 15 |
if ( ! defined( 'DB_ENGINE' ) || 'sqlite' !== DB_ENGINE ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
if ( ! extension_loaded( 'pdo' ) ) { |
| 20 |
wp_die( |
| 21 |
new WP_Error( |
| 22 |
'pdo_not_loaded', |
| 23 |
sprintf( |
| 24 |
'<h1>%1$s</h1><p>%2$s</p>', |
| 25 |
'PHP PDO Extension is not loaded', |
| 26 |
'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.' |
| 27 |
) |
| 28 |
), |
| 29 |
'PHP PDO Extension is not loaded.' |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
if ( ! extension_loaded( 'pdo_sqlite' ) ) { |
| 34 |
wp_die( |
| 35 |
new WP_Error( |
| 36 |
'pdo_driver_not_loaded', |
| 37 |
sprintf( |
| 38 |
'<h1>%1$s</h1><p>%2$s</p>', |
| 39 |
'PDO Driver for SQLite is missing', |
| 40 |
'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.' |
| 41 |
) |
| 42 |
), |
| 43 |
'PDO Driver for SQLite is missing.' |
| 44 |
); |
| 45 |
} |
| 46 |
|
| 47 |
require_once __DIR__ . '/../database/load.php'; |
| 48 |
require_once __DIR__ . '/class-wp-sqlite-db.php'; |
| 49 |
require_once __DIR__ . '/install-functions.php'; |
| 50 |
|
| 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'; |
| 56 |
|