Go to the documentation of this file.
3 use Wikimedia\TestingAccessWrapper;
22 'AllowCategorizedRecentChanges' =>
false,
26 'AllowCategorizedRecentChanges' =>
true,
37 self::$main->getContext()->setLanguage(
'en' );
38 self::$main->getContext()->setTitle(
52 $this->assertInstanceOf(
'Message', $msg,
"$what message" );
53 $this->assertTrue( $msg->exists(),
"$what message {$msg->getKey()} exists" );
69 foreach ( $globals
as $k => $v ) {
77 foreach ( $module->getHelpFlags()
as $flag ) {
78 $this->
checkMessage(
"api-help-flag-$flag",
"Flag $flag" );
82 $this->
checkMessage( $module->getDescriptionMessage(),
'Module description' );
88 if ( !is_array( $settings ) ) {
96 $msg =
"apihelp-{$path}-param-{$name}";
98 $this->
checkMessage( $msg,
"Parameter $name description" );
103 "Parameter $name PARAM_HELP_MSG_PER_VALUE is array" );
105 "Parameter $name PARAM_TYPE is array for msg-per-value mode" );
108 if ( isset( $valueMsgs[
$value] ) ) {
109 $msg = $valueMsgs[
$value];
111 $msg =
"apihelp-{$path}-paramvalue-{$name}-{$value}";
113 $this->
checkMessage( $msg,
"Parameter $name value $value" );
120 "Parameter $name PARAM_HELP_MSG_APPEND is array" );
122 $this->
checkMessage( $msg,
"Parameter $name HELP_MSG_APPEND #$i" );
130 $tags[array_shift( $i )] = 1;
136 foreach ( $tags
as $tag => $dummy ) {
137 $this->
checkMessage(
"apihelp-{$path}-paraminfo-{$tag}",
"HELP_MSG_INFO tag $tag" );
141 foreach ( $module->getExamplesMessages()
as $qs => $msg ) {
142 $this->assertStringStartsNotWith(
'api.php?', $qs,
143 "Query string must not begin with 'api.php?'" );
155 foreach ( self::$testGlobals
as $globals ) {
157 foreach ( $globals
as $k => $v ) {
158 $g[] =
"$k=" . var_export( $v, 1 );
160 $k =
"Module $path with " . implode(
', ', $g );
176 $paths[] = $module->getModulePath();
177 $subManager = $module->getModuleManager();
179 $paths = array_merge( $paths, self::getSubModulePaths( $subManager ) );
This is the main API class, used for both external and internal processing.
getContext()
Get the base IContextSource object.
Provides a fallback sequence for Config objects.
A Config instance which stores all settings as a member variable.
static provideDocumentationExists()
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static makeMessage( $msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
Allows to change the fields on the form that will be generated $name
Checks that all API modules, core and extensions, have documentation i18n messages.
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getModuleFromPath( $path)
Get a module from its module path.
checkMessage( $msg, $what)
Test a message.
getModulePath()
Get the path to this module.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
getModuleManager()
Overrides to return this instance's module manager.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static getMain()
Initialize/fetch the ApiMain instance for testing.
getNames( $group=null)
Get an array of modules in a specific group or all if no group is set.
This class holds a list of modules and handles instantiation.
static array $testGlobals
Sets of globals to test.
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
static getMain()
Static methods.
testDocumentationExists( $path, array $globals)
provideDocumentationExists
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static getSubModulePaths(ApiModuleManager $manager)
Return paths of all submodules in an ApiModuleManager, recursively.
getModule( $moduleName, $group=null, $ignoreCache=false)
Get module instance by name, or instantiate it if it does not exist.
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
the array() calling protocol came about after MediaWiki 1.4rc1.