MediaWiki REL1_32
ExtensionProcessor Class Reference
Inheritance diagram for ExtensionProcessor:
Collaboration diagram for ExtensionProcessor:

Public Member Functions

 extractInfo ( $path, array $info, $version)
 
 getExtraAutoloaderPaths ( $dir, array $info)
 Get the path for additional autoloaders, e.g.
 
 getExtractedInfo ()
 
 getRequirements (array $info)
 Get the requirements for the provided info.
 

Protected Member Functions

 extractAttributes ( $path, array $info)
 
 extractConfig1 (array $info)
 Set configuration settings for manifest_version == 1.
 
 extractConfig2 (array $info, $dir)
 Set configuration settings for manifest_version == 2.
 
 extractCredits ( $path, array $info)
 
 extractExtensionMessagesFiles ( $dir, array $info)
 
 extractHooks (array $info)
 
 extractMessagesDirs ( $dir, array $info)
 Set message-related settings, which need to be expanded to use absolute paths.
 
 extractNamespaces (array $info)
 Register namespaces with the appropriate global settings.
 
 extractPathBasedGlobal ( $global, $dir, $paths)
 
 extractResourceLoaderModules ( $dir, array $info)
 
 storeToArray ( $path, $name, $value, &$array)
 

Protected Attributes

array $attributes = []
 Any thing else in the $info that hasn't already been processed.
 
callable[] $callbacks = []
 Things to be called once registration of these extensions are done keyed by the name of the extension that it belongs to.
 
array $config = []
 
array $credits = []
 
array $defines = []
 Things that should be define()'d.
 
array $extAttributes = []
 Extension attributes, keyed by name => settings.
 
array $globals
 Stuff that is going to be set to $GLOBALS.
 

Static Protected Attributes

static string[] $coreAttributes
 Top-level attributes that come from MW core.
 
static array $creditsAttributes
 Keys that are part of the extension credits.
 
static array $globalSettings
 Keys that should be set to $GLOBALS.
 
static array $mergeStrategies
 Mapping of global settings to their specific merge strategies.
 
static array $notAttributes
 Things that are not 'attributes', but are not in $globalSettings or $creditsAttributes.
 

Private Member Functions

 addConfigGlobal ( $key, $value, $extName)
 Helper function to set a value to a specific global, if it isn't set already.
 

Detailed Description

Definition at line 3 of file ExtensionProcessor.php.

Member Function Documentation

◆ addConfigGlobal()

ExtensionProcessor::addConfigGlobal ( $key,
$value,
$extName )
private

Helper function to set a value to a specific global, if it isn't set already.

Parameters
string$keyThe config key with the prefix and anything
mixed$valueThe value of the config
string$extNameName of the extension

Definition at line 518 of file ExtensionProcessor.php.

References $value, and globals.

Referenced by extractConfig1(), and extractConfig2().

◆ extractAttributes()

ExtensionProcessor::extractAttributes ( $path,
array $info )
protected
Parameters
string$path
array$info

Definition at line 264 of file ExtensionProcessor.php.

References $value, and storeToArray().

Referenced by extractInfo().

◆ extractConfig1()

ExtensionProcessor::extractConfig1 ( array $info)
protected

Set configuration settings for manifest_version == 1.

Todo
In the future, this should be done via Config interfaces
Parameters
array$info

Definition at line 463 of file ExtensionProcessor.php.

References addConfigGlobal().

Referenced by extractInfo().

◆ extractConfig2()

ExtensionProcessor::extractConfig2 ( array $info,
$dir )
protected

Set configuration settings for manifest_version == 2.

Todo
In the future, this should be done via Config interfaces
Parameters
array$info
string$dir

Definition at line 486 of file ExtensionProcessor.php.

References $value, addConfigGlobal(), and ExtensionRegistry\MERGE_STRATEGY.

Referenced by extractInfo().

◆ extractCredits()

