Go to the documentation of this file.
33 parent::__construct( $query, $moduleName,
'am' );
39 if ( is_null( $params[
'lang'] ) ) {
43 [
'apierror-invalidlang', $this->
encodeParamName(
'lang' ) ],
'invalidlang'
49 if ( $params[
'enableparser'] ) {
50 if ( !is_null( $params[
'title'] ) ) {
60 $prop = array_flip( (array)$params[
'prop'] );
63 if ( in_array(
'*', $params[
'messages'] ) ) {
65 if ( $params[
'includelocal'] ) {
66 $message_names = array_unique( array_merge(
75 sort( $message_names );
76 $messages_target = $message_names;
78 $messages_target = $params[
'messages'];
83 if ( isset( $params[
'prefix'] ) ) {
85 $messages_filtered = [];
86 foreach ( $messages_target as $message ) {
88 if ( strpos( $message, $params[
'prefix'] ) === 0 ) {
92 $messages_filtered[] = $message;
97 $messages_target = $messages_filtered;
101 if ( isset( $params[
'filter'] ) ) {
102 $messages_filtered = [];
103 foreach ( $messages_target as $message ) {
105 if ( strpos( $message, $params[
'filter'] ) !==
false ) {
106 $messages_filtered[] = $message;
109 $messages_target = $messages_filtered;
113 $customiseFilterEnabled = $params[
'customised'] !==
'all';
114 if ( $customiseFilterEnabled ) {
117 [ $langObj,
'ucfirst' ],
121 !$langObj->equals( MediaWikiServices::getInstance()->getContentLanguage() )
124 $customised = $params[
'customised'] ===
'modified';
128 $skip = !is_null( $params[
'from'] );
129 $useto = !is_null( $params[
'to'] );
131 foreach ( $messages_target as $message ) {
133 if ( $skip && $message === $params[
'from'] ) {
137 if ( $useto && $message > $params[
'to'] ) {
148 if ( isset( $params[
'args'] ) && count( $params[
'args'] ) != 0 ) {
149 $args = $params[
'args'];
152 if ( $customiseFilterEnabled ) {
153 $messageIsCustomised = isset( $customisedMessages[
'pages'][$langObj->ucfirst( $message )] );
154 if ( $customised === $messageIsCustomised ) {
156 $a[
'customised'] =
true;
165 if ( !$msg->exists() ) {
166 $a[
'missing'] =
true;
169 if ( $params[
'enableparser'] ) {
170 $msgString = $msg->title(
$title )->text();
172 $msgString = $msg->plain();
174 if ( !$params[
'nocontent'] ) {
177 if ( isset( $prop[
'default'] ) ) {
178 $default =
wfMessage( $message )->inLanguage( $langObj )->useDatabase(
false );
179 if ( !$default->exists() ) {
180 $a[
'defaultmissing'] =
true;
181 } elseif ( $default->plain() != $msgString ) {
182 $a[
'default'] = $default->plain();
186 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $a );
193 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'message' );
197 if ( is_null( $params[
'lang'] ) ) {
199 return 'anon-public-user-private';
200 } elseif ( $params[
'enableparser'] ) {
202 return 'anon-public-user-private';
221 'enableparser' =>
false,
222 'nocontent' =>
false,
223 'includelocal' =>
false,
247 'action=query&meta=allmessages&refix=ipb-'
248 =>
'apihelp-query+allmessages-example-ipb',
249 'action=query&meta=allmessages&ammessages=august|mainpage&amlang=de'
250 =>
'apihelp-query+allmessages-example-de',
255 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Allmessages';
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
This is the main query class.
getExamplesMessages()
Returns usage examples for this module.
static normalizeKey( $key)
Normalize message key input.
getHelpUrls()
Return links to more detailed help pages about the module.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
__construct(ApiQuery $query, $moduleName)
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
const PARAM_ALLOW_DUPLICATES
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
This is a base class for all Query modules.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static singleton()
Get the singleton instance of this class.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
A query action to return messages from site message cache.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
static isValidCode( $code)
Returns true if a language code string is of a valid form, whether or not it exists.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
static getMessageKeysFor( $code)
Get all message keys for a given language.
static factory( $code)
Get a cached or new language object for a given language code.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.