MediaWiki
master
|
ExtensionRegistry class. More...
Public Member Functions | |
clearQueue () | |
Clear the current load queue. More... | |
finish () | |
After this is called, no more extensions can be loaded. More... | |
getAllThings () | |
Get credits information about all installed extensions and skins. More... | |
getAttribute ( $name) | |
getQueue () | |
Get the current load queue. More... | |
isLoaded ( $name, $constraint=' *') | |
Whether a thing has been loaded. More... | |
loadFromQueue () | |
queue ( $path) | |
readFromQueue (array $queue) | |
Process a queue of extensions and return their extracted data. More... | |
setAttributeForTest ( $name, array $value) | |
Force override the value of an attribute during tests. More... | |
setCheckDevRequires ( $check) | |
setLoadTestClassesAndNamespaces ( $load) | |
Controls if classes and namespaces defined under the keys TestAutoloadClasses and TestAutoloadNamespaces should be added to the autoloader. More... | |
Static Public Member Functions | |
static | exportAutoloadClassesAndNamespaces ( $dir, $info, &$autoloadClasses=[], &$autoloadNamespaces=[]) |
Export autoload classes and namespaces for a given directory and parsed JSON info file. More... | |
static | exportTestAutoloadClassesAndNamespaces ( $dir, $info, &$autoloadClasses=[], &$autoloadNamespaces=[]) |
Export test autoload classes and namespaces for a given directory and parsed JSON info file. More... | |
static | getInstance () |
Public Attributes | |
const | MANIFEST_VERSION = 2 |
Version of the highest supported manifest version Note: Update MANIFEST_VERSION_MW_VERSION when changing this. More... | |
const | MANIFEST_VERSION_MW_VERSION = '>= 1.29.0' |
MediaWiki version constraint representing what the current highest MANIFEST_VERSION is supported in. More... | |
const | MEDIAWIKI_CORE = 'MediaWiki' |
"requires" key that applies to MediaWiki core More... | |
const | MERGE_STRATEGY = '_merge_strategy' |
Special key that defines the merge strategy. More... | |
const | OLDEST_MANIFEST_VERSION = 1 |
Version of the oldest supported manifest version. More... | |
Protected Member Functions | |
exportExtractedData (array $info) | |
getLazyLoadedAttribute ( $name) | |
Get an attribute value that isn't cached by reading each extension.json file again. More... | |
saveToCache (BagOStuff $cache, array $data) | |
Save data in the cache. More... | |
Static Protected Member Functions | |
static | processAutoLoader ( $dir, array $files) |
Fully expand autoloader paths. More... | |
Protected Attributes | |
array | $attributes = [] |
Items in the JSON file that aren't being set as globals. More... | |
bool | $checkDev = false |
Whether to check dev-requires. More... | |
array | $lazyAttributes = [] |
Lazy-loaded attributes. More... | |
bool | $loadTestClassesAndNamespaces = false |
Whether test classes and namespaces should be added to the auto loader. More... | |
int[] | $queued = [] |
List of paths that should be loaded. More... | |
array | $testAttributes = [] |
Attributes for testing. More... | |
Private Member Functions | |
buildVersionChecker () | |
Queries information about the software environment and constructs an appropiate version checker. More... | |
getAbilities () | |
Get the list of abilities and their values. More... | |
getCache () | |
makeCacheKey (BagOStuff $cache, $component,... $extra) | |
Private Attributes | |
bool | $finished = false |
Whether we are done loading things. More... | |
array[] | $loaded = [] |
Array of loaded things, keyed by name, values are credits information. More... | |
const | CACHE_EXPIRY = 60 * 60 * 24 |
const | CACHE_VERSION = 7 |
Bump whenever the registration cache needs resetting. More... | |
const | LAZY_LOADED_ATTRIBUTES |
Attributes that should be lazy-loaded. More... | |
Static Private Attributes | |
static ExtensionRegistry | $instance |
ExtensionRegistry class.
The Registry loads JSON files, and uses a Processor to extract information from them. It also registers classes with the autoloader.
Definition at line 17 of file ExtensionRegistry.php.
|
private |
Queries information about the software environment and constructs an appropiate version checker.
Definition at line 307 of file ExtensionRegistry.php.
References getAbilities(), and MW_VERSION.
Referenced by readFromQueue().
ExtensionRegistry::clearQueue | ( | ) |
Clear the current load queue.
Not intended to be used outside of the installer.
Definition at line 279 of file ExtensionRegistry.php.
|
static |
Export autoload classes and namespaces for a given directory and parsed JSON info file.
string | $dir | |
array | $info | |
array | &$autoloadClasses | |
array | &$autoloadNamespaces |
Definition at line 422 of file ExtensionRegistry.php.
References AutoLoader\$psr4Namespaces, and processAutoLoader().
Referenced by readFromQueue().
|
protected |
Definition at line 460 of file ExtensionRegistry.php.
References $path, AutoLoader\$psr4Namespaces, MERGE_STRATEGY, and wfArrayPlus2d().
Referenced by loadFromQueue().
|
static |
Export test autoload classes and namespaces for a given directory and parsed JSON info file.
string | $dir | |
array | $info | |
array | &$autoloadClasses | |
array | &$autoloadNamespaces |
Definition at line 446 of file ExtensionRegistry.php.
References AutoLoader\$psr4Namespaces, and processAutoLoader().
Referenced by readFromQueue().
ExtensionRegistry::finish | ( | ) |
After this is called, no more extensions can be loaded.
Definition at line 288 of file ExtensionRegistry.php.
|
private |
Get the list of abilities and their values.
Definition at line 296 of file ExtensionRegistry.php.
Referenced by buildVersionChecker(), and makeCacheKey().
ExtensionRegistry::getAllThings | ( | ) |
Get credits information about all installed extensions and skins.
Definition at line 644 of file ExtensionRegistry.php.
References $loaded.
Referenced by SpecialVersion\getCredits().
ExtensionRegistry::getAttribute | ( | $name | ) |
string | $name |
Definition at line 571 of file ExtensionRegistry.php.
References getLazyLoadedAttribute().
|
private |
Definition at line 183 of file ExtensionRegistry.php.
References ObjectCache\makeLocalServerCache().
Referenced by getLazyLoadedAttribute(), and loadFromQueue().
|
static |
Definition at line 136 of file ExtensionRegistry.php.
References $instance.
Referenced by CheckDependencies\addToDependencies(), ApiQuerySiteinfo\appendExtensions(), Maintenance\checkRequiredExtensions(), ResourceLoaderFileModule\compileLessString(), MediaWiki\Rest\EntryPoint\createRouter(), SpecialVersion\execute(), CheckDependencies\execute(), NamespaceInfo\getCanonicalNamespaces(), ApiBase\getModuleSourceInfo(), getSkinThemeMap(), getThemePaths(), TrackingCategories\getTrackingCategories(), SearchHighlighter\highlightText(), DatabaseUpdater\loadExtensions(), ResourceLoader\registerTestModules(), wfLoadExtension(), wfLoadExtensions(), wfLoadSkin(), and wfLoadSkins().
|
protected |
Get an attribute value that isn't cached by reading each extension.json file again.
string | $name |
Definition at line 589 of file ExtensionRegistry.php.
References $cache, getCache(), makeCacheKey(), readFromQueue(), and saveToCache().
Referenced by getAttribute().
ExtensionRegistry::getQueue | ( | ) |
Get the current load queue.
Not intended to be used outside of the installer.
Definition at line 271 of file ExtensionRegistry.php.
References $queued.
ExtensionRegistry::isLoaded | ( | $name, | |
$constraint = '*' |
|||
) |
Whether a thing has been loaded.
string | $name | |
string | $constraint | The required version constraint for this dependency |
LogicException | if a specific contraint is asked for, but the extension isn't versioned |
Definition at line 552 of file ExtensionRegistry.php.
ExtensionRegistry::loadFromQueue | ( | ) |
MWException | If the queue is already marked as finished (no further things should be loaded then). |
Definition at line 211 of file ExtensionRegistry.php.
References $cache, exportExtractedData(), getCache(), makeCacheKey(), readFromQueue(), and saveToCache().
|
private |
Definition at line 189 of file ExtensionRegistry.php.
References $checkDev, $queued, CACHE_VERSION, getAbilities(), BagOStuff\makeKey(), and MW_VERSION.
Referenced by getLazyLoadedAttribute(), loadFromQueue(), and saveToCache().
|
staticprotected |
Fully expand autoloader paths.
string | $dir | |
string[] | $files |
Definition at line 655 of file ExtensionRegistry.php.
References $file.
Referenced by exportAutoloadClassesAndNamespaces(), and exportTestAutoloadClassesAndNamespaces().
ExtensionRegistry::queue | ( | $path | ) |
string | $path | Absolute path to the JSON file |
Definition at line 166 of file ExtensionRegistry.php.
References $path, and $wgExtensionInfoMTime.
ExtensionRegistry::readFromQueue | ( | array | $queue | ) |
Process a queue of extensions and return their extracted data.
int[] | $queue | keys are filenames, values are ignored |
Exception | |
ExtensionDependencyError |
Definition at line 331 of file ExtensionRegistry.php.
References $path, $queue, buildVersionChecker(), exportAutoloadClassesAndNamespaces(), exportTestAutoloadClassesAndNamespaces(), and wfDeprecatedMsg().
Referenced by getLazyLoadedAttribute(), and loadFromQueue().
|
protected |
Save data in the cache.
BagOStuff | $cache | |
array | $data |
Definition at line 240 of file ExtensionRegistry.php.
References $cache, $wgDevelopmentWarnings, and makeCacheKey().
Referenced by getLazyLoadedAttribute(), and loadFromQueue().
ExtensionRegistry::setAttributeForTest | ( | $name, | |
array | $value | ||
) |
Force override the value of an attribute during tests.
string | $name | Name of attribute to override |
array | $value | Value to set |
Definition at line 624 of file ExtensionRegistry.php.
ExtensionRegistry::setCheckDevRequires | ( | $check | ) |
ExtensionRegistry::setLoadTestClassesAndNamespaces | ( | $load | ) |
Controls if classes and namespaces defined under the keys TestAutoloadClasses and TestAutoloadNamespaces should be added to the autoloader.
bool | $load |
Definition at line 159 of file ExtensionRegistry.php.
|
protected |
Items in the JSON file that aren't being set as globals.
Definition at line 97 of file ExtensionRegistry.php.
|
protected |
Whether to check dev-requires.
Definition at line 118 of file ExtensionRegistry.php.
Referenced by makeCacheKey().
|
private |
Whether we are done loading things.
Definition at line 89 of file ExtensionRegistry.php.
|
staticprivate |
Definition at line 130 of file ExtensionRegistry.php.
Referenced by getInstance().
|
protected |
Lazy-loaded attributes.
Definition at line 111 of file ExtensionRegistry.php.
|
private |
Array of loaded things, keyed by name, values are credits information.
The keys that the credit info arrays may have is defined by ExtensionProcessor::CREDIT_ATTRIBS (plus a 'path' key that points to the skin or extension JSON file).
This info may be accessed via ExtensionRegistry::getAllThings.
Definition at line 75 of file ExtensionRegistry.php.
Referenced by getAllThings().
|
protected |
Whether test classes and namespaces should be added to the auto loader.
Definition at line 125 of file ExtensionRegistry.php.
|
protected |
List of paths that should be loaded.
Definition at line 82 of file ExtensionRegistry.php.
Referenced by getQueue(), and makeCacheKey().
|
protected |
Attributes for testing.
Definition at line 104 of file ExtensionRegistry.php.
|
private |
Definition at line 46 of file ExtensionRegistry.php.
|
private |
Bump whenever the registration cache needs resetting.
Definition at line 44 of file ExtensionRegistry.php.
Referenced by makeCacheKey().
|
private |
Attributes that should be lazy-loaded.
Definition at line 58 of file ExtensionRegistry.php.
const ExtensionRegistry::MANIFEST_VERSION = 2 |
Version of the highest supported manifest version Note: Update MANIFEST_VERSION_MW_VERSION when changing this.
Definition at line 28 of file ExtensionRegistry.php.
Referenced by ConvertExtensionToRegistration\execute(), UpdateExtensionJsonSchema\execute(), and ExtensionJsonValidator\validate().
const ExtensionRegistry::MANIFEST_VERSION_MW_VERSION = '>= 1.29.0' |
MediaWiki version constraint representing what the current highest MANIFEST_VERSION is supported in.
Definition at line 34 of file ExtensionRegistry.php.
Referenced by ConvertExtensionToRegistration\execute(), and UpdateExtensionJsonSchema\updateRequiredMwVersion().
const ExtensionRegistry::MEDIAWIKI_CORE = 'MediaWiki' |
"requires" key that applies to MediaWiki core
Definition at line 22 of file ExtensionRegistry.php.
Referenced by VersionChecker\checkArray(), ConvertExtensionToRegistration\execute(), and UpdateExtensionJsonSchema\updateRequiredMwVersion().
const ExtensionRegistry::MERGE_STRATEGY = '_merge_strategy' |
Special key that defines the merge strategy.
Definition at line 53 of file ExtensionRegistry.php.
Referenced by exportExtractedData(), ExtensionProcessor\extractConfig2(), ExtensionProcessor\getExtractedInfo(), and UpdateExtensionJsonSchema\updateTo2().
const ExtensionRegistry::OLDEST_MANIFEST_VERSION = 1 |
Version of the oldest supported manifest version.
Definition at line 39 of file ExtensionRegistry.php.
Referenced by ExtensionJsonValidator\validate().