WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/27/2016 09:15:01 AM (4 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/includes/deprecated.php

    r38029 r38399  
    750750    static $num = 1;
    751751
    752     if ( ! class_exists( '_WP_Editors', false ) )
    753         require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
    754 
    755752    $editor_id = 'content' . $num++;
    756753
     
    11451142        add_filter('update_feedback', $feedback);
    11461143
    1147     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
    11481144    $upgrader = new Core_Upgrader();
    11491145    return $upgrader->upgrade($current);
     
    11681164        add_filter('update_feedback', $feedback);
    11691165
    1170     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
    11711166    $upgrader = new Plugin_Upgrader();
    11721167    return $upgrader->upgrade($plugin);
     
    11901185        add_filter('update_feedback', $feedback);
    11911186
    1192     include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
    11931187    $upgrader = new Theme_Upgrader();
    11941188    return $upgrader->upgrade($theme);
Note: See TracChangeset for help on using the changeset viewer.