From: Mark A. Hershberger Date: Wed, 20 May 2015 22:07:15 +0000 (-0400) Subject: registration: Notify of problems before filemtime, not after X-Git-Tag: 1.31.0-rc.0~11343^2 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=6fb86c5d80e5d525bc335a6b16336744a50bf454;p=lhc%2Fweb%2Fwiklou.git registration: Notify of problems before filemtime, not after Without this several lines of warning are emitted before the final error indicating the cause. Bug: T99846 Change-Id: Ic1b9d9a80ed995273c56c447c8b044285a8843a7 --- diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index 4cad259bb7..ac396991fc 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -70,10 +70,18 @@ class ExtensionRegistry { */ public function queue( $path ) { global $wgExtensionInfoMTime; - if ( $wgExtensionInfoMTime !== false ) { - $mtime = $wgExtensionInfoMTime; - } else { - $mtime = filemtime( $path ); + + $mtime = $wgExtensionInfoMTime; + if ( $mtime === false ) { + if ( file_exists( $path ) ) { + $mtime = filemtime( $path ); + } else { + throw new Exception( "$path does not exist!" ); + } + if ( !$mtime ) { + $err = error_get_last(); + throw new Exception( "Couldn't stat $path: {$err['message']}" ); + } } $this->queued[$path] = $mtime; }