Merge pull request #31373 from woocommerce/fix/28459
Db version option consistency
This commit is contained in:
commit
bd5cf4adca
|
@ -514,7 +514,7 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td data-export-label="WC Database Version"><?php esc_html_e( 'WooCommerce database version', 'woocommerce' ); ?>:</td>
|
<td data-export-label="WC Database Version"><?php esc_html_e( 'WooCommerce database version', 'woocommerce' ); ?>:</td>
|
||||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The database version for WooCommerce. Note that it may not match WooCommerce core version and that is normal.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
<td class="help"><?php echo wc_help_tip( esc_html__( 'The database version for WooCommerce. This should be the same as your WooCommerce version.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||||
<td><?php echo esc_html( $database['wc_database_version'] ); ?></td>
|
<td><?php echo esc_html( $database['wc_database_version'] ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -180,6 +180,7 @@ class WC_Install {
|
||||||
add_action( 'admin_init', array( __CLASS__, 'wc_admin_db_update_notice' ) );
|
add_action( 'admin_init', array( __CLASS__, 'wc_admin_db_update_notice' ) );
|
||||||
add_action( 'admin_init', array( __CLASS__, 'add_admin_note_after_page_created' ) );
|
add_action( 'admin_init', array( __CLASS__, 'add_admin_note_after_page_created' ) );
|
||||||
add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) );
|
add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) );
|
||||||
|
add_action( 'woocommerce_update_db_to_current_version', array( __CLASS__, 'update_db_version' ) );
|
||||||
add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
|
add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
|
||||||
add_action( 'woocommerce_page_created', array( __CLASS__, 'page_created' ), 10, 2 );
|
add_action( 'woocommerce_page_created', array( __CLASS__, 'page_created' ), 10, 2 );
|
||||||
add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
|
add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
|
||||||
|
@ -487,6 +488,20 @@ class WC_Install {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After the callbacks finish, update the db version to the current WC version.
|
||||||
|
$current_wc_version = WC()->version;
|
||||||
|
if ( version_compare( $current_db_version, $current_wc_version, '<' ) &&
|
||||||
|
! WC()->queue()->get_next( 'woocommerce_update_db_to_current_version' ) ) {
|
||||||
|
WC()->queue()->schedule_single(
|
||||||
|
time() + $loop,
|
||||||
|
'woocommerce_update_db_to_current_version',
|
||||||
|
array(
|
||||||
|
'version' => $current_wc_version,
|
||||||
|
),
|
||||||
|
'woocommerce-db-updates'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue