From: Kunal Mehta Date: Sat, 23 Sep 2017 05:20:16 +0000 (-0700) Subject: registration: Fix caching of load_composer_autoloader X-Git-Tag: 1.31.0-rc.0~1974^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=72d92f6fe3daf19ee8c4b5ae4886f51867f02e55 registration: Fix caching of load_composer_autoloader Move the file_exists() check out of the extension processor and into the extension registry so that it is evaluated at run time instead of during caching. The prior way is problematic since we don't invalidate the cache if the existence of the file were to change. Bug: T176534 Change-Id: I98e4ffdfac9f98397a103966824519afe1375356 --- diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index ce262bd23e..ffc7a7e08e 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -520,10 +520,7 @@ class ExtensionProcessor implements Processor { public function getExtraAutoloaderPaths( $dir, array $info ) { $paths = []; if ( isset( $info['load_composer_autoloader'] ) && $info['load_composer_autoloader'] === true ) { - $path = "$dir/vendor/autoload.php"; - if ( file_exists( $path ) ) { - $paths[] = $path; - } + $paths[] = "$dir/vendor/autoload.php"; } return $paths; } diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index bf33c6cfa7..740fed4eac 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -319,7 +319,9 @@ class ExtensionRegistry { define( $name, $val ); } foreach ( $info['autoloaderPaths'] as $path ) { - require_once $path; + if ( file_exists( $path ) ) { + require_once $path; + } } $this->loaded += $info['credits'];