Make WordPress Core


Ignore:
Timestamp:
08/27/2016 09:15:01 AM (9 years ago)
Author:
wonderboymusic
Message:

Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.

  • wp-admin and wp-includes are scanned for classes to autoload
  • Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see composer.json: autoload.exclude-from-classmap
  • wp-vendor/autoload_52.php is included at the top of wp-settings.php - no changes need to be made to unit tests to include the autoloader
  • An avalanche of require() and require_once() calls that loaded class files have been removed from the codebase.

The following files have been added to svn:ignore - they are not 5.2-compatible and fail during pre-commit:

  • src/wp-vendor/autoload.php
  • src/wp-vendor/composer/autoload_real.php
  • src/wp-vendor/composer/autoload_static.php
  • src/wp-vendor/composer/ClassLoader.php

We favor these files instead:

  • src/wp-vendor/autoload_52.php
  • src/wp-vendor/composer/autoload_real_52.php
  • src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run composer install or composer update from the project root to update the autoloader.

The future is now.

See #36335.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r37914 r38399  
    164164
    165165        if ( wp_http_supports( array( 'ssl' ) ) ) {
    166             require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    167166            $upgrader = new WP_Automatic_Updater;
    168167            $future_minor_update = (object) array(
     
    188187
    189188    if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
    190         require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    191189        $upgrader = new WP_Automatic_Updater;
    192190        if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
     
    439437    global $wp_filesystem;
    440438
    441     include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
    442 
    443439    if ( $reinstall )
    444440        $url = 'update-core.php?action=do-core-reinstall';
     
    711707
    712708    require_once( ABSPATH . 'wp-admin/admin-header.php' );
    713     include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
    714709
    715710    $url = 'update-core.php?action=do-translation-upgrade';
Note: See TracChangeset for help on using the changeset viewer.