Merge "registration: Avoid redundant LBYL check in ExtensionRegistry::queue()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 5 Sep 2019 18:07:25 +0000 (18:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 5 Sep 2019 18:07:25 +0000 (18:07 +0000)
1  2 
includes/registration/ExtensionRegistry.php

@@@ -1,6 -1,7 +1,7 @@@
  <?php
  
  use Composer\Semver\Semver;
+ use Wikimedia\AtEase\AtEase;
  use Wikimedia\ScopedCallback;
  use MediaWiki\Shell\Shell;
  use MediaWiki\ShellDisabledError;
@@@ -126,15 -127,13 +127,13 @@@ class ExtensionRegistry 
  
                $mtime = $wgExtensionInfoMTime;
                if ( $mtime === false ) {
-                       if ( file_exists( $path ) ) {
-                               $mtime = filemtime( $path );
-                       } else {
-                               throw new Exception( "$path does not exist!" );
-                       }
+                       AtEase::suppressWarnings();
+                       $mtime = filemtime( $path );
+                       AtEase::restoreWarnings();
                        // @codeCoverageIgnoreStart
                        if ( $mtime === false ) {
                                $err = error_get_last();
-                               throw new Exception( "Couldn't stat $path: {$err['message']}" );
+                               throw new Exception( "Unable to open file $path: {$err['message']}" );
                                // @codeCoverageIgnoreEnd
                        }
                }
                                $autoloadNamespaces
                        );
  
 -                      if ( isset( $info['AutoloadClasses'] ) ) {
 -                              $autoload = $this->processAutoLoader( $dir, $info['AutoloadClasses'] );
 -                              $GLOBALS['wgAutoloadClasses'] += $autoload;
 -                              $autoloadClasses += $autoload;
 -                      }
 -                      if ( isset( $info['AutoloadNamespaces'] ) ) {
 -                              $autoloadNamespaces += $this->processAutoLoader( $dir, $info['AutoloadNamespaces'] );
 -                              AutoLoader::$psr4Namespaces += $autoloadNamespaces;
 -                      }
 -
                        // get all requirements/dependencies for this extension
                        $requires = $processor->getRequirements( $info, $this->checkDev );