X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fregistration%2FExtensionRegistry.php;h=0c5a67e9a7646a87dd053ab4dd82b8bf133904cc;hb=f230f5dcc7d663b7bc8278f26311041243e62b22;hp=c5b21500f5374e815d757395ee3694b45aa4561f;hpb=41f1ce0d35b929d480ce87605a3234c187e44fd2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index c5b21500f5..0c5a67e9a7 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -31,7 +31,7 @@ class ExtensionRegistry { /** * Bump whenever the registration cache needs resetting */ - const CACHE_VERSION = 5; + const CACHE_VERSION = 6; /** * Special key that defines the merge strategy @@ -40,11 +40,6 @@ class ExtensionRegistry { */ const MERGE_STRATEGY = '_merge_strategy'; - /** - * @var BagOStuff - */ - protected $cache; - /** * Array of loaded things, keyed by name, values are credits information * @@ -90,16 +85,6 @@ class ExtensionRegistry { return self::$instance; } - public function __construct() { - // We use a try/catch because we don't want to fail here - // if $wgObjectCaches is not configured properly for APC setup - try { - $this->cache = MediaWikiServices::getInstance()->getLocalServerObjectCache(); - } catch ( MWException $e ) { - $this->cache = new EmptyBagOStuff(); - } - } - /** * @param string $path Absolute path to the JSON file */ @@ -126,7 +111,7 @@ class ExtensionRegistry { * be loaded then). */ public function loadFromQueue() { - global $wgVersion; + global $wgVersion, $wgDevelopmentWarnings; if ( !$this->queued ) { return; } @@ -144,12 +129,19 @@ class ExtensionRegistry { 'mediawiki' => $wgVersion ]; + // 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 ) { + $cache = new EmptyBagOStuff(); + } // See if this queue is in APC - $key = wfMemcKey( + $key = $cache->makeKey( 'registration', md5( json_encode( $this->queued + $versions ) ) ); - $data = $this->cache->get( $key ); + $data = $cache->get( $key ); if ( $data ) { $this->exportExtractedData( $data ); } else { @@ -159,7 +151,10 @@ class ExtensionRegistry { // did that, but it should be cached $data['globals']['wgAutoloadClasses'] += $data['autoload']; unset( $data['autoload'] ); - $this->cache->set( $key, $data, 60 * 60 * 24 ); + if ( !( $data['warnings'] && $wgDevelopmentWarnings ) ) { + // If there were no warnings that were shown, cache it + $cache->set( $key, $data, 60 * 60 * 24 ); + } } $this->queued = []; } @@ -206,6 +201,7 @@ class ExtensionRegistry { $versionChecker = new VersionChecker( $wgVersion ); $extDependencies = []; $incompatible = []; + $warnings = false; foreach ( $queue as $path => $mtime ) { $json = file_get_contents( $path ); if ( $json === false ) { @@ -217,6 +213,11 @@ class ExtensionRegistry { } if ( !isset( $info['manifest_version'] ) ) { + wfDeprecated( + "{$info['name']}'s extension.json or skin.json does not have manifest_version", + '1.29' + ); + $warnings = true; // For backwards-compatability, assume a version of 1 $info['manifest_version'] = 1; } @@ -245,6 +246,7 @@ class ExtensionRegistry { $processor->extractInfo( $path, $info, $version ); } $data = $processor->getExtractedInfo(); + $data['warnings'] = $warnings; // check for incompatible extensions $incompatible = array_merge(