MediaWiki REL1_39
|
This class holds a list of modules and handles instantiation. More...
Public Member Functions | |
__construct (ApiBase $parentModule, ObjectFactory $objectFactory=null) | |
Construct new module manager. | |
addModule ( $name, $group, $spec, $factory=null) | |
Add or overwrite a module in this ApiMain instance. | |
addModules (array $modules, $group) | |
Add a list of modules to the manager. | |
getClassName ( $module) | |
Returns the class name of the given module. | |
getGroups () | |
Get a list of groups this manager contains. | |
getModule ( $moduleName, $group=null, $ignoreCache=false) | |
Get module instance by name, or instantiate it if it does not exist. | |
getModuleGroup ( $moduleName) | |
Returns the group name for the given module. | |
getNames ( $group=null) | |
Get an array of modules in a specific group or all if no group is set. | |
getNamesWithClasses ( $group=null) | |
Create an array of (moduleName => moduleClass) for a specific group or for all. | |
isDefined ( $moduleName, $group=null) | |
Returns true if the specific module is defined at all or in a specific group. | |
Public Member Functions inherited from ContextSource | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. | |
getActionName () | |
Get the action name for the current web request. | |
getAuthority () | |
getConfig () | |
getContext () | |
Get the base IContextSource object. | |
getCsrfTokenSet () | |
Get a repository to obtain and match CSRF tokens. | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getStats () | |
getTiming () | |
getTitle () | |
getUser () | |
getWikiPage () | |
Get the WikiPage object. | |
msg ( $key,... $params) | |
Get a Message object with context set Parameters are the same as wfMessage() | |
setContext (IContextSource $context) | |
This class holds a list of modules and handles instantiation.
Definition at line 33 of file ApiModuleManager.php.
ApiModuleManager::__construct | ( | ApiBase | $parentModule, |
ObjectFactory | $objectFactory = null ) |
Construct new module manager.
ApiBase | $parentModule | Parent module instance will be used during instantiation |
ObjectFactory | null | $objectFactory | Object factory to use when instantiating modules |
Definition at line 62 of file ApiModuleManager.php.
ApiModuleManager::addModule | ( | $name, | |
$group, | |||
$spec, | |||
$factory = null ) |
Add or overwrite a module in this ApiMain instance.
Intended for use by extending classes who wish to add their own modules to their lexicon or override the behavior of inherent ones.
ObjectFactory is used to instantiate the module when needed. The parent module ($parentModule
from __construct()
) and the $name
are passed as extraArgs.
string | $name | The identifier for this module. |
string | $group | Name of the module group |
string | array | $spec | The ObjectFactory spec for instantiating the module, or a class name to instantiate. |
callable | null | $factory | Callback for instantiating the module (deprecated). |
InvalidArgumentException |
Definition at line 102 of file ApiModuleManager.php.
References wfDeprecated().
Referenced by addModules().
ApiModuleManager::addModules | ( | array | $modules, |
$group ) |
Add a list of modules to the manager.
Each module is described by an ObjectFactory spec.
This simply calls addModule()
for each module in $modules
.
array | $modules | A map of ModuleName => ModuleSpec |
string | $group | Which group modules belong to (action,format,...) |
Definition at line 77 of file ApiModuleManager.php.
References $modules, and addModule().
ApiModuleManager::getClassName | ( | $module | ) |
Returns the class name of the given module.
string | $module | Module name |
Definition at line 230 of file ApiModuleManager.php.
ApiModuleManager::getGroups | ( | ) |
Get a list of groups this manager contains.
Definition at line 269 of file ApiModuleManager.php.
ApiModuleManager::getModule | ( | $moduleName, | |
$group = null, | |||
$ignoreCache = false ) |
Get module instance by name, or instantiate it if it does not exist.
string | $moduleName | |
string | null | $group | Optionally validate that the module is in a specific group |
bool | $ignoreCache | If true, force-creates a new instance and does not cache it |
Definition at line 139 of file ApiModuleManager.php.
ApiModuleManager::getModuleGroup | ( | $moduleName | ) |
Returns the group name for the given module.
string | $moduleName |
Definition at line 257 of file ApiModuleManager.php.
ApiModuleManager::getNames | ( | $group = null | ) |
Get an array of modules in a specific group or all if no group is set.
string | null | $group | Optional group filter |
Definition at line 193 of file ApiModuleManager.php.
ApiModuleManager::getNamesWithClasses | ( | $group = null | ) |
Create an array of (moduleName => moduleClass) for a specific group or for all.
string | null | $group | Name of the group to get or null for all |
Definition at line 212 of file ApiModuleManager.php.
ApiModuleManager::isDefined | ( | $moduleName, | |
$group = null ) |
Returns true if the specific module is defined at all or in a specific group.
string | $moduleName | |
string | null | $group | Group name to check against, or null to check all groups, |
Definition at line 244 of file ApiModuleManager.php.