registration: Notify of problems before filemtime, not after
authorMark A. Hershberger <mah@everybody.org>
Wed, 20 May 2015 22:07:15 +0000 (18:07 -0400)
committerLegoktm <legoktm.wikipedia@gmail.com>
Wed, 20 May 2015 23:43:53 +0000 (23:43 +0000)
Without this several lines of warning are emitted before the final error indicating the cause.

Bug: T99846
Change-Id: Ic1b9d9a80ed995273c56c447c8b044285a8843a7

includes/registration/ExtensionRegistry.php

index 4cad259..ac39699 100644 (file)
@@ -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;
        }