31 parent::__construct(
$query, $moduleName,
'am' );
37 if ( is_null(
$params[
'lang'] ) ) {
39 } elseif ( !Language::isValidCode(
$params[
'lang'] ) ) {
41 [
'apierror-invalidlang', $this->
encodeParamName(
'lang' ) ],
'invalidlang'
44 $langObj = Language::factory(
$params[
'lang'] );
47 if (
$params[
'enableparser'] ) {
48 if ( !is_null(
$params[
'title'] ) ) {
49 $title = Title::newFromText(
$params[
'title'] );
50 if ( !$title || $title->isExternal() ) {
54 $title = Title::newFromText(
'API' );
58 $prop = array_flip( (array)
$params[
'prop'] );
61 if ( in_array(
'*',
$params[
'messages'] ) ) {
62 $message_names = Language::getMessageKeysFor( $langObj->getCode() );
63 if (
$params[
'includelocal'] ) {
64 $message_names = array_unique( array_merge(
73 sort( $message_names );
74 $messages_target = $message_names;
76 $messages_target =
$params[
'messages'];
81 if ( isset(
$params[
'prefix'] ) ) {
83 $messages_filtered = [];
84 foreach ( $messages_target as $message ) {
86 if ( strpos( $message,
$params[
'prefix'] ) === 0 ) {
90 $messages_filtered[] = $message;
95 $messages_target = $messages_filtered;
99 if ( isset(
$params[
'filter'] ) ) {
100 $messages_filtered = [];
101 foreach ( $messages_target as $message ) {
103 if ( strpos( $message,
$params[
'filter'] ) !==
false ) {
104 $messages_filtered[] = $message;
107 $messages_target = $messages_filtered;
111 $customiseFilterEnabled =
$params[
'customised'] !==
'all';
112 if ( $customiseFilterEnabled ) {
117 [ $langObj,
'ucfirst' ],
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 ) {
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();
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';
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
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.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_ALLOW_DUPLICATES
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getResult()
Get the result object.
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.
A query action to return messages from site message cache.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getHelpUrls()
Return links to more detailed help pages about the module.
__construct(ApiQuery $query, $moduleName)
getExamplesMessages()
Returns usage examples for this module.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
This is the main query class.
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
static singleton()
Get the signleton instance of this class.
static normalizeKey( $key)
Normalize message key input.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query