Merge "Update OOUI to v0.27.1"
[lhc/web/wiklou.git] / includes / registration / ExtensionRegistry.php
index 1876645..c91d6d6 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-use MediaWiki\MediaWikiServices;
-
 /**
  * ExtensionRegistry class
  *
@@ -142,7 +140,10 @@ 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();
+                       // Don't use MediaWikiServices here to prevent instantiating it before extensions have
+                       // been loaded
+                       $cacheId = ObjectCache::detectLocalServerCache();
+                       $cache = ObjectCache::newFromId( $cacheId );
                } catch ( MWException $e ) {
                        $cache = new EmptyBagOStuff();
                }
@@ -202,6 +203,7 @@ class ExtensionRegistry {
         * @param array $queue keys are filenames, values are ignored
         * @return array extracted info
         * @throws Exception
+        * @throws ExtensionDependencyError
         */
        public function readFromQueue( array $queue ) {
                global $wgVersion;
@@ -245,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
@@ -273,11 +276,7 @@ class ExtensionRegistry {
                );
 
                if ( $incompatible ) {
-                       if ( count( $incompatible ) === 1 ) {
-                               throw new Exception( $incompatible[0] );
-                       } else {
-                               throw new Exception( implode( "\n", $incompatible ) );
-                       }
+                       throw new ExtensionDependencyError( $incompatible );
                }
 
                // Need to set this so we can += to it later