WordPress.org

Make WordPress Core

Ticket #47710: 47710.1.patch

File 47710.1.patch, 4.3 KB (added by dkarfa, 15 months ago)
  • wp-admin/admin.php

     
    3131        define( 'WP_LOAD_IMPORTERS', true );
    3232}
    3333
    34 require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
     34require_once dirname( dirname( __FILE__ ) ) . '/wp-load.php';
    3535
    3636nocache_headers();
    3737
     
    4949        if ( ! is_multisite() ) {
    5050                wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
    5151                exit;
     52        }
    5253
    53                 /**
    54                  * Filters whether to attempt to perform the multisite DB upgrade routine.
    55                  *
    56                  * In single site, the user would be redirected to wp-admin/upgrade.php.
    57                  * In multisite, the DB upgrade routine is automatically fired, but only
    58                  * when this filter returns true.
    59                  *
    60                  * If the network is 50 sites or less, it will run every time. Otherwise,
    61                  * it will throttle itself to reduce load.
    62                  *
    63                  * @since 3.0.0
    64                  *
    65                  * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
    66                  */
    67         } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
     54        /**
     55         * Filters whether to attempt to perform the multisite DB upgrade routine.
     56         *
     57         * In single site, the user would be redirected to wp-admin/upgrade.php.
     58         * In multisite, the DB upgrade routine is automatically fired, but only
     59         * when this filter returns true.
     60         *
     61         * If the network is 50 sites or less, it will run every time. Otherwise,
     62         * it will throttle itself to reduce load.
     63         *
     64         * @since 3.0.0
     65         *
     66         * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
     67         */
     68        $do_mu_upgrade = apply_filters( 'do_mu_upgrade', true );
     69
     70        if ( $do_mu_upgrade ) {
    6871                $c = get_blog_count();
    6972
    7073                /*
     
    7275                 * attempt to do no more than threshold value, with some +/- allowed.
    7376                 */
    7477                if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) == 1 ) ) {
    75                         require_once( ABSPATH . WPINC . '/http.php' );
     78                        require_once ABSPATH . WPINC . '/http.php';
    7679                        $response = wp_remote_get(
    7780                                admin_url( 'upgrade.php?step=1' ),
    7881                                array(
     
    8891        }
    8992}
    9093
    91 require_once( ABSPATH . 'wp-admin/includes/admin.php' );
     94require_once ABSPATH . 'wp-admin/includes/admin.php';
    9295
    9396auth_redirect();
    9497
     
    145148}
    146149
    147150if ( WP_NETWORK_ADMIN ) {
    148         require( ABSPATH . 'wp-admin/network/menu.php' );
     151        require ABSPATH . 'wp-admin/network/menu.php';
    149152} elseif ( WP_USER_ADMIN ) {
    150         require( ABSPATH . 'wp-admin/user/menu.php' );
     153        require ABSPATH . 'wp-admin/user/menu.php';
    151154} else {
    152         require( ABSPATH . 'wp-admin/menu.php' );
     155        require ABSPATH . 'wp-admin/menu.php';
    153156}
    154157
    155158if ( current_user_can( 'manage_options' ) ) {
     
    230233                 */
    231234                do_action( "load-{$page_hook}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    232235                if ( ! isset( $_GET['noheader'] ) ) {
    233                         require_once( ABSPATH . 'wp-admin/admin-header.php' );
     236                        require_once ABSPATH . 'wp-admin/admin-header.php';
    234237                }
    235238
    236239                /**
     
    275278                do_action( "load-{$plugin_page}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    276279
    277280                if ( ! isset( $_GET['noheader'] ) ) {
    278                         require_once( ABSPATH . 'wp-admin/admin-header.php' );
     281                        require_once ABSPATH . 'wp-admin/admin-header.php';
    279282                }
    280283
    281284                if ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) {
    282                         include( WPMU_PLUGIN_DIR . "/$plugin_page" );
     285                        include WPMU_PLUGIN_DIR . "/$plugin_page";
    283286                } else {
    284                         include( WP_PLUGIN_DIR . "/$plugin_page" );
     287                        include WP_PLUGIN_DIR . "/$plugin_page";
    285288                }
    286289        }
    287290
    288         include( ABSPATH . 'wp-admin/admin-footer.php' );
     291        include ABSPATH . 'wp-admin/admin-footer.php';
    289292
    290293        exit();
    291294} elseif ( isset( $_GET['import'] ) ) {
     
    320323        $title        = __( 'Import' );
    321324
    322325        if ( ! isset( $_GET['noheader'] ) ) {
    323                 require_once( ABSPATH . 'wp-admin/admin-header.php' );
     326                require_once ABSPATH . 'wp-admin/admin-header.php';
    324327        }
    325328
    326         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     329        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    327330
    328331        define( 'WP_IMPORTING', true );
    329332
     
    343346
    344347        call_user_func( $wp_importers[ $importer ][2] );
    345348
    346         include( ABSPATH . 'wp-admin/admin-footer.php' );
     349        include ABSPATH . 'wp-admin/admin-footer.php';
    347350
    348351        // Make sure rules are flushed
    349352        flush_rewrite_rules( false );