Skip to content

Commit b8d04a8

Browse files
committed
fix admin page when using SQLite
1 parent fdef5a6 commit b8d04a8

1 file changed

Lines changed: 47 additions & 31 deletions

File tree

admin-page.php

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,59 @@ function sqlite_integration_admin_screen() {
3333
</div>
3434
<!-- Set the wrapper width to 50em, to improve readability. -->
3535
<div style="max-width:50em;">
36-
<?php if ( ! class_exists( 'SQLite3' ) ) : ?>
37-
<div class="notice notice-error">
38-
<p><?php esc_html_e( 'We detected that the SQLite3 class is missing from your server. Please make sure that SQLite is enabled in your PHP installation before proceeding.', 'sqlite' ); ?></p>
36+
<?php if ( defined( 'SQLITE_DB_DROPIN_VERSION' ) ) : ?>
37+
<div class="notice notice-success">
38+
<p><?php esc_html_e( 'SQLite is enabled.', 'sqlite' ); ?></p>
3939
</div>
40-
<?php elseif ( file_exists( WP_CONTENT_DIR . '/db.php' ) && ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) : ?>
41-
<div class="notice notice-error">
42-
<p>
43-
<?php
40+
<p>
41+
<?php
4442
printf(
45-
/* translators: %s: db.php drop-in path */
46-
esc_html__( 'The SQLite plugin cannot be activated because a different %s drop-in already exists.', 'sqlite' ),
43+
/* translators: 1: Admin URL to deactivate the module, 2: db.php drop-in path, */
44+
__( 'The SQLite drop-in is enabled. To disable it and get back to your previous, MySQL database, you can <a href="%1$s">deactivate the plugin</a>. Alternatively, you can manually delete the %2$s file from your server.', 'sqlite' ),
45+
esc_url( admin_url( 'plugins.php' ) ),
4746
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
4847
);
49-
?>
50-
</p>
51-
</div>
52-
<?php elseif ( ! is_writable( WP_CONTENT_DIR ) ) : ?>
53-
<div class="notice notice-error">
54-
<p>
55-
<?php
56-
printf(
57-
/* translators: %s: db.php drop-in path */
58-
esc_html__( 'The SQLite plugin cannot be activated because the %s directory is not writable.', 'sqlite' ),
59-
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '</code>'
60-
);
61-
?>
62-
</p>
63-
</div>
48+
?>
49+
</p>
6450
<?php else : ?>
65-
<div class="notice notice-success">
66-
<p><?php esc_html_e( 'All checks completed successfully, your site can use an SQLite database. You can proceed with the installation.', 'sqlite' ); ?></p>
67-
</div>
68-
<h2><?php esc_html_e( 'Important note', 'sqlite' ); ?></h2>
69-
<p><?php esc_html_e( 'This plugin will switch to a separate database and install WordPress in it. You will need to reconfigure your site, and start with a fresh site. Disabling the plugin you will get back to your previous MySQL database, with all your previous data intact.', 'sqlite' ); ?></p>
70-
<p><?php esc_html_e( 'By clicking the button below, you will be redirected to the WordPress installation screen to setup your new database', 'sqlite' ); ?></p>
51+
<?php if ( ! class_exists( 'SQLite3' ) ) : ?>
52+
<div class="notice notice-error">
53+
<p><?php esc_html_e( 'We detected that the SQLite3 class is missing from your server. Please make sure that SQLite is enabled in your PHP installation before proceeding.', 'sqlite' ); ?></p>
54+
</div>
55+
<?php elseif ( file_exists( WP_CONTENT_DIR . '/db.php' ) && ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) : ?>
56+
<div class="notice notice-error">
57+
<p>
58+
<?php
59+
printf(
60+
/* translators: %s: db.php drop-in path */
61+
esc_html__( 'The SQLite plugin cannot be activated because a different %s drop-in already exists.', 'sqlite' ),
62+
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
63+
);
64+
?>
65+
</p>
66+
</div>
67+
<?php elseif ( ! is_writable( WP_CONTENT_DIR ) ) : ?>
68+
<div class="notice notice-error">
69+
<p>
70+
<?php
71+
printf(
72+
/* translators: %s: db.php drop-in path */
73+
esc_html__( 'The SQLite plugin cannot be activated because the %s directory is not writable.', 'sqlite' ),
74+
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '</code>'
75+
);
76+
?>
77+
</p>
78+
</div>
79+
<?php else : ?>
80+
<div class="notice notice-success">
81+
<p><?php esc_html_e( 'All checks completed successfully, your site can use an SQLite database. You can proceed with the installation.', 'sqlite' ); ?></p>
82+
</div>
83+
<h2><?php esc_html_e( 'Important note', 'sqlite' ); ?></h2>
84+
<p><?php esc_html_e( 'This plugin will switch to a separate database and install WordPress in it. You will need to reconfigure your site, and start with a fresh site. Disabling the plugin you will get back to your previous MySQL database, with all your previous data intact.', 'sqlite' ); ?></p>
85+
<p><?php esc_html_e( 'By clicking the button below, you will be redirected to the WordPress installation screen to setup your new database', 'sqlite' ); ?></p>
7186

72-
<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=sqlite-integration&confirm-install' ), 'sqlite-install' ) ); ?>"><?php esc_html_e( 'Install SQLite database', 'sqlite' ); ?></a>
87+
<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=sqlite-integration&confirm-install' ), 'sqlite-install' ) ); ?>"><?php esc_html_e( 'Install SQLite database', 'sqlite' ); ?></a>
88+
<?php endif; ?>
7389
<?php endif; ?>
7490
</div>
7591
<?php

0 commit comments

Comments
 (0)