Make WordPress Core

Ticket #39459: 39459.diff

File 39459.diff, 844 bytes (added by jgrodel, 7 years ago)

checks if doing ajax before doing upgrades

  • wp-admin/admin.php

    diff --git a/wp-admin/admin.php b/wp-admin/admin.php
    index 88a4aa4..6591e9b 100644
    a b require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); 
    3232
    3333nocache_headers();
    3434
    35 if ( get_option('db_upgraded') ) {
     35if ( ! wp_doing_ajax() && get_option( 'db_upgraded' ) ) {
    3636        flush_rewrite_rules();
    3737        update_option( 'db_upgraded',  false );
    3838
    if ( get_option('db_upgraded') ) { 
    4242         * @since 2.8.0
    4343         */
    4444        do_action( 'after_db_upgrade' );
    45 } elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
     45} elseif ( ! wp_doing_ajax() &&
     46        get_option( 'db_version' ) != $wp_db_version &&
     47        empty($_POST)
     48) {
    4649        if ( !is_multisite() ) {
    4750                wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
    4851                exit;