| @@ -1,15 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: SQLite integration (Drop-in) |
| 4 | - * Version: 1.0.0 | |
| 4 | + * Version: 1.8.0 | |
| 5 | 5 | * Author: WordPress Performance Team |
| 6 | 6 | * Author URI: https://make.wordpress.org/performance/ |
| 7 | 7 | * |
| 8 | 8 | * This file is auto-generated and copied from the sqlite plugin. |
| 9 | 9 | * Please don't edit this file directly. |
| 10 | - * | |
| 11 | - * @package wp-sqlite-integration | |
| 12 | 10 | */ |
| 13 | 11 | |
| 14 | 12 | define( 'SQLITE_DB_DROPIN_VERSION', '1.8.0' ); |
| 15 | 13 | |
| @@ -23,12 +21,17 @@ | ||
| 23 | 21 | if ( ! $sqlite_plugin_implementation_folder_path || ! file_exists( $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php' ) ) { |
| 24 | 22 | return; |
| 25 | 23 | } |
| 26 | 24 | |
| 27 | -// Constant for backward compatibility. | |
| 25 | +/** | |
| 26 | + * Legacy database type marker. | |
| 27 | + * | |
| 28 | + * @deprecated 3.0.0 Use DB_ENGINE instead. | |
| 29 | + */ | |
| 28 | 30 | if ( ! defined( 'DATABASE_TYPE' ) ) { |
| 29 | 31 | define( 'DATABASE_TYPE', 'sqlite' ); |
| 30 | 32 | } |
| 33 | + | |
| 31 | 34 | // Define SQLite constant. |
| 32 | 35 | if ( ! defined( 'DB_ENGINE' ) ) { |
| 33 | 36 | define( 'DB_ENGINE', 'sqlite' ); |
| 34 | 37 | } |
| @@ -35,9 +38,9 @@ | ||
| 35 | 38 | |
| 36 | 39 | // Require the implementation from the plugin. |
| 37 | 40 | require_once $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php'; |
| 38 | 41 | |
| 39 | -// Activate the performance-lab plugin if it is not already activated. | |
| 42 | +// Activate the SQLite Database Integration plugin if it is not already activated. | |
| 40 | 43 | add_action( |
| 41 | 44 | 'admin_footer', |
| 42 | 45 | function() { |
| 43 | 46 | if ( defined( 'SQLITE_MAIN_FILE' ) ) { |
| @@ -45,9 +48,12 @@ | ||
| 45 | 48 | } |
| 46 | 49 | if ( ! function_exists( 'activate_plugin' ) ) { |
| 47 | 50 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 48 | 51 | } |
| 49 | - if ( is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) { | |
| 52 | + | |
| 53 | + $plugin_path = WP_PLUGIN_DIR . '/' . '{SQLITE_PLUGIN}'; | |
| 54 | + | |
| 55 | + if ( file_exists( $plugin_path ) && is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) { | |
| 50 | 56 | // If `activate_plugin()` returns a value other than null (like WP_Error), |
| 51 | 57 | // the plugin could not be found. Try with a hardcoded string, |
| 52 | 58 | // because that probably means the file was directly copy-pasted. |
| 53 | 59 | if ( null !== activate_plugin( '{SQLITE_PLUGIN}', '', false, true ) ) { |