File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,8 +70,14 @@ function sqlite_plugin_copy_db_file() {
7070
7171 // Get the db.copy.php file contents, replace placeholders and write it to the destination.
7272 $ file_contents = str_replace (
73- '{SQLITE_IMPLEMENTATION_FOLDER_PATH} ' ,
74- __DIR__ ,
73+ array (
74+ '{SQLITE_IMPLEMENTATION_FOLDER_PATH} ' ,
75+ '{SQLITE_PLUGIN} ' ,
76+ ),
77+ array (
78+ __DIR__ ,
79+ str_replace ( WP_PLUGIN_DIR . '/ ' , '' , SQLITE_MAIN_FILE ),
80+ ),
7581 file_get_contents ( __DIR__ . '/db.copy ' )
7682 );
7783
Original file line number Diff line number Diff line change @@ -25,3 +25,19 @@ if ( ! defined( 'DATABASE_TYPE' ) ) {
2525
2626// Require the implementation from the plugin.
2727require_once '{SQLITE_IMPLEMENTATION_FOLDER_PATH}/wp-includes/sqlite/db.php';
28+
29+ // Activate the performance-lab plugin if it is not already activated.
30+ add_action(
31+ 'init',
32+ function() {
33+ if ( defined( 'SQLITE_MAIN_FILE' ) ) {
34+ return;
35+ }
36+ if ( ! function_exists( 'activate_plugin' ) ) {
37+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
38+ }
39+ if ( is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) {
40+ activate_plugin( '{SQLITE_PLUGIN}' );
41+ }
42+ }
43+ );
You can’t perform that action at this time.
0 commit comments