| @@ -1,7 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Define constants for the SQLite implementation. |
| 4 | + * | |
| 5 | + * @since 1.0.0 | |
| 6 | + * @package wp-sqlite-integration | |
| 4 | 7 | */ |
| 5 | 8 | |
| 6 | 9 | // Temporary - This will be in wp-config.php once SQLite is merged in Core. |
| 7 | 10 | if ( ! defined( 'DB_ENGINE' ) ) { |
| @@ -6,8 +9,11 @@ | ||
| 6 | 9 | // Temporary - This will be in wp-config.php once SQLite is merged in Core. |
| 7 | 10 | if ( ! defined( 'DB_ENGINE' ) ) { |
| 8 | 11 | if ( defined( 'SQLITE_DB_DROPIN_VERSION' ) ) { |
| 9 | 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 ); | |
| 10 | 16 | } else { |
| 11 | 17 | define( 'DB_ENGINE', 'mysql' ); |
| 12 | 18 | } |
| 13 | 19 | } |
| @@ -22,10 +28,8 @@ | ||
| 22 | 28 | |
| 23 | 29 | /** |
| 24 | 30 | * FQDBDIR is a directory where the sqlite database file is placed. |
| 25 | 31 | * If DB_DIR is defined, it is used as FQDBDIR. |
| 26 | - * | |
| 27 | - * @deprecated 3.0.0 Define DB_DIR instead of overriding FQDBDIR. | |
| 28 | 32 | */ |
| 29 | 33 | if ( ! defined( 'FQDBDIR' ) ) { |
| 30 | 34 | if ( defined( 'DB_DIR' ) ) { |
| 31 | 35 | define( 'FQDBDIR', trailingslashit( DB_DIR ) ); |
| @@ -38,10 +42,8 @@ | ||
| 38 | 42 | |
| 39 | 43 | /** |
| 40 | 44 | * FQDB is a database file name. If DB_FILE is defined, it is used |
| 41 | 45 | * as FQDB. |
| 42 | - * | |
| 43 | - * @deprecated 3.0.0 Define DB_DIR and DB_FILE instead of overriding FQDB. | |
| 44 | 46 | */ |
| 45 | 47 | if ( ! defined( 'FQDB' ) ) { |
| 46 | 48 | if ( defined( 'DB_FILE' ) ) { |
| 47 | 49 | define( 'FQDB', FQDBDIR . DB_FILE ); |
| @@ -47,5 +49,10 @@ | ||
| 47 | 49 | define( 'FQDB', FQDBDIR . DB_FILE ); |
| 48 | 50 | } else { |
| 49 | 51 | define( 'FQDB', FQDBDIR . '.ht.sqlite' ); |
| 50 | 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 ); | |
| 51 | 58 | } |