ExtensionProcessor::extractCredits ( $path,
array $info )
protected
Parameters
string$path
array$info
Returns
string Name of thing
Exceptions
Exception

Definition at line 430 of file ExtensionProcessor.php.

References $credits, $name, $path, and globals.

Referenced by extractInfo().

◆ extractExtensionMessagesFiles()

ExtensionProcessor::extractExtensionMessagesFiles ( $dir,
array $info )
protected

Definition at line 398 of file ExtensionProcessor.php.

References globals.

Referenced by extractInfo().

◆ extractHooks()

ExtensionProcessor::extractHooks ( array $info)
protected

Definition at line 310 of file ExtensionProcessor.php.

References $name, $value, and globals.

Referenced by extractInfo().

◆ extractInfo()

ExtensionProcessor::extractInfo ( $path,
array $info,
$version )

◆ extractMessagesDirs()

ExtensionProcessor::extractMessagesDirs ( $dir,
array $info )
protected

Set message-related settings, which need to be expanded to use absolute paths.

Parameters
string$dir
array$info

Definition at line 414 of file ExtensionProcessor.php.

References $name, array(), and globals.

Referenced by extractInfo().

◆ extractNamespaces()

ExtensionProcessor::extractNamespaces ( array $info)
protected

Register namespaces with the appropriate global settings.

Parameters
array$info

Definition at line 329 of file ExtensionProcessor.php.

References globals.

Referenced by extractInfo().

◆ extractPathBasedGlobal()

ExtensionProcessor::extractPathBasedGlobal ( $global,
$dir,
$paths )
protected

Definition at line 527 of file ExtensionProcessor.php.

References globals.

Referenced by extractInfo().

◆ extractResourceLoaderModules()

ExtensionProcessor::extractResourceLoaderModules ( $dir,
array $info )
protected

Definition at line 367 of file ExtensionProcessor.php.

References $name, and globals.

Referenced by extractInfo().

◆ getExtraAutoloaderPaths()

ExtensionProcessor::getExtraAutoloaderPaths ( $dir,
array $info )

Get the path for additional autoloaders, e.g.

the one of Composer.

Parameters
string$dir
array$info
Returns
array Containing the paths for autoloader file(s).
Since
1.27

Implements Processor.

Definition at line 551 of file ExtensionProcessor.php.

◆ getExtractedInfo()

ExtensionProcessor::getExtractedInfo ( )
Returns
array With following keys: 'globals' - variables to be set to $GLOBALS 'defines' - constants to define 'config' - configuration information 'callbacks' - functions to be executed by the registry 'credits' - metadata to be stored by registry 'attributes' - registration info which isn't a global variable

Implements Processor.

Definition at line 272 of file ExtensionProcessor.php.

References $attributes, $callbacks, $config, $credits, $defines, $globals, $value, globals, ExtensionRegistry\MERGE_STRATEGY, and storeToArray().

◆ getRequirements()

ExtensionProcessor::getRequirements ( array $info)

Get the requirements for the provided info.

Since
1.26
Parameters
array$info
Returns
array Where keys are the name to have a constraint on, like 'MediaWiki'. Values are a constraint string like "1.26.1".

Implements Processor.

Definition at line 306 of file ExtensionProcessor.php.

◆ storeToArray()

ExtensionProcessor::storeToArray ( $path,
$name,
$value,
& $array )
protected
Parameters
string$path
string$name
array$value
array&$array
Exceptions
InvalidArgumentException

Definition at line 540 of file ExtensionProcessor.php.

References $name, and $value.

Referenced by extractAttributes(), extractInfo(), and getExtractedInfo().

Member Data Documentation

◆ $attributes

array ExtensionProcessor::$attributes = []
protected

Any thing else in the $info that hasn't already been processed.

Definition at line 176 of file ExtensionProcessor.php.

Referenced by getExtractedInfo().

◆ $callbacks

