X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fregistration%2FExtensionRegistry.php;h=0eb6a9bb7fae76583ae0f7e955e2c055bca7fcf4;hp=6308461438ef132fb2c38856a25c51e5f507a671;hb=ebe895d0398d2ec0a27440a87545773ae2b22f92;hpb=051ca781a46b4c978c585c1b56281184e81cfb2e diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index 6308461438..0eb6a9bb7f 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -20,9 +20,16 @@ class ExtensionRegistry { /** * Version of the highest supported manifest version + * Note: Update MANIFEST_VERSION_MW_VERSION when changing this */ const MANIFEST_VERSION = 2; + /** + * MediaWiki version constraint representing what the current + * highest MANIFEST_VERSION is supported in + */ + const MANIFEST_VERSION_MW_VERSION = '>= 1.29.0'; + /** * Version of the oldest supported manifest version */ @@ -75,6 +82,7 @@ class ExtensionRegistry { private static $instance; /** + * @codeCoverageIgnore * @return ExtensionRegistry */ public static function getInstance() { @@ -98,9 +106,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; @@ -192,6 +202,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; @@ -235,6 +246,7 @@ class ExtensionRegistry { } if ( isset( $info['AutoloadNamespaces'] ) ) { $autoloadNamespaces += $this->processAutoLoader( $dir, $info['AutoloadNamespaces'] ); + AutoLoader::$psr4Namespaces += $autoloadNamespaces; } // get all requirements/dependencies for this extension @@ -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 @@ -291,7 +299,7 @@ class ExtensionRegistry { // Optimistic: If the global is not set, or is an empty array, replace it entirely. // Will be O(1) performance. - if ( !isset( $GLOBALS[$key] ) || ( is_array( $GLOBALS[$key] ) && !$GLOBALS[$key] ) ) { + if ( !array_key_exists( $key, $GLOBALS ) || ( is_array( $GLOBALS[$key] ) && !$GLOBALS[$key] ) ) { $GLOBALS[$key] = $val; continue; } @@ -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 *