Add nonce to update WC database URL
Doing this to check if the user has intention to perform a WC database update before starting the process.
This commit is contained in:
parent
860e3e6d93
commit
a200686005
|
@ -9,13 +9,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$update_url = wp_nonce_url(
|
||||
add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ),
|
||||
'wc_db_update',
|
||||
'wc_db_update_nonce'
|
||||
);
|
||||
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<p>
|
||||
<strong><?php esc_html_e( 'WooCommerce data update', 'woocommerce' ); ?></strong> – <?php esc_html_e( 'We need to update your store database to the latest version.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<a href="<?php echo esc_url( add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="wc-update-now button-primary">
|
||||
<a href="<?php echo esc_url( $update_url ); ?>" class="wc-update-now button-primary">
|
||||
<?php esc_html_e( 'Run the updater', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
@ -155,7 +155,8 @@ class WC_Install {
|
|||
* This function is hooked into admin_init to affect admin only.
|
||||
*/
|
||||
public static function install_actions() {
|
||||
if ( ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok.
|
||||
if ( ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok.
|
||||
check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' );
|
||||
self::update();
|
||||
WC_Admin_Notices::add_notice( 'update' );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue