WordPress.org

Make WordPress Core

Ticket #37584: WP_SHORTINIT_FUNCTIONS.patch

File WP_SHORTINIT_FUNCTIONS.patch, 3.9 KB (added by steveglick, 3 years ago)

Approach #2 using function calls after SHORTINIT than can be called manually

  • wp-settings.php

     
    124124
    125125register_shutdown_function( 'shutdown_action_hook' );
    126126
     127// Init functions
     128function wp_load_utils ( ) {
     129    require( ABSPATH . WPINC . '/class-wp-walker.php' );
     130    require( ABSPATH . WPINC . '/l10n.php' );
     131    require( ABSPATH . 'wp-admin/includes/admin.php' );
     132    require( ABSPATH . WPINC . '/formatting.php' );
     133    require( ABSPATH . WPINC . '/pluggable.php' );
     134    require( ABSPATH . WPINC . '/script-loader.php' );
     135    require( ABSPATH . WPINC . '/general-template.php' );
     136    require( ABSPATH . WPINC . '/link-template.php' );
     137    wp_functionality_constants();
     138}
     139
     140function wp_load_session ( ) {
     141    require( ABSPATH . WPINC . '/capabilities.php' );
     142    require( ABSPATH . WPINC . '/user.php' );
     143    require( ABSPATH . WPINC . '/meta.php' );
     144    require( ABSPATH . WPINC . '/class-wp-user.php' );
     145    require( ABSPATH . WPINC . '/class-wp-roles.php' );
     146    require( ABSPATH . WPINC . '/class-wp-role.php' );
     147    require( ABSPATH . WPINC . '/session.php' );
     148    wp_cookie_constants();
     149}
     150
    127151// Stop most of WordPress from being loaded if we just want the basics.
    128152if ( SHORTINIT )
    129         return false;
     153    return false;
    130154
    131 // Load the L10n library.
    132 require_once( ABSPATH . WPINC . '/l10n.php' );
    133 
    134155// Run the installer if WordPress is not installed.
    135156wp_not_installed();
    136157
     158// Call init functions
     159wp_load_utils();
     160wp_load_session();
     161
    137162// Load most of WordPress.
    138 require( ABSPATH . WPINC . '/class-wp-walker.php' );
    139163require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
    140 require( ABSPATH . WPINC . '/formatting.php' );
    141 require( ABSPATH . WPINC . '/capabilities.php' );
    142 require( ABSPATH . WPINC . '/class-wp-roles.php' );
    143 require( ABSPATH . WPINC . '/class-wp-role.php' );
    144 require( ABSPATH . WPINC . '/class-wp-user.php' );
    145164require( ABSPATH . WPINC . '/query.php' );
    146165require( ABSPATH . WPINC . '/date.php' );
    147166require( ABSPATH . WPINC . '/theme.php' );
    148167require( ABSPATH . WPINC . '/class-wp-theme.php' );
    149168require( ABSPATH . WPINC . '/template.php' );
    150 require( ABSPATH . WPINC . '/user.php' );
    151169require( ABSPATH . WPINC . '/class-wp-user-query.php' );
    152 require( ABSPATH . WPINC . '/session.php' );
    153 require( ABSPATH . WPINC . '/meta.php' );
    154170require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
    155171require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
    156 require( ABSPATH . WPINC . '/general-template.php' );
    157 require( ABSPATH . WPINC . '/link-template.php' );
    158172require( ABSPATH . WPINC . '/author-template.php' );
    159173require( ABSPATH . WPINC . '/post.php' );
    160174require( ABSPATH . WPINC . '/class-walker-page.php' );
     
    182196require( ABSPATH . WPINC . '/kses.php' );
    183197require( ABSPATH . WPINC . '/cron.php' );
    184198require( ABSPATH . WPINC . '/deprecated.php' );
    185 require( ABSPATH . WPINC . '/script-loader.php' );
    186199require( ABSPATH . WPINC . '/taxonomy.php' );
    187200require( ABSPATH . WPINC . '/class-wp-term.php' );
    188201require( ABSPATH . WPINC . '/class-wp-term-query.php' );
     
    249262 */
    250263do_action( 'muplugins_loaded' );
    251264
    252 if ( is_multisite() )
     265if ( is_multisite() ) {
    253266        ms_cookie_constants(  );
     267   
     268    // Redefine to ensure multisite functionality
     269    wp_cookie_constants (  );
     270    wp_functionality_constants (  );
     271}
    254272
    255 // Define constants after multisite is loaded.
    256 wp_cookie_constants();
    257 
    258273// Define and enforce our SSL constants
    259274wp_ssl_constants();
    260275
     
    277292unset( $plugin );
    278293
    279294// Load pluggable functions.
    280 require( ABSPATH . WPINC . '/pluggable.php' );
    281295require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
    282296
    283297// Set internal encoding.
     
    296310 */
    297311do_action( 'plugins_loaded' );
    298312
    299 // Define constants which affect functionality if not already defined.
    300 wp_functionality_constants();
    301 
    302313// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
    303314wp_magic_quotes();
    304315