callable [] ExtensionProcessor::$callbacks = []
protected

Things to be called once registration of these extensions are done keyed by the name of the extension that it belongs to.

Definition at line 158 of file ExtensionProcessor.php.

Referenced by getExtractedInfo().

◆ $config

array ExtensionProcessor::$config = []
protected

Definition at line 168 of file ExtensionProcessor.php.

Referenced by getExtractedInfo().

◆ $coreAttributes

string [] ExtensionProcessor::$coreAttributes
staticprotected
Initial value:
= [
'SkinOOUIThemes',
'TrackingCategories',
]

Top-level attributes that come from MW core.

Definition at line 64 of file ExtensionProcessor.php.

◆ $credits

array ExtensionProcessor::$credits = []
protected

Definition at line 163 of file ExtensionProcessor.php.

Referenced by extractCredits(), and getExtractedInfo().

◆ $creditsAttributes

array ExtensionProcessor::$creditsAttributes
staticprotected
Initial value:
= [
'name',
'namemsg',
'author',
'version',
'url',
'description',
'descriptionmsg',
'license-name',
]

Keys that are part of the extension credits.

Definition at line 97 of file ExtensionProcessor.php.

◆ $defines

array ExtensionProcessor::$defines = []
protected

Things that should be define()'d.

Definition at line 150 of file ExtensionProcessor.php.

Referenced by getExtractedInfo().

◆ $extAttributes

array ExtensionProcessor::$extAttributes = []
protected

Extension attributes, keyed by name => settings.

Definition at line 184 of file ExtensionProcessor.php.

◆ $globals

array ExtensionProcessor::$globals
protected
Initial value:
= [
'wgExtensionMessagesFiles' => [],
'wgMessagesDirs' => [],
]

Stuff that is going to be set to $GLOBALS.

Some keys are pre-set to arrays so we can += to them

Definition at line 140 of file ExtensionProcessor.php.

Referenced by MockExtensionProcessor\__construct(), and getExtractedInfo().

◆ $globalSettings

array ExtensionProcessor::$globalSettings
staticprotected

Keys that should be set to $GLOBALS.

Definition at line 10 of file ExtensionProcessor.php.

◆ $mergeStrategies

array ExtensionProcessor::$mergeStrategies
staticprotected
Initial value:
= [
'wgAuthManagerAutoConfig' => 'array_plus_2d',
'wgCapitalLinkOverrides' => 'array_plus',
'wgExtensionCredits' => 'array_merge_recursive',
'wgExtraGenderNamespaces' => 'array_plus',
'wgGrantPermissions' => 'array_plus_2d',
'wgGroupPermissions' => 'array_plus_2d',
'wgHooks' => 'array_merge_recursive',
'wgNamespaceContentModels' => 'array_plus',
'wgNamespaceProtection' => 'array_plus',
'wgNamespacesWithSubpages' => 'array_plus',
'wgPasswordPolicy' => 'array_merge_recursive',
'wgRateLimits' => 'array_plus_2d',
'wgRevokePermissions' => 'array_plus_2d',
]

Mapping of global settings to their specific merge strategies.

See also
ExtensionRegistry::exportExtractedData
getExtractedInfo

Definition at line 76 of file ExtensionProcessor.php.

◆ $notAttributes

array ExtensionProcessor::$notAttributes
staticprotected
Initial value:
= [
'callback',
'Hooks',
'namespaces',
'ResourceFileModulePaths',
'ResourceModules',
'ResourceModuleSkinStyles',
'ExtensionMessagesFiles',
'MessagesDirs',
'type',
'config',
'config_prefix',
'ServiceWiringFiles',
'ParserTestFiles',
'AutoloadClasses',
'manifest_version',
'load_composer_autoloader',
]

Things that are not 'attributes', but are not in $globalSettings or $creditsAttributes.

Definition at line 114 of file ExtensionProcessor.php.


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