PluginProbe
SQLite Database Integration / 2.2.4
SQLite Database Integration v2.2.4
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 2.2.4 All 31 releases
sqlite-database-integration / db.copy

db.copy in SQLite Database Integration 2.2.4, at db.copy

59 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: SQLite integration (Drop-in)
4 * Version: 1.0.0
5 * Author: WordPress Performance Team
6 * Author URI: https://make.wordpress.org/performance/
7 *
8 * This file is auto-generated and copied from the sqlite plugin.
9 * Please don't edit this file directly.
10 *
11 * @package wp-sqlite-integration
12 */
13
14 define( 'SQLITE_DB_DROPIN_VERSION', '1.8.0' );
15
16 // Tweak to allow copy-pasting the file without having to run string-replacements.
17 $sqlite_plugin_implementation_folder_path = '{SQLITE_IMPLEMENTATION_FOLDER_PATH}';
18 if ( ! file_exists( $sqlite_plugin_implementation_folder_path ) ) { // Check that the folder exists.
19 $sqlite_plugin_implementation_folder_path = realpath( __DIR__ . '/plugins/sqlite-database-integration' );
20 }
21
22 // Bail early if the SQLite implementation was not located in the plugin.
23 if ( ! $sqlite_plugin_implementation_folder_path || ! file_exists( $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php' ) ) {
24 return;
25 }
26
27 // Constant for backward compatibility.
28 if ( ! defined( 'DATABASE_TYPE' ) ) {
29 define( 'DATABASE_TYPE', 'sqlite' );
30 }
31 // Define SQLite constant.
32 if ( ! defined( 'DB_ENGINE' ) ) {
33 define( 'DB_ENGINE', 'sqlite' );
34 }
35
36 // Require the implementation from the plugin.
37 require_once $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php';
38
39 // Activate the performance-lab plugin if it is not already activated.
40 add_action(
41 'admin_footer',
42 function() {
43 if ( defined( 'SQLITE_MAIN_FILE' ) ) {
44 return;
45 }
46 if ( ! function_exists( 'activate_plugin' ) ) {
47 require_once ABSPATH . 'wp-admin/includes/plugin.php';
48 }
49 if ( is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) {
50 // If `activate_plugin()` returns a value other than null (like WP_Error),
51 // the plugin could not be found. Try with a hardcoded string,
52 // because that probably means the file was directly copy-pasted.
53 if ( null !== activate_plugin( '{SQLITE_PLUGIN}', '', false, true ) ) {
54 activate_plugin( 'sqlite-database-integration/load.php', '', false, true );
55 }
56 }
57 }
58 );
59