Commit 981c243c authored by Eric Windham's avatar Eric Windham

Merge branch 'hotfix3.4.3' into 'develop'

Prevent users who just upgraded from 2.9x from seeing required updates for a week.

See merge request !3757
parents 5b25c759 de76b410
Pipeline #1145 passed with stages
in 1 minute and 32 seconds
......@@ -12,7 +12,10 @@ function ninja_forms_ajax_migrate_database(){
$nuke_multisite = false;
$migrations->nuke( $sure, $really_sure, $nuke_multisite );
$migrations->migrate();
// Reset our required updates.
delete_option( 'ninja_forms_required_updates' );
// Prevent recent 2.9x conversions from running required updates within a week.
set_transient( 'ninja_forms_prevent_updates', 'true', WEEK_IN_SECONDS );
echo json_encode( array( 'migrate' => 'true' ) );
wp_die();
}
......
......@@ -491,11 +491,14 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
$sql = "SELECT COUNT( `id` ) AS total FROM `{$wpdb->prefix}nf3_forms`;";
$result = $wpdb->get_results( $sql, 'ARRAY_A' );
$threshold = 10; // Threshold percentage for our required updates.
if ( get_transient( 'ninja_forms_prevent_updates' ) ) {
update_option( 'ninja_forms_needs_updates', 0 );
}
// If we got back a list of updates...
// AND If we have any forms on the site...
// AND If the gate is open...
// To avoid errors on older upgrades, ignore the gatekeeper if the db version is the baseline (1.0)...
if ( ! empty( $required_updates )
elseif ( ! empty( $required_updates )
&& 0 < $result[ 0 ][ 'total' ]
&& ( WPN_Helper::gated_release( $threshold )
|| '1.0' == self::$db_version ) ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment