PluginProbe
SQLite Database Integration / 3.0.2
SQLite Database Integration v3.0.2
3.0.2 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 All 32 releases
sqlite-database-integration / db.copy

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

65 lines 2.1 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.8.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
12 define( 'SQLITE_DB_DROPIN_VERSION', '1.8.0' );
13
14 // Tweak to allow copy-pasting the file without having to run string-replacements.
15 $sqlite_plugin_implementation_folder_path = '{SQLITE_IMPLEMENTATION_FOLDER_PATH}';
16 if ( ! file_exists( $sqlite_plugin_implementation_folder_path ) ) { // Check that the folder exists.
17 $sqlite_plugin_implementation_folder_path = realpath( __DIR__ . '/plugins/sqlite-database-integration' );
18 }
19
20 // Bail early if the SQLite implementation was not located in the plugin.
21 if ( ! $sqlite_plugin_implementation_folder_path || ! file_exists( $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php' ) ) {
22 return;
23 }
24
25 /**
26 * Legacy database type marker.
27 *
28 * @deprecated 3.0.0 Use DB_ENGINE instead.
29 */
30 if ( ! defined( 'DATABASE_TYPE' ) ) {
31 define( 'DATABASE_TYPE', 'sqlite' );
32 }
33
34 // Define SQLite constant.
35 if ( ! defined( 'DB_ENGINE' ) ) {
36 define( 'DB_ENGINE', 'sqlite' );
37 }
38
39 // Require the implementation from the plugin.
40 require_once $sqlite_plugin_implementation_folder_path . '/wp-includes/sqlite/db.php';
41
42 // Activate the SQLite Database Integration plugin if it is not already activated.
43 add_action(
44 'admin_footer',
45 function() {
46 if ( defined( 'SQLITE_MAIN_FILE' ) ) {
47 return;
48 }
49 if ( ! function_exists( 'activate_plugin' ) ) {
50 require_once ABSPATH . 'wp-admin/includes/plugin.php';
51 }
52
53 $plugin_path = WP_PLUGIN_DIR . '/' . '{SQLITE_PLUGIN}';
54
55 if ( file_exists( $plugin_path ) && is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) {
56 // If `activate_plugin()` returns a value other than null (like WP_Error),
57 // the plugin could not be found. Try with a hardcoded string,
58 // because that probably means the file was directly copy-pasted.
59 if ( null !== activate_plugin( '{SQLITE_PLUGIN}', '', false, true ) ) {
60 activate_plugin( 'sqlite-database-integration/load.php', '', false, true );
61 }
62 }
63 }
64 );
65