MediaWiki REL1_30
ExtensionRegistry Class Reference

ExtensionRegistry class. More...

Collaboration diagram for ExtensionRegistry:

Public Member Functions

 clearQueue ()
 Clear the current load queue.
 
 finish ()
 After this is called, no more extensions can be loaded.
 
 getAllThings ()
 Get information about all things.
 
 getAttribute ( $name)
 
 getQueue ()
 Get the current load queue.
 
 isLoaded ( $name)
 Whether a thing has been loaded.
 
 load ( $path)
 Loads and processes the given JSON file without delay.
 
 loadFromQueue ()
 
 queue ( $path)
 
 readFromQueue (array $queue)
 Process a queue of extensions and return their extracted data.
 

Static Public Member Functions

static getInstance ()
 

Public Attributes

const CACHE_VERSION = 6
 Bump whenever the registration cache needs resetting.
 
const MANIFEST_VERSION = 2
 Version of the highest supported manifest version.
 
const MEDIAWIKI_CORE = 'MediaWiki'
 "requires" key that applies to MediaWiki core/$wgVersion
 
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)
 
 markLoaded ( $name, array $credits)
 Mark a thing as loaded.
 
 processAutoLoader ( $dir, array $info)
 Register classes with the autoloader.
 

Protected Attributes

array $attributes = []
 Items in the JSON file that aren't being set as globals.
 
array $queued = []
 List of paths that should be loaded.
 

Private Attributes

bool $finished = false
 Whether we are done loading things.
 
array $loaded = []
 Array of loaded things, keyed by name, values are credits information.
 

Static Private Attributes

static ExtensionRegistry $instance
 

Detailed Description

ExtensionRegistry class.

The Registry loads JSON files, and uses a Processor to extract information from them. It also registers classes with the autoloader.

Since
1.25

Definition at line 14 of file ExtensionRegistry.php.

Member Function Documentation

◆ clearQueue()

ExtensionRegistry::clearQueue ( )

Clear the current load queue.

Not intended to be used outside of the installer.

Definition at line 177 of file ExtensionRegistry.php.

◆ exportExtractedData()

ExtensionRegistry::exportExtractedData ( array $info)
protected

Definition at line 275 of file ExtensionRegistry.php.

References $GLOBALS, $path, MERGE_STRATEGY, and wfArrayPlus2d().

Referenced by loadFromQueue().

◆ finish()

ExtensionRegistry::finish ( )

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

Since
1.29

Definition at line 186 of file ExtensionRegistry.php.

◆ getAllThings()

ExtensionRegistry::getAllThings ( )

Get information about all things.

Returns
array

Definition at line 386 of file ExtensionRegistry.php.

References $loaded.

◆ getAttribute()

ExtensionRegistry::getAttribute ( $name)
Parameters
string$name
Returns
array

Definition at line 373 of file ExtensionRegistry.php.

References $name.

◆ getInstance()

◆ getQueue()

ExtensionRegistry::getQueue ( )

Get the current load queue.

Not intended to be used outside of the installer.

Returns
array

Definition at line 169 of file ExtensionRegistry.php.

References $queued.

◆ isLoaded()

ExtensionRegistry::isLoaded ( $name)

Whether a thing has been loaded.

Parameters
string$name
Returns
bool

Definition at line 365 of file ExtensionRegistry.php.

◆ load()

ExtensionRegistry::load ( $path)

Loads and processes the given JSON file without delay.

If some extensions are already queued, this will load those as well.

Parameters
string$pathAbsolute path to the JSON file

Definition at line 354 of file ExtensionRegistry.php.

References loadFromQueue(), and queue().

◆ loadFromQueue()

ExtensionRegistry::loadFromQueue ( )
Exceptions
MWExceptionIf the queue is already marked as finished (no further things should be loaded then).

Definition at line 114 of file ExtensionRegistry.php.

References $cache, $e, $wgDevelopmentWarnings, $wgVersion, CACHE_VERSION, exportExtractedData(), and readFromQueue().

Referenced by load().

◆ markLoaded()

ExtensionRegistry::markLoaded ( $name,
array $credits )
protected

Mark a thing as loaded.

Parameters
string$name
array$credits

Definition at line 396 of file ExtensionRegistry.php.

References $name.

◆ processAutoLoader()

ExtensionRegistry::processAutoLoader ( $dir,
array $info )
protected

Register classes with the autoloader.

Parameters
string$dir
array$info
Returns
array

Definition at line 407 of file ExtensionRegistry.php.

References $dir.

Referenced by readFromQueue().

◆ queue()

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

Definition at line 91 of file ExtensionRegistry.php.

References $path, and $wgExtensionInfoMTime.

Referenced by load().

◆ readFromQueue()

ExtensionRegistry::readFromQueue ( array $queue)

Process a queue of extensions and return their extracted data.

Parameters
array$queuekeys are filenames, values are ignored
Returns
array extracted info
Exceptions
Exception

Definition at line 197 of file ExtensionRegistry.php.

References $GLOBALS, $queue, $wgVersion, processAutoLoader(), and wfDeprecated().

Referenced by loadFromQueue().

Member Data Documentation

◆ $attributes

array ExtensionRegistry::$attributes = []
protected

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

Definition at line 70 of file ExtensionRegistry.php.

◆ $finished

bool ExtensionRegistry::$finished = false
private

Whether we are done loading things.

Definition at line 62 of file ExtensionRegistry.php.

◆ $instance

ExtensionRegistry ExtensionRegistry::$instance
staticprivate

Definition at line 75 of file ExtensionRegistry.php.

Referenced by getInstance().

◆ $loaded

array ExtensionRegistry::$loaded = []
private

Array of loaded things, keyed by name, values are credits information.

Definition at line 48 of file ExtensionRegistry.php.

Referenced by getAllThings().

◆ $queued

array ExtensionRegistry::$queued = []
protected

List of paths that should be loaded.

Definition at line 55 of file ExtensionRegistry.php.

Referenced by getQueue().

◆ CACHE_VERSION

const ExtensionRegistry::CACHE_VERSION = 6

Bump whenever the registration cache needs resetting.

Definition at line 34 of file ExtensionRegistry.php.

Referenced by loadFromQueue().

◆ MANIFEST_VERSION

const ExtensionRegistry::MANIFEST_VERSION = 2

◆ MEDIAWIKI_CORE

const ExtensionRegistry::MEDIAWIKI_CORE = 'MediaWiki'

"requires" key that applies to MediaWiki core/$wgVersion

Definition at line 19 of file ExtensionRegistry.php.

Referenced by VersionChecker\checkArray().

◆ MERGE_STRATEGY

const ExtensionRegistry::MERGE_STRATEGY = '_merge_strategy'

◆ OLDEST_MANIFEST_VERSION

const ExtensionRegistry::OLDEST_MANIFEST_VERSION = 1

Version of the oldest supported manifest version.

Definition at line 29 of file ExtensionRegistry.php.

Referenced by ExtensionJsonValidator\validate().


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