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-vendor/composer/autoload_real_52.php

    r38395 r38399  
    33// autoload_real_52.php generated by xrstf/composer-php52
    44
    5 class ComposerAutoloaderInit472dba0eaffdca839125d11fca021b8d {
     5class ComposerAutoloaderInit9a99345398efdacf437a649bd4d2f18f {
    66    private static $loader;
    77
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit472dba0eaffdca839125d11fca021b8d', 'loadClassLoader'), true /*, true */);
     22        spl_autoload_register(array('ComposerAutoloaderInit9a99345398efdacf437a649bd4d2f18f', 'loadClassLoader'), true /*, true */);
    2323        self::$loader = $loader = new xrstf_Composer52_ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit472dba0eaffdca839125d11fca021b8d', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit9a99345398efdacf437a649bd4d2f18f', 'loadClassLoader'));
    2525
    2626        $vendorDir = dirname(dirname(__FILE__));
Note: See TracChangeset for help on using the changeset viewer.