| 1 |
<?php |
| 2 |
/** |
| 3 |
* Define constants for the SQLite implementation. |
| 4 |
* |
| 5 |
* @since 1.0.0 |
| 6 |
* @package wp-sqlite-integration |
| 7 |
*/ |
| 8 |
|
| 9 |
// Temporary - This will be in wp-config.php once SQLite is merged in Core. |
| 10 |
if ( ! defined( 'DB_ENGINE' ) ) { |
| 11 |
if ( defined( 'SQLITE_DB_DROPIN_VERSION' ) ) { |
| 12 |
define( 'DB_ENGINE', 'sqlite' ); |
| 13 |
} elseif ( defined( 'DATABASE_ENGINE' ) ) { |
| 14 |
// backwards compatibility with previous versions of the plugin. |
| 15 |
define( 'DB_ENGINE', DATABASE_ENGINE ); |
| 16 |
} else { |
| 17 |
define( 'DB_ENGINE', 'mysql' ); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Notice: |
| 23 |
* Your scripts have the permission to create directories or files on your server. |
| 24 |
* If you write in your wp-config.php like below, we take these definitions. |
| 25 |
* define('DB_DIR', '/full_path_to_the_database_directory/'); |
| 26 |
* define('DB_FILE', 'database_file_name'); |
| 27 |
*/ |
| 28 |
|
| 29 |
/** |
| 30 |
* FQDBDIR is a directory where the sqlite database file is placed. |
| 31 |
* If DB_DIR is defined, it is used as FQDBDIR. |
| 32 |
*/ |
| 33 |
if ( ! defined( 'FQDBDIR' ) ) { |
| 34 |
if ( defined( 'DB_DIR' ) ) { |
| 35 |
define( 'FQDBDIR', trailingslashit( DB_DIR ) ); |
| 36 |
} elseif ( defined( 'WP_CONTENT_DIR' ) ) { |
| 37 |
define( 'FQDBDIR', WP_CONTENT_DIR . '/database/' ); |
| 38 |
} else { |
| 39 |
define( 'FQDBDIR', ABSPATH . 'wp-content/database/' ); |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* FQDB is a database file name. If DB_FILE is defined, it is used |
| 45 |
* as FQDB. |
| 46 |
*/ |
| 47 |
if ( ! defined( 'FQDB' ) ) { |
| 48 |
if ( defined( 'DB_FILE' ) ) { |
| 49 |
define( 'FQDB', FQDBDIR . DB_FILE ); |
| 50 |
} else { |
| 51 |
define( 'FQDB', FQDBDIR . '.ht.sqlite' ); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
// Allow enabling the SQLite AST driver via environment variable. |
| 56 |
if ( ! defined( 'WP_SQLITE_AST_DRIVER' ) && isset( $_ENV['WP_SQLITE_AST_DRIVER'] ) && 'true' === $_ENV['WP_SQLITE_AST_DRIVER'] ) { |
| 57 |
define( 'WP_SQLITE_AST_DRIVER', true ); |
| 58 |
} |
| 59 |
|