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
This commit is contained in:
Sergey Biryukov 2020-07-22 12:56:04 +00:00
parent 6f0b8e2b2b
commit 3db2c3afd4
2 changed files with 7 additions and 3 deletions

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

View File

@ -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.