From 3db2c3afd4da2aea3d443850369367a86c87a2f1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 22 Jul 2020 12:56:04 +0000 Subject: [PATCH] Upgrade/Install: Don't trigger database upgrade on Ajax requests via `wp-admin/async-upload.php`. Props schlessera, jgrodel, elrae, davidbaumwald, hareesh-pillai, adamsilverstein, SergeyBiryukov. Fixes #39459. Built from https://develop.svn.wordpress.org/trunk@48565 git-svn-id: http://core.svn.wordpress.org/trunk@48327 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 5006b320b9..4ead0d51d2 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -47,7 +47,9 @@ if ( get_option( 'db_upgraded' ) ) { */ do_action( 'after_db_upgrade' ); -} elseif ( (int) get_option( 'db_version' ) !== $wp_db_version && empty( $_POST ) ) { +} elseif ( ! wp_doing_ajax() && empty( $_POST ) + && (int) get_option( 'db_version' ) !== $wp_db_version +) { if ( ! is_multisite() ) { wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); @@ -260,7 +262,9 @@ if ( isset( $plugin_page ) ) { wp_die( __( 'Invalid plugin page.' ) ); } - if ( ! ( file_exists( WP_PLUGIN_DIR . "/$plugin_page" ) && is_file( WP_PLUGIN_DIR . "/$plugin_page" ) ) && ! ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) && is_file( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) ) { + if ( ! ( file_exists( WP_PLUGIN_DIR . "/$plugin_page" ) && is_file( WP_PLUGIN_DIR . "/$plugin_page" ) ) + && ! ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) && is_file( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) + ) { /* translators: %s: Admin page generated by a plugin. */ wp_die( sprintf( __( 'Cannot load %s.' ), htmlentities( $plugin_page ) ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index f1ed26bf47..ce7fa803ab 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta3-48564'; +$wp_version = '5.5-beta3-48565'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.