PluginProbe
Performance Lab / 1.8.0
Performance Lab v1.8.0
trunk 1.0.0 1.0.0-beta.1 1.0.0-beta.2 1.0.0-beta.3 1.0.0-rc.1 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.7.0 2.8.0 All 44 releases
performance-lab / modules / database / sqlite / load.php

load.php in Performance Lab 1.8.0, at modules/database/sqlite/load.php

61 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 * Module Name: SQLite Integration
4 * Description: Use an SQLite database instead of MySQL.
5 * Experimental: Yes
6 *
7 * @package performance-lab
8 * @since 1.8.0
9 */
10
11 /**
12 * Require the site-health tweaks.
13 */
14 require_once __DIR__ . '/site-health.php';
15
16 /**
17 * Add admin notices.
18 *
19 * When the plugin gets merged in wp-core, this is not to be ported.
20 *
21 * @since 1.8.0
22 */
23 function perflab_sqlite_plugin_admin_notice() {
24 // Bail early if the PERFLAB_SQLITE_DB_DROPIN_VERSION is defined.
25 if ( defined( 'PERFLAB_SQLITE_DB_DROPIN_VERSION' ) ) {
26 return;
27 }
28
29 /*
30 * If the PERFLAB_SQLITE_DB_DROPIN_VERSION constant is not defined
31 * but there's a db.php file in the wp-content directory, then the module can't be activated.
32 * The module should not have been activated in the first place
33 * (there's a check in the can-load.php file), but this is a fallback check.
34 */
35 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
36 printf(
37 '<div class="notice notice-error"><p>%s</p></div>',
38 sprintf(
39 /* translators: 1: PERFLAB_SQLITE_DB_DROPIN_VERSION constant, 2: db.php drop-in path */
40 __( 'The SQLite Integration module is active, but the %1$s constant is missing. It appears you already have another %2$s file present on your site. ', 'performance-lab' ),
41 '<code>PERFLAB_SQLITE_DB_DROPIN_VERSION</code>',
42 '<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
43 )
44 );
45
46 return;
47 }
48
49 // The dropin db.php is missing.
50 printf(
51 '<div class="notice notice-error"><p>%s</p></div>',
52 sprintf(
53 /* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */
54 __( 'The SQLite Integration module is active, but the %1$s file is missing. Please <a href="%2$s">deactivate the module</a> and re-activate it to try again.', 'performance-lab' ),
55 '<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>',
56 esc_url( admin_url( 'options-general.php?page=' . PERFLAB_MODULES_SCREEN ) )
57 )
58 );
59 }
60 add_action( 'admin_notices', 'perflab_sqlite_plugin_admin_notice' ); // Add the admin notices.
61