From d2a1fb965d1feeb337eb96a69d8d0a66fbd9581d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 22 Jul 2020 12:54:22 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@48565 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/admin.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/admin.php b/src/wp-admin/admin.php index 5006b320b9..4ead0d51d2 100644 --- a/src/wp-admin/admin.php +++ b/src/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 ) ) ); }