Merge "Provide backwards compatibility for RevisionInsertComplete hook."
[lhc/web/wiklou.git] / includes / registration / ExtensionRegistry.php
index b000dc1..c58b55e 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-use MediaWiki\MediaWikiServices;
-
 /**
  * ExtensionRegistry class
  *
@@ -107,7 +105,7 @@ class ExtensionRegistry {
                                throw new Exception( "$path does not exist!" );
                        }
                        // @codeCoverageIgnoreStart
-                       if ( !$mtime ) {
+                       if ( $mtime === false ) {
                                $err = error_get_last();
                                throw new Exception( "Couldn't stat $path: {$err['message']}" );
                                // @codeCoverageIgnoreEnd
@@ -142,8 +140,11 @@ class ExtensionRegistry {
                // We use a try/catch because we don't want to fail here
                // if $wgObjectCaches is not configured properly for APC setup
                try {
-                       $cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
-               } catch ( MWException $e ) {
+                       // Don't use MediaWikiServices here to prevent instantiating it before extensions have
+                       // been loaded
+                       $cacheId = ObjectCache::detectLocalServerCache();
+                       $cache = ObjectCache::newFromId( $cacheId );
+               } catch ( InvalidArgumentException $e ) {
                        $cache = new EmptyBagOStuff();
                }
                // See if this queue is in APC
@@ -246,6 +247,7 @@ class ExtensionRegistry {
                        }
                        if ( isset( $info['AutoloadNamespaces'] ) ) {
                                $autoloadNamespaces += $this->processAutoLoader( $dir, $info['AutoloadNamespaces'] );
+                               AutoLoader::$psr4Namespaces += $autoloadNamespaces;
                        }
 
                        // get all requirements/dependencies for this extension