MediaWiki master
MediaWiki\Registration\ExtensionProcessor Class Reference

Load extension manifests and then aggregate their contents. More...

Inherits MediaWiki\Registration\Processor.

Collaboration diagram for MediaWiki\Registration\ExtensionProcessor:

Public Member Functions

 extractInfo ( $path, array $info, $version)
 
 extractInfoFromFile (string $path)
 Extracts extension info from the given JSON file.
 
 getExtractedAutoloadInfo (bool $includeDev=false)
 Returns the extracted autoload info.
 
 getExtractedInfo (bool $includeDev=false)
 
 getRequirements (array $info, $includeDev)
 Get the requirements for the provided info.
 
- Public Member Functions inherited from MediaWiki\Registration\Processor
 getExtractedInfo ()
 

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)
 
 extractForeignResourcesDir (array $info, string $name, string $dir)
 
 extractHooks (array $info, string $path)
 Extract hook information from Hooks and HookHandler attributes.
 
 extractImplicitRights (array $info)
 Extract any user rights that should be granted implicitly.
 
 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)
 
 extractRestModuleFiles ( $dir, array $info)
 
 extractSkinImportPaths ( $dir, array $info)
 
 extractSkins ( $dir, array $info)
 Extract skins and handle path correction for templateDirectory.
 
 extractTranslationAliasesDirs ( $dir, array $info)
 Set localization related settings, which need to be expanded to use absolute paths.
 
 storeToArray ( $path, $name, $value, &$array)
 Stores $value to $array; using array_merge() if $array already contains $name.
 
 storeToArrayRecursive ( $path, $name, $value, &$array)
 Stores $value to $array; using array_merge_recursive() if $array already contains $name.
 

Protected Attributes

array $attributes = []
 Anything else in the $info that hasn't already been processed.
 
string[][] $autoload
 Autoloader information.
 
string[][] $autoloadDev
 Autoloader information for development.
 
callable[] $callbacks = []
 Things to be called once the registration of these extensions is done.
 
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 array $globalSettings
 Keys that should be set to $GLOBALS.
 

Detailed Description

Load extension manifests and then aggregate their contents.

Stability: newable
since 1.39

Definition at line 18 of file ExtensionProcessor.php.

Member Function Documentation

◆ extractAttributes()

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

Definition at line 352 of file ExtensionProcessor.php.

References $path, and MediaWiki\Registration\ExtensionProcessor\storeToArrayRecursive().

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

◆ extractConfig1()

MediaWiki\Registration\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 839 of file ExtensionProcessor.php.

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

◆ extractConfig2()

MediaWiki\Registration\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 881 of file ExtensionProcessor.php.

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

◆ extractCredits()

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

Definition at line 795 of file ExtensionProcessor.php.

References MediaWiki\Registration\ExtensionProcessor\$credits, and $path.

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

◆ extractExtensionMessagesFiles()

MediaWiki\Registration\ExtensionProcessor::extractExtensionMessagesFiles ( $dir,
array $info )
protected

◆ extractForeignResourcesDir()

MediaWiki\Registration\ExtensionProcessor::extractForeignResourcesDir ( array $info,
string $name,
string $dir )
protected

◆ extractHooks()

MediaWiki\Registration\ExtensionProcessor::extractHooks ( array $info,
string $path )
protected

Extract hook information from Hooks and HookHandler attributes.

Store hook in $wgHooks if a legacy style handler or the 'Hooks' attribute if a non-legacy handler

Parameters
array$infoattributes and associated values from extension.json
string$pathpath to extension.json

Definition at line 549 of file ExtensionProcessor.php.

References $path.

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

◆ extractImplicitRights()

MediaWiki\Registration\ExtensionProcessor::extractImplicitRights ( array $info)
protected

Extract any user rights that should be granted implicitly.

Parameters
array$info

Definition at line 757 of file ExtensionProcessor.php.

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

◆ extractInfo()

MediaWiki\Registration\ExtensionProcessor::extractInfo ( $path,
array $info,
$version )

◆ extractInfoFromFile()

MediaWiki\Registration\ExtensionProcessor::extractInfoFromFile ( string $path)

Extracts extension info from the given JSON file.

Parameters
string$path
Returns
void

Definition at line 250 of file ExtensionProcessor.php.

References $path, and MediaWiki\Registration\ExtensionProcessor\extractInfo().

◆ extractMessagesDirs()

MediaWiki\Registration\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 709 of file ExtensionProcessor.php.

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

◆ extractNamespaces()

MediaWiki\Registration\ExtensionProcessor::extractNamespaces ( array $info)
protected

Register namespaces with the appropriate global settings.

Parameters
array$info

Definition at line 583 of file ExtensionProcessor.php.

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

◆ extractPathBasedGlobal()

MediaWiki\Registration\ExtensionProcessor::extractPathBasedGlobal ( $global,
$dir,
$paths )
protected

Definition at line 933 of file ExtensionProcessor.php.

References $path.

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

◆ extractResourceLoaderModules()

MediaWiki\Registration\ExtensionProcessor::extractResourceLoaderModules ( $dir,
array $info )
protected

