From: Bryan Davis Date: Thu, 20 Nov 2014 23:05:07 +0000 (-0700) Subject: Fix AutoloadGenerator to work on MediaWiki-Vagrant X-Git-Tag: 1.31.0-rc.0~13219^2 X-Git-Url: http://git.cyclocoop.org/data/File:Image2.gif?a=commitdiff_plain;h=179854c3ceff53617e452f2e3ef9b50b13bd0aac;p=lhc%2Fweb%2Fwiklou.git Fix AutoloadGenerator to work on MediaWiki-Vagrant The use of realpath() in AutoloadGenerator::readFile() causes the LocalSettings.php symlink to be dereferenced. Since the target file lives outside of $IP, AutoloadGenerator would fail with an exception. Change-Id: I4623b3da9b984026999189d70349ffb4754812a5 --- diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index 98efd274af..727f4851ee 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -81,19 +81,15 @@ class AutoloadGenerator { * @var string $inputPath Path to a php file to find classes within */ public function readFile( $inputPath ) { - $path = realpath( $inputPath ); - if ( !$path ) { - throw new \Exception( "Invalid path: $inputPath" ); - } $len = strlen( $this->basepath ); - if ( substr( $path, 0, $len ) !== $this->basepath ) { + if ( substr( $inputPath, 0, $len ) !== $this->basepath ) { throw new \Exception( "Path is not within basepath: $inputPath" ); } $result = $this->collector->getClasses( - file_get_contents( $path ) + file_get_contents( $inputPath ) ); if ( $result ) { - $shortpath = substr( $path, $len ); + $shortpath = substr( $inputPath, $len ); $this->classes[$shortpath] = $result; } }