MediaWiki master
MediaWiki\Registration\ExtensionRegistry Class Reference

Load JSON files, and uses a Processor to extract information. More...

Public Member Functions

 clearQueue ()
 Clear the current load queue.
 
 finish ()
 After this is called, no more extensions can be loaded.
 
 getAllThings ()
 Get credits information about all installed extensions and skins.
 
 getAttribute ( $name)
 
 getQueue ()
 Get the current load queue.
 
 isLoaded ( $name, $constraint=' *')
 Whether a thing has been loaded.
 
 loadFromQueue ()
 
 queue ( $path)
 
 readFromQueue (array $queue)
 Process a queue of extensions and return their extracted data.
 
 setAttributeForTest ( $name, array $value)
 Force override the value of an attribute during tests.
 
 setCache (BagOStuff $cache)
 Set the cache to use for extension info.
 
 setCheckDevRequires ( $check)
 
 setLoadTestClassesAndNamespaces ( $load)
 Controls if classes and namespaces defined under the keys TestAutoloadClasses and TestAutoloadNamespaces should be added to the autoloader.
 
 setSettingsBuilder (SettingsBuilder $settingsBuilder)
 

Static Public Member Functions

static disableForTest ()
 
static enableForTest ()
 
static getInstance ()
 

Public Attributes

const MANIFEST_VERSION = 2
 Version of the highest supported manifest version Note: Update MANIFEST_VERSION_MW_VERSION when changing this.
 
const MANIFEST_VERSION_MW_VERSION = '>= 1.29.0'
 MediaWiki version constraint representing what the current highest MANIFEST_VERSION is supported in.
 
const MEDIAWIKI_CORE = 'MediaWiki'
 "requires" key that applies to MediaWiki core
 
const MERGE_STRATEGY = '_merge_strategy'
 Special key that defines the merge strategy.
 
const OLDEST_MANIFEST_VERSION = 1
 Version of the oldest supported manifest version.
 

Protected Member Functions

 exportExtractedData (array $info)
 
 getLazyLoadedAttribute ( $name)
 Get an attribute value that isn't cached by reading each extension.json file again.
 
 saveToCache (BagOStuff $cache, array $data)
 Save data in the cache.
 

Static Protected Member Functions

static processAutoLoader ( $dir, array $files)
 Fully expand autoloader paths.
 

Protected Attributes

array $attributes = []
 Items in the JSON file that aren't being set as globals.
 
bool $checkDev = false
 Whether to check dev-requires.
 
array $lazyAttributes = []
 Lazy-loaded attributes.
 
bool $loadTestClassesAndNamespaces = false
 Whether test classes and namespaces should be added to the auto loader.
 
int[] $queued = []
 List of paths that should be loaded.
 
array $testAttributes = []
 Attributes for testing.
 

Detailed Description

Load JSON files, and uses a Processor to extract information.

This also adds the extension's classes to the AutoLoader.

Since
1.25

Definition at line 33 of file ExtensionRegistry.php.

Member Function Documentation

◆ clearQueue()

MediaWiki\Registration\ExtensionRegistry::clearQueue ( )

Clear the current load queue.

Not intended to be used outside of the installer.

Definition at line 381 of file ExtensionRegistry.php.

◆ disableForTest()

static MediaWiki\Registration\ExtensionRegistry::disableForTest ( )
static
Access: internal

Definition at line 185 of file ExtensionRegistry.php.

◆ enableForTest()

static MediaWiki\Registration\ExtensionRegistry::enableForTest ( )
static
Access: internal

Definition at line 195 of file ExtensionRegistry.php.

◆ exportExtractedData()

MediaWiki\Registration\ExtensionRegistry::exportExtractedData ( array $info)
protected

Definition at line 484 of file ExtensionRegistry.php.

References wfArrayPlus2d().

◆ finish()

MediaWiki\Registration\ExtensionRegistry::finish ( )

After this is called, no more extensions can be loaded.

Since
1.29