◆ extractRestModuleFiles()

MediaWiki\Registration\ExtensionProcessor::extractRestModuleFiles ( $dir,
array $info )
protected

◆ extractSkinImportPaths()

MediaWiki\Registration\ExtensionProcessor::extractSkinImportPaths ( $dir,
array $info )
protected
Parameters
string$dir
array$info

Definition at line 780 of file ExtensionProcessor.php.

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

◆ extractSkins()

MediaWiki\Registration\ExtensionProcessor::extractSkins ( $dir,
array $info )
protected

Extract skins and handle path correction for templateDirectory.

Parameters
string$dir
array$info

Definition at line 740 of file ExtensionProcessor.php.

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

◆ extractTranslationAliasesDirs()

MediaWiki\Registration\ExtensionProcessor::extractTranslationAliasesDirs ( $dir,
array $info )
protected

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

Parameters
string$dir
array$info

Definition at line 726 of file ExtensionProcessor.php.

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

◆ getExtractedAutoloadInfo()

MediaWiki\Registration\ExtensionProcessor::getExtractedAutoloadInfo ( bool $includeDev = false)

Returns the extracted autoload info.

The autoload info is returned as an associative array with three keys:

  • files: a list of files to load, for use with Autoloader::loadFile()
  • classes: a map of class names to files, for use with Autoloader::registerClass()
  • namespaces: a map of namespace names to directories, for use with Autoloader::registerNamespace()
Since
1.39
Parameters
bool$includeDev
Returns
array[] The autoload info.

Implements MediaWiki\Registration\Processor.

Definition at line 994 of file ExtensionProcessor.php.

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

◆ getExtractedInfo()

◆ getRequirements()

MediaWiki\Registration\ExtensionProcessor::getRequirements ( array $info,
$includeDev )

Get the requirements for the provided info.

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

Implements MediaWiki\Registration\Processor.

Definition at line 398 of file ExtensionProcessor.php.

◆ storeToArray()

MediaWiki\Registration\ExtensionProcessor::storeToArray ( $path,
$name,
$value,
& $array )
protected

Stores $value to $array; using array_merge() if $array already contains $name.

Parameters
string$path
string$name
array$value
array&$array
Exceptions
InvalidArgumentException

Definition at line 969 of file ExtensionProcessor.php.

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

◆ storeToArrayRecursive()

MediaWiki\Registration\ExtensionProcessor::storeToArrayRecursive ( $path,
$name,
$value,
& $array )
protected

Stores $value to $array; using array_merge_recursive() if $array already contains $name.

Parameters
string$path
string$name
array$value
array&$array

Definition at line 948 of file ExtensionProcessor.php.

Referenced by MediaWiki\Registration\ExtensionProcessor\extractAttributes(), MediaWiki\Registration\ExtensionProcessor\extractInfo(), and MediaWiki\Registration\ExtensionProcessor\getExtractedInfo().

Member Data Documentation

◆ $attributes

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

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

Definition at line 233 of file ExtensionProcessor.php.

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

◆ $autoload

string [][] MediaWiki\Registration\ExtensionProcessor::$autoload
protected
Initial value:
= [
'files' => [],
'classes' => [],
'namespaces' => [],
]

Autoloader information.

Each element is an array of strings. 'files' is just a list, 'classes' and 'namespaces' are associative.

Definition at line 209 of file ExtensionProcessor.php.

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

◆ $autoloadDev

string [][] MediaWiki\Registration\ExtensionProcessor::$autoloadDev
protected
Initial value:
= [
'files' => [],
'classes' => [],
'namespaces' => [],
]

Autoloader information for development.

Same structure as $autoload.

Definition at line 221 of file ExtensionProcessor.php.

◆ $callbacks

callable [] MediaWiki\Registration\ExtensionProcessor::$callbacks = []
protected

Things to be called once the registration of these extensions is done.

Keyed by the name of the extension that it belongs to

Definition at line 195 of file ExtensionProcessor.php.

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

◆ $credits

array MediaWiki\Registration\ExtensionProcessor::$credits = []
protected

◆ $defines

array MediaWiki\Registration\ExtensionProcessor::$defines = []
protected

Things that should be define()'d.

Definition at line 186 of file ExtensionProcessor.php.

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

◆ $extAttributes

array MediaWiki\Registration\ExtensionProcessor::$extAttributes = []
protected

Extension attributes, keyed by name => settings.

Definition at line 241 of file ExtensionProcessor.php.

◆ $globals

array MediaWiki\Registration\ExtensionProcessor::$globals
protected
Initial value:
= [
'wgExtensionMessagesFiles' => [],
'wgRestAPIAdditionalRouteFiles' => [],
'wgMessagesDirs' => [],
'TranslationAliasesDirs' => [],
]

Stuff that is going to be set to $GLOBALS.

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

Definition at line 174 of file ExtensionProcessor.php.

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

◆ $globalSettings

array MediaWiki\Registration\ExtensionProcessor::$globalSettings
staticprotected

Keys that should be set to $GLOBALS.

Definition at line 25 of file ExtensionProcessor.php.


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