From 6fb86c5d80e5d525bc335a6b16336744a50bf454 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Wed, 20 May 2015 18:07:15 -0400 Subject: [PATCH] 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 --- includes/registration/ExtensionRegistry.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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; } -- 2.20.1