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. Built from https://develop.svn.wordpress.org/trunk@38399 git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -737,8 +737,6 @@ function _unzip_file_pclzip($file, $to, $needed_dirs = array()) {
|
||||
|
||||
mbstring_binary_safe_encoding();
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
|
||||
|
||||
$archive = new PclZip($file);
|
||||
|
||||
$archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING);
|
||||
@@ -886,14 +884,27 @@ function copy_dir($from, $to, $skip_list = array() ) {
|
||||
function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) {
|
||||
global $wp_filesystem;
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
|
||||
|
||||
$method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership );
|
||||
|
||||
if ( ! $method )
|
||||
return false;
|
||||
|
||||
if ( ! class_exists( "WP_Filesystem_$method" ) ) {
|
||||
$map = array(
|
||||
'base' => 'WP_Filesystem_Base',
|
||||
'direct' => 'WP_Filesystem_Direct',
|
||||
'ftpext' => 'WP_Filesystem_FTPext',
|
||||
'ftpsockets' => 'WP_Filesystem_ftpsockets',
|
||||
'ssh2' => 'WP_Filesystem_SSH2',
|
||||
);
|
||||
|
||||
$l = strtolower( $method );
|
||||
if ( array_key_exists( $l, $map ) ) {
|
||||
$classname = $map[ $l ];
|
||||
} else {
|
||||
$classname = "WP_Filesystem_{$method}";
|
||||
}
|
||||
|
||||
if ( ! class_exists( $classname ) ) {
|
||||
|
||||
/**
|
||||
* Filters the path for a specific filesystem method class file.
|
||||
@@ -907,14 +918,14 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own
|
||||
*/
|
||||
$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
|
||||
|
||||
if ( ! file_exists($abstraction_file) )
|
||||
if ( ! file_exists( $abstraction_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once($abstraction_file);
|
||||
require_once( $abstraction_file );
|
||||
}
|
||||
$method = "WP_Filesystem_$method";
|
||||
|
||||
$wp_filesystem = new $method($args);
|
||||
$wp_filesystem = new $classname( $args );
|
||||
|
||||
//Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default.
|
||||
if ( ! defined('FS_CONNECT_TIMEOUT') )
|
||||
|
||||
Reference in New Issue
Block a user