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
This commit is contained in:
Sergey Biryukov 2020-07-22 12:54:22 +00:00
parent 60dc387ce9
commit d2a1fb965d

View File

@ -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 ) ) );
}