Skip to content

Commit 7eba205

Browse files
committed
fix admin notices
1 parent a42fc2e commit 7eba205

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

admin-notices.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function sqlite_plugin_admin_notice() {
3333
* The module should not have been activated in the first place
3434
* (there's a check in the can-load.php file), but this is a fallback check.
3535
*/
36-
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
36+
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) {
3737
printf(
3838
'<div class="notice notice-error"><p>%s</p></div>',
3939
sprintf(
@@ -45,31 +45,22 @@ function sqlite_plugin_admin_notice() {
4545
);
4646

4747
return;
48-
}
49-
50-
// The dropin db.php is missing.
51-
printf(
52-
'<div class="notice notice-error"><p>%s</p></div>',
53-
sprintf(
54-
/* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */
55-
__( 'The SQLite Integration plugin is active, but the %1$s file is missing. Please <a href="%2$s">deactivate the plugin</a> and re-activate it to try again.', 'sqlite' ),
56-
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>',
57-
esc_url( admin_url( 'plugins.php' ) )
58-
)
59-
);
60-
61-
// Check if the wp-content/db.php file exists.
62-
if ( ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
63-
if ( ! wp_is_writable( WP_CONTENT_DIR ) ) {
64-
printf(
65-
'<div class="notice notice-error"><p>%s</p></div>',
66-
esc_html__( 'The SQLite Integration plugin is active, but the wp-content/db.php file is missing and the wp-content directory is not writable. Please ensure the wp-content folder is writable, then deactivate the plugin and try again.', 'sqlite' )
67-
);
68-
return;
69-
}
48+
} elseif ( ! file_exists( WP_CONTENT_DIR . '/db.php' ) && ! wp_is_writable( WP_CONTENT_DIR ) ) {
7049
printf(
7150
'<div class="notice notice-error"><p>%s</p></div>',
72-
esc_html__( 'The SQLite Integration plugin is active, but the wp-content/db.php file is missing. Please deactivate the plugin and try again.', 'sqlite' )
51+
esc_html__( 'The SQLite Integration plugin is active, but the wp-content/db.php file is missing and the wp-content directory is not writable. Please ensure the wp-content folder is writable, then deactivate the plugin and try again.', 'sqlite' )
52+
);
53+
return;
54+
} elseif ( ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
55+
// The dropin db.php is missing.
56+
printf(
57+
'<div class="notice notice-error"><p>%s</p></div>',
58+
sprintf(
59+
/* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */
60+
__( 'The SQLite Integration plugin is active, but the %1$s file is missing. Please <a href="%2$s">deactivate the plugin</a> and re-activate it to try again.', 'sqlite' ),
61+
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>',
62+
esc_url( admin_url( 'plugins.php' ) )
63+
)
7364
);
7465
}
7566
}

0 commit comments

Comments
 (0)