Definition at line 391 of file ExtensionRegistry.php.

◆ getAllThings()

MediaWiki\Registration\ExtensionRegistry::getAllThings ( )

Get credits information about all installed extensions and skins.

Returns
array[] Keyed by component name.

Definition at line 701 of file ExtensionRegistry.php.

◆ getAttribute()

MediaWiki\Registration\ExtensionRegistry::getAttribute ( $name)
Parameters
string$name
Returns
array

Definition at line 618 of file ExtensionRegistry.php.

Referenced by MediaWiki\ResourceLoader\getSkinThemeMap().

◆ getInstance()

static MediaWiki\Registration\ExtensionRegistry::getInstance ( )
static
Returns
ExtensionRegistry

Definition at line 171 of file ExtensionRegistry.php.

◆ getLazyLoadedAttribute()

MediaWiki\Registration\ExtensionRegistry::getLazyLoadedAttribute ( $name)
protected

Get an attribute value that isn't cached by reading each extension.json file again.

Parameters
string$name
Returns
array

Definition at line 638 of file ExtensionRegistry.php.

◆ getQueue()

MediaWiki\Registration\ExtensionRegistry::getQueue ( )

Get the current load queue.

Not intended to be used outside of the installer.

Returns
int[] Map of extension.json files' modification timestamps keyed by absolute path

Definition at line 373 of file ExtensionRegistry.php.

◆ isLoaded()

MediaWiki\Registration\ExtensionRegistry::isLoaded ( $name,
$constraint = '*' )

Whether a thing has been loaded.

Parameters
string$name
string$constraintThe required version constraint for this dependency
Returns
bool

Definition at line 598 of file ExtensionRegistry.php.

◆ loadFromQueue()

MediaWiki\Registration\ExtensionRegistry::loadFromQueue ( )

Definition at line 313 of file ExtensionRegistry.php.

◆ processAutoLoader()

static MediaWiki\Registration\ExtensionRegistry::processAutoLoader ( $dir,
array $files )
staticprotected

Fully expand autoloader paths.

Parameters
string$dir
string[]$files
Returns
array

Definition at line 713 of file ExtensionRegistry.php.

◆ queue()

MediaWiki\Registration\ExtensionRegistry::queue ( $path)
Parameters
string$pathAbsolute path to the JSON file

Definition at line 239 of file ExtensionRegistry.php.

References $path, and $wgExtensionInfoMTime.

◆ readFromQueue()

MediaWiki\Registration\ExtensionRegistry::readFromQueue ( array $queue)

Process a queue of extensions and return their extracted data.

Access: internal
since 1.39. Extensions should use ExtensionProcessor instead.
Parameters
int[]$queuekeys are filenames, values are ignored
Returns
array extracted info
Exceptions
InvalidArgumentException
ExtensionDependencyError

Definition at line 438 of file ExtensionRegistry.php.

References $path.

◆ saveToCache()

MediaWiki\Registration\ExtensionRegistry::saveToCache ( BagOStuff $cache,
array $data )
protected

Save data in the cache.

Parameters
BagOStuff$cache
array$data

Definition at line 342 of file ExtensionRegistry.php.

References $wgDevelopmentWarnings, and Wikimedia\ObjectCache\BagOStuff\set().

◆ setAttributeForTest()

MediaWiki\Registration\ExtensionRegistry::setAttributeForTest ( $name,
array $value )

Force override the value of an attribute during tests.

Parameters
string$nameName of attribute to override
array$valueValue to set
Returns
ScopedCallback to reset
Since
1.33

Definition at line 680 of file ExtensionRegistry.php.

◆ setCache()

MediaWiki\Registration\ExtensionRegistry::setCache ( BagOStuff $cache)

Set the cache to use for extension info.

Intended for use during testing.

Access: internal
Parameters
BagOStuff$cache

Definition at line 210 of file ExtensionRegistry.php.

◆ setCheckDevRequires()

MediaWiki\Registration\ExtensionRegistry::setCheckDevRequires ( $check)
Since
1.34
Parameters
bool$check

Definition at line 219 of file ExtensionRegistry.php.

◆ setLoadTestClassesAndNamespaces()

MediaWiki\Registration\ExtensionRegistry::setLoadTestClassesAndNamespaces ( $load)

Controls if classes and namespaces defined under the keys TestAutoloadClasses and TestAutoloadNamespaces should be added to the autoloader.

Since
1.35
Parameters
bool$load

Definition at line 232 of file ExtensionRegistry.php.

◆ setSettingsBuilder()

MediaWiki\Registration\ExtensionRegistry::setSettingsBuilder ( SettingsBuilder $settingsBuilder)
Access: internal
for use by Setup. Hopefully in the future, we find a better way.
Parameters
SettingsBuilder$settingsBuilder

Definition at line 727 of file ExtensionRegistry.php.

Member Data Documentation

◆ $attributes

array MediaWiki\Registration\ExtensionRegistry::$attributes = []
protected

Items in the JSON file that aren't being set as globals.

Definition at line 113 of file ExtensionRegistry.php.

◆ $checkDev

bool MediaWiki\Registration\ExtensionRegistry::$checkDev = false
protected

Whether to check dev-requires.

Definition at line 141 of file ExtensionRegistry.php.

◆ $lazyAttributes

array MediaWiki\Registration\ExtensionRegistry::$lazyAttributes = []
protected

Lazy-loaded attributes.

Definition at line 127 of file ExtensionRegistry.php.

◆ $loadTestClassesAndNamespaces

bool MediaWiki\Registration\ExtensionRegistry::$loadTestClassesAndNamespaces = false
protected

Whether test classes and namespaces should be added to the auto loader.

Definition at line 148 of file ExtensionRegistry.php.

◆ $queued

int [] MediaWiki\Registration\ExtensionRegistry::$queued = []
protected

List of paths that should be loaded.

Definition at line 98 of file ExtensionRegistry.php.

◆ $testAttributes

array MediaWiki\Registration\ExtensionRegistry::$testAttributes = []
protected

Attributes for testing.

Definition at line 120 of file ExtensionRegistry.php.

◆ MANIFEST_VERSION

const MediaWiki\Registration\ExtensionRegistry::MANIFEST_VERSION = 2

Version of the highest supported manifest version Note: Update MANIFEST_VERSION_MW_VERSION when changing this.

Definition at line 44 of file ExtensionRegistry.php.

Referenced by MediaWiki\Registration\ExtensionJsonValidator\validate().

◆ MANIFEST_VERSION_MW_VERSION

const MediaWiki\Registration\ExtensionRegistry::MANIFEST_VERSION_MW_VERSION = '>= 1.29.0'

MediaWiki version constraint representing what the current highest MANIFEST_VERSION is supported in.

Definition at line 50 of file ExtensionRegistry.php.

◆ MEDIAWIKI_CORE

const MediaWiki\Registration\ExtensionRegistry::MEDIAWIKI_CORE = 'MediaWiki'

"requires" key that applies to MediaWiki core

Definition at line 38 of file ExtensionRegistry.php.

Referenced by MediaWiki\Registration\VersionChecker\checkArray().

◆ MERGE_STRATEGY

const MediaWiki\Registration\ExtensionRegistry::MERGE_STRATEGY = '_merge_strategy'

Special key that defines the merge strategy.

Since
1.26

Definition at line 69 of file ExtensionRegistry.php.

Referenced by MediaWiki\Registration\ExtensionProcessor\getExtractedInfo().

◆ OLDEST_MANIFEST_VERSION

const MediaWiki\Registration\ExtensionRegistry::OLDEST_MANIFEST_VERSION = 1

Version of the oldest supported manifest version.

Definition at line 55 of file ExtensionRegistry.php.

Referenced by MediaWiki\Registration\ExtensionJsonValidator\validate().


The documentation for this class was generated from the following file: