Skip to content

Commit dfde239

Browse files
author
Devin Walker
authored
Merge pull request impress-org#3167 from ravinderk/issues/3163
fix(db-update): prevent blank screen when updating 2.0.6 to 2.1.0 impress-org#3163
2 parents e22e2dd + f5d6f0d commit dfde239

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

includes/admin/upgrades/class-give-updates.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ public function __register_menu() {
243243
// Load plugin updates.
244244
$this->__register_plugin_addon_updates();
245245

246-
// Bailout.
247-
if ( ! $this->get_total_update_count() ) {
248-
return;
249-
}
250-
251246
// Bailout.
252247
if ( ! $this->get_total_update_count() ) {
253248
// Show complete update message if still on update setting page.
@@ -304,7 +299,7 @@ public function __redirect_admin() {
304299
) {
305300
delete_option( 'give_show_db_upgrade_complete_notice' );
306301

307-
wp_redirect( add_query_arg( array( 'give-db-update-completed' => 'give_db_upgrade_completed' ) ) );
302+
wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed' ) );
308303
exit();
309304
}
310305
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div id="give-db-updates" data-resume-update="0">
2+
<div class="postbox-container">
3+
<div class="postbox">
4+
<h2 class="hndle"><?php esc_html_e( 'Database Updates', 'give' ); ?></h2>
5+
<div class="inside">
6+
<div class="progress-container">
7+
<p class="update-message"><strong><?php esc_html_e( 'Updates Completed.', 'give' ) ?></strong></p>
8+
<div class="progress-content">
9+
<div class="notice-wrap give-clearfix">
10+
<div class="notice notice-success is-dismissible inline">
11+
<p><?php esc_html_e( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ) ?>
12+
</p>
13+
<button type="button" class="notice-dismiss"></button>
14+
</div>
15+
</div>
16+
</div>
17+
</div>
18+
</div>
19+
<!-- .inside -->
20+
</div><!-- .postbox -->
21+
</div>
22+
</div>
23+
<?php delete_option( 'give_show_db_upgrade_complete_notice' ); ?>

includes/admin/upgrades/views/upgrades.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
<div class="wrap" id="poststuff">
2020
<div id="give-updates">
2121
<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
22-
<hr class="wp-header-end">
23-
24-
<div class="give-update-panel-content">
25-
<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
26-
</div>
22+
<hr class="wp-header-end"
2723

2824
<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
2925
<?php if ( ! empty( $db_updates ) ) : ?>
@@ -33,6 +29,10 @@
3329
$resume_updates = get_option( 'give_doing_upgrade' );
3430
$width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
3531
?>
32+
<div class="give-update-panel-content">
33+
<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
34+
</div>
35+
3636
<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
3737
<div class="postbox-container">
3838
<div class="postbox">
@@ -108,6 +108,7 @@
108108
</div><!-- .postbox -->
109109
</div>
110110
</div>
111+
<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?>
111112
<?php endif; ?>
112113

113114
<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>

0 commit comments

Comments
 (0)