/**
* Bump whenever the registration cache needs resetting
*/
- const CACHE_VERSION = 1;
+ const CACHE_VERSION = 3;
/**
* Special key that defines the merge strategy
// we don't want to fail here if $wgObjectCaches is not configured
// properly for APC setup
try {
- $this->cache = ObjectCache::newAccelerator();
+ $this->cache = ObjectCache::getLocalServerInstance();
} catch ( MWException $e ) {
$this->cache = new EmptyBagOStuff();
}
}
public function loadFromQueue() {
+ global $wgVersion;
if ( !$this->queued ) {
return;
}
+ // A few more things to vary the cache on
+ $versions = array(
+ 'registration' => self::CACHE_VERSION,
+ 'mediawiki' => $wgVersion
+ );
+
// See if this queue is in APC
- $key = wfMemcKey( 'registration', md5( json_encode( $this->queued ) ), self::CACHE_VERSION );
+ $key = wfMemcKey(
+ 'registration',
+ md5( json_encode( $this->queued + $versions ) )
+ );
$data = $this->cache->get( $key );
if ( $data ) {
$this->exportExtractedData( $data );
public function readFromQueue( array $queue ) {
global $wgVersion;
$autoloadClasses = array();
+ $autoloaderPaths = array();
$processor = new ExtensionProcessor();
$incompatible = array();
$coreVersionParser = new CoreVersionChecker( $wgVersion );
) {
// Doesn't match, mark it as incompatible.
$incompatible[] = "{$info['name']} is not compatible with the current "
- . "MediaWiki core (version {$wgVersion}), it requires: ". $requires[self::MEDIAWIKI_CORE]
+ . "MediaWiki core (version {$wgVersion}), it requires: " . $requires[self::MEDIAWIKI_CORE]
. '.';
continue;
}
+ // Get extra paths for later inclusion
+ $autoloaderPaths = array_merge( $autoloaderPaths,
+ $processor->getExtraAutoloaderPaths( dirname( $path ), $info ) );
// Compatible, read and extract info
$processor->extractInfo( $path, $info, $version );
}
$data = $processor->getExtractedInfo();
// Need to set this so we can += to it later
$data['globals']['wgAutoloadClasses'] = array();
- foreach ( $data['credits'] as $credit ) {
- $data['globals']['wgExtensionCredits'][$credit['type']][] = $credit;
- }
- $data['globals']['wgExtensionCredits'][self::MERGE_STRATEGY] = 'array_merge_recursive';
$data['autoload'] = $autoloadClasses;
+ $data['autoloaderPaths'] = $autoloaderPaths;
return $data;
}
call_user_func( $cb );
}
- $this->loaded += $info['credits'];
+ foreach ( $info['autoloaderPaths'] as $path ) {
+ require_once $path;
+ }
+ $this->loaded += $info['credits'];
if ( $info['attributes'] ) {
if ( !$this->attributes ) {
$this->attributes = $info['attributes'];