X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fregistration%2FExtensionRegistry.php;h=b34a1236352b3efc2e333089eef97c6eca9745c6;hb=478a58f63101f2b47d18a618296b5e7970fa3f24;hp=ae1ab5890655baee6041672194b3d73fb1df2d60;hpb=095a2a05b2aaccff26d7b871194a4edccd092707;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index ae1ab58906..b34a123635 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -1,7 +1,5 @@ = 1.29.0'; + /** * Version of the oldest supported manifest version */ @@ -75,6 +80,7 @@ class ExtensionRegistry { private static $instance; /** + * @codeCoverageIgnore * @return ExtensionRegistry */ public static function getInstance() { @@ -98,9 +104,11 @@ class ExtensionRegistry { } else { throw new Exception( "$path does not exist!" ); } + // @codeCoverageIgnoreStart if ( !$mtime ) { $err = error_get_last(); throw new Exception( "Couldn't stat $path: {$err['message']}" ); + // @codeCoverageIgnoreEnd } } $this->queued[$path] = $mtime; @@ -132,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(); } @@ -192,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; @@ -263,11 +275,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 @@ -399,16 +407,6 @@ class ExtensionRegistry { return $this->loaded; } - /** - * Mark a thing as loaded - * - * @param string $name - * @param array $credits - */ - protected function markLoaded( $name, array $credits ) { - $this->loaded[$name] = $credits; - } - /** * Fully expand autoloader paths *