From 9f84ca772dd1a40c15f86553c270cb94133493a7 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 12 Dec 2015 19:45:43 -0800 Subject: [PATCH] ApiBase::getModuleSourceInfo(): Use $wgExtensionDirectory This function takes the class file path, and iterates up through its parent directories until it hits either a registered extension, or $IP (for core) or $IP/extensions (for an unknown extension). This change adds $wgExtensionDirectory as another iteration stopper, so that unregistered extensions in $wgExtensionDirectory will not cause iteration back up to the filesystem root, or to $IP if $wgExtensionDirectory is a child of $IP other than $IP/extensions. Change-Id: I06553591b0b6156e945aad5176479eb71517e77d --- includes/api/ApiBase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index b45eacb693..4a1a520f12 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -2458,6 +2458,7 @@ abstract class ApiBase extends ContextSource { // Build map of extension directories to extension info if ( self::$extensionInfo === null ) { + $extDir = $this->getConfig()->get( 'ExtensionDirectory' ); self::$extensionInfo = [ realpath( __DIR__ ) ?: __DIR__ => [ 'path' => $IP, @@ -2465,6 +2466,7 @@ abstract class ApiBase extends ContextSource { 'license-name' => 'GPL-2.0+', ], realpath( "$IP/extensions" ) ?: "$IP/extensions" => null, + realpath( $extDir ) ?: $extDir => null, ]; $keep = [ 'path' => null, -- 2.20.1