Go to the documentation of this file.
236 $this->mMainModule = $mainModule;
237 $this->mModuleName = $moduleName;
238 $this->mModulePrefix = $modulePrefix;
266 abstract public function execute();
307 if ( !is_array( $examples ) ) {
308 $examples = [ $examples ];
309 } elseif ( $examples && (
count( $examples ) & 1 ) == 0 &&
310 array_keys( $examples ) === range( 0,
count( $examples ) - 1 ) &&
311 !preg_match(
'/^\s*api\.php\?/', $examples[0] )
316 $examplesCount =
count( $examples );
317 for ( $i = 0; $i < $examplesCount; $i += 2 ) {
318 $tmp[$examples[$i + 1]] = $examples[$i];
323 foreach ( $examples
as $k => $v ) {
324 if ( is_numeric( $k ) ) {
330 if ( is_array( $msg ) ) {
331 $msg = implode(
' ', $msg );
335 $qs = preg_replace(
'/^\s*api\.php\?/',
'', $qs );
336 $ret[$qs] = $this->
msg(
'api-help-fallback-example', [ $msg ] );
545 return $this->
getMain()->lacksSameOriginSecurity();
574 if (
$path ===
'main' ) {
578 $parts = explode(
'+',
$path );
579 if (
count( $parts ) === 1 ) {
581 $parts = explode(
' ',
$path );
584 $count =
count( $parts );
585 for ( $i = 0; $i < $count; $i++ ) {
587 $manager = $parent->getModuleManager();
588 if ( $manager ===
null ) {
589 $errorPath = implode(
'+', array_slice( $parts, 0, $i ) );
590 $this->
dieWithError( [
'apierror-badmodule-nosubmodules', $errorPath ],
'badmodule' );
592 $module = $manager->getModule( $parts[$i] );
594 if ( $module ===
null ) {
595 $errorPath = $i ? implode(
'+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName();
597 [
'apierror-badmodule-badsubmodule', $errorPath,
wfEscapeWikiText( $parts[$i] ) ],
617 return $this->
getMain()->getResult();
631 return $this->
getMain()->getErrorFormatter();
639 if ( !isset( $this->mSlaveDB ) ) {
657 return $this->
getMain()->getContinuationManager();
671 $this->
getMain()->setContinuationManager( $manager );
700 if ( is_array( $paramName ) ) {
701 return array_map(
function (
$name ) {
702 return $this->mModulePrefix .
$name;
705 return $this->mModulePrefix . $paramName;
720 if ( !isset( $this->mParamCache[$parseLimit] ) ) {
725 foreach (
$params as $paramName => $paramSettings ) {
727 $paramName, $paramSettings, $parseLimit );
730 $this->mParamCache[$parseLimit] = $results;
733 return $this->mParamCache[$parseLimit];
755 $required = func_get_args();
756 array_shift( $required );
758 $intersection = array_intersect( array_keys( array_filter(
$params,
759 [ $this,
'parameterNotEmpty' ] ) ), $required );
761 if (
count( $intersection ) > 1 ) {
763 'apierror-invalidparammix',
764 Message::listParam( array_map(
768 array_values( $intersection )
770 count( $intersection ),
772 } elseif (
count( $intersection ) == 0 ) {
774 'apierror-missingparam-one-of',
775 Message::listParam( array_map(
779 array_values( $required )
793 $required = func_get_args();
794 array_shift( $required );
796 $intersection = array_intersect( array_keys( array_filter(
$params,
797 [ $this,
'parameterNotEmpty' ] ) ), $required );
799 if (
count( $intersection ) > 1 ) {
801 'apierror-invalidparammix',
802 Message::listParam( array_map(
806 array_values( $intersection )
808 count( $intersection ),
821 $required = func_get_args();
822 array_shift( $required );
824 $intersection = array_intersect(
825 array_keys( array_filter(
$params, [ $this,
'parameterNotEmpty' ] ) ),
829 if (
count( $intersection ) == 0 ) {
831 'apierror-missingparam-at-least-one-of',
832 Message::listParam( array_map(
836 array_values( $required )
852 if ( $this->
getConfig()->
get(
'DebugAPI' ) || $this->
getMain()->isInternalMode() ) {
856 $queryValues = $this->
getRequest()->getQueryValues();
859 if ( $prefix !==
'noprefix' ) {
862 if ( array_key_exists( $param, $queryValues ) ) {
863 $badParams[] = $param;
869 [
'apierror-mustpostparams', join(
', ', $badParams ),
count( $badParams ) ]
881 return !is_null( $x ) && $x !==
false;
899 if ( isset(
$params[
'title'] ) ) {
901 if ( !$titleObj || $titleObj->isExternal() ) {
904 if ( !$titleObj->canExist() ) {
908 if ( $load !==
false ) {
909 $pageObj->loadPageData( $load );
911 } elseif ( isset(
$params[
'pageid'] ) ) {
912 if ( $load ===
false ) {
936 if ( isset(
$params[
'title'] ) ) {
938 if ( !$titleObj || $titleObj->isExternal() ) {
942 } elseif ( isset(
$params[
'pageid'] ) ) {
964 switch ( $watchlist ) {
972 # If the user is already watching, don't bother checking
973 if ( $userWatching ) {
976 # If no user option was passed, use watchdefault and watchcreations
977 if ( is_null( $userOption ) ) {
978 return $this->
getUser()->getBoolOption(
'watchdefault' ) ||
979 $this->
getUser()->getBoolOption(
'watchcreations' ) && !$titleObj->exists();
982 # Watch the article based on the user preference
983 return $this->
getUser()->getBoolOption( $userOption );
986 return $userWatching;
989 return $userWatching;
1007 if ( !is_array( $paramSettings ) ) {
1009 self::PARAM_DFLT => $paramSettings,
1013 $default = isset( $paramSettings[self::PARAM_DFLT] )
1016 $multi = isset( $paramSettings[self::PARAM_ISMULTI] )
1019 $type = isset( $paramSettings[self::PARAM_TYPE] )
1022 $dupes = isset( $paramSettings[self::PARAM_ALLOW_DUPLICATES] )
1025 $deprecated = isset( $paramSettings[self::PARAM_DEPRECATED] )
1028 $required = isset( $paramSettings[self::PARAM_REQUIRED] )
1031 $allowAll = isset( $paramSettings[self::PARAM_ALL] )
1036 if ( !isset(
$type ) ) {
1037 if ( isset( $default ) ) {
1038 $type = gettype( $default );
1044 if (
$type ==
'password' || !empty( $paramSettings[self::PARAM_SENSITIVE] ) ) {
1045 $this->
getMain()->markParamsSensitive( $encParamName );
1048 if (
$type ==
'boolean' ) {
1049 if ( isset( $default ) && $default !==
false ) {
1053 "Boolean param $encParamName's default is set to '$default'. " .
1054 'Boolean parameters must default to false.'
1059 } elseif (
$type ==
'upload' ) {
1060 if ( isset( $default ) ) {
1064 "File upload param $encParamName's default is set to " .
1065 "'$default'. File upload parameters may not have a default." );
1068 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1071 if ( !
$value->exists() ) {
1075 $value = $this->
getMain()->getRequest()->unsetVal( $encParamName );
1078 [
'apierror-badupload', $encParamName ],
1079 "badupload_{$encParamName}"
1084 $value = $this->
getMain()->getVal( $encParamName, $default );
1088 if ( isset( $paramSettings[self::PARAM_EXTRA_NAMESPACES] ) &&
1089 is_array( $paramSettings[self::PARAM_EXTRA_NAMESPACES] )
1091 $type = array_merge(
$type, $paramSettings[self::PARAM_EXTRA_NAMESPACES] );
1098 if ( isset( $paramSettings[self::PARAM_SUBMODULE_MAP] ) ) {
1099 $type = array_keys( $paramSettings[self::PARAM_SUBMODULE_MAP] );
1106 $rawValue =
$request->getRawVal( $encParamName );
1107 if ( $rawValue ===
null ) {
1108 $rawValue = $default;
1112 if ( isset(
$value ) && substr( $rawValue, 0, 1 ) ===
"\x1f" ) {
1116 $value = join(
"\x1f",
$request->normalizeUnicode( explode(
"\x1f", $rawValue ) ) );
1118 $this->
dieWithError(
'apierror-badvalue-notmultivalue',
'badvalue_notmultivalue' );
1123 if ( $rawValue !==
$value ) {
1129 if ( $allowAll && $multi && is_array(
$type ) && in_array( $allSpecifier,
$type,
true ) ) {
1132 "For param $encParamName, PARAM_ALL collides with a possible value" );
1134 if ( isset(
$value ) && ( $multi || is_array(
$type ) ) ) {
1140 $allowAll ? $allSpecifier :
null
1147 if ( !is_array(
$type ) ) {
1154 if ( $required &&
$value ===
'' ) {
1155 $this->
dieWithError( [
'apierror-missingparam', $paramName ] );
1159 $min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[
self::PARAM_MIN] :
null;
1160 $max = isset( $paramSettings[self::PARAM_MAX] ) ? $paramSettings[
self::PARAM_MAX] :
null;
1161 $enforceLimits = isset( $paramSettings[self::PARAM_RANGE_ENFORCE] )
1164 if ( is_array(
$value ) ) {
1166 if ( !is_null( $min ) || !is_null( $max ) ) {
1168 $this->
validateLimit( $paramName, $v, $min, $max,
null, $enforceLimits );
1173 if ( !is_null( $min ) || !is_null( $max ) ) {
1179 if ( !$parseLimit ) {
1183 if ( !isset( $paramSettings[self::PARAM_MAX] )
1184 || !isset( $paramSettings[self::PARAM_MAX2] )
1188 "MAX1 or MAX2 are not defined for the limit $encParamName"
1192 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1194 $min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[
self::PARAM_MIN] : 0;
1206 $paramSettings[self::PARAM_MAX],
1207 $paramSettings[self::PARAM_MAX2]
1213 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1217 if ( is_array(
$value ) ) {
1218 foreach (
$value as $key => $val ) {
1226 if ( is_array(
$value ) ) {
1227 foreach (
$value as $key => $val ) {
1238 if ( !is_array(
$value ) && !$multi ) {
1242 if ( !$tagsStatus->isGood() ) {
1247 ApiBase::dieDebug( __METHOD__,
"Param $encParamName's type is unknown - $type" );
1252 if ( !$dupes && is_array(
$value ) ) {
1257 if ( $deprecated &&
$value !==
false ) {
1258 $feature = $encParamName;
1260 while ( !$m->isMain() ) {
1261 $p = $m->getParent();
1262 $name = $m->getModuleName();
1263 $param = $p->encodeParamName( $p->getModuleManager()->getModuleGroup(
$name ) );
1264 $feature =
"{$param}={$name}&{$feature}";
1267 $this->
addDeprecation( [
'apiwarn-deprecation-parameter', $encParamName ], $feature );
1269 } elseif ( $required ) {
1270 $this->
dieWithError( [
'apierror-missingparam', $paramName ] );
1285 $this->
addWarning( [
'apiwarn-badutf8', $encParamName ] );
1296 if ( substr(
$value, 0, 1 ) ===
"\x1f" ) {
1322 $allSpecifier =
null
1324 if ( ( trim(
$value ) ===
'' || trim(
$value ) ===
"\x1f" ) && $allowMultiple ) {
1331 $sizeLimit =
count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits()
1335 if ( $allowMultiple && is_array( $allowedValues ) && $allSpecifier &&
1336 count( $valuesList ) === 1 && $valuesList[0] === $allSpecifier
1338 return $allowedValues;
1341 if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
1343 [
'apiwarn-toomanyvalues', $valueName, $sizeLimit ],
1344 "too-many-$valueName-for-{$this->getModulePath()}"
1348 if ( !$allowMultiple &&
count( $valuesList ) != 1 ) {
1350 if ( in_array(
$value, $allowedValues,
true ) ) {
1354 if ( is_array( $allowedValues ) ) {
1355 $values = array_map(
function ( $v ) {
1357 }, $allowedValues );
1359 'apierror-multival-only-one-of',
1361 Message::listParam( $values ),
1363 ],
"multival_$valueName" );
1366 'apierror-multival-only-one',
1368 ],
"multival_$valueName" );
1372 if ( is_array( $allowedValues ) ) {
1374 $unknown = array_map(
'wfEscapeWikiText', array_diff( $valuesList, $allowedValues ) );
1375 if (
count( $unknown ) ) {
1376 if ( $allowMultiple ) {
1378 'apiwarn-unrecognizedvalues',
1380 Message::listParam( $unknown,
'comma' ),
1385 [
'apierror-unrecognizedvalue', $valueName,
wfEscapeWikiText( $valuesList[0] ) ],
1386 "unknown_$valueName"
1391 $valuesList = array_intersect( $valuesList, $allowedValues );
1394 return $allowMultiple ? $valuesList : $valuesList[0];
1408 $enforceLimits =
false
1410 if ( !is_null( $min ) &&
$value < $min ) {
1412 [
'apierror-integeroutofrange-belowminimum',
1414 'integeroutofrange',
1415 [
'min' => $min,
'max' => $max,
'botMax' => $botMax ?: $max ]
1417 $this->
warnOrDie( $msg, $enforceLimits );
1423 if ( $this->
getMain()->isInternalMode() ) {
1429 if ( !is_null( $max ) &&
$value > $max ) {
1430 if ( !is_null( $botMax ) && $this->
getMain()->canApiHighLimits() ) {
1431 if (
$value > $botMax ) {
1433 [
'apierror-integeroutofrange-abovebotmax',
1435 'integeroutofrange',
1436 [
'min' => $min,
'max' => $max,
'botMax' => $botMax ?: $max ]
1438 $this->
warnOrDie( $msg, $enforceLimits );
1443 [
'apierror-integeroutofrange-abovemax',
1445 'integeroutofrange',
1446 [
'min' => $min,
'max' => $max,
'botMax' => $botMax ?: $max ]
1448 $this->
warnOrDie( $msg, $enforceLimits );
1467 'unclear-"now"-timestamp'
1473 if (
$value ===
'now' ) {
1478 if ( $unixTimestamp ===
false ) {
1481 "badtimestamp_{$encParamName}"
1500 if ( !isset( $salts[$tokenType] ) ) {
1502 "Module '{$this->getModuleName()}' tried to use token type '$tokenType' " .
1503 'without registering it'
1510 if ( $tokenObj->match( $token ) ) {
1515 if ( $webUiSalt !==
null && $this->
getUser()->matchEditToken(
1537 "baduser_{$encParamName}"
1541 return $title->getText();
1557 protected function setWatch( $watch, $titleObj, $userOption =
null ) {
1589 if ( !is_null(
$params[
'owner'] ) && !is_null(
$params[
'token'] ) ) {
1596 $token =
$user->getOption(
'watchlisttoken' );
1597 if ( $token ==
'' || !hash_equals( $token,
$params[
'token'] ) ) {
1598 $this->
dieWithError(
'apierror-bad-watchlist-token',
'bad_wltoken' );
1601 if ( !$this->
getUser()->isLoggedIn() ) {
1602 $this->
dieWithError(
'watchlistanontext',
'notloggedin' );
1619 if ( is_array( $v ) ) {
1620 return array_map(
'self::escapeWikiText', $v );
1623 '__' =>
'__',
'{' =>
'{',
'}' =>
'}',
1624 '[[Category:' =>
'[[:Category:',
1625 '[[File:' =>
'[[:File:',
'[[Image:' =>
'[[:Image:',
1643 if ( is_string( $msg ) ) {
1645 } elseif ( is_array( $msg ) ) {
1646 $msg = call_user_func_array(
'wfMessage', $msg );
1648 if ( !$msg instanceof Message ) {
1668 if (
$user ===
null ) {
1673 foreach ( $errors
as $error ) {
1674 if ( is_array( $error ) && $error[0] ===
'blockedtext' &&
$user->getBlock() ) {
1680 } elseif ( is_array( $error ) && $error[0] ===
'autoblockedtext' &&
$user->getBlock() ) {
1682 'apierror-autoblocked',
1686 } elseif ( is_array( $error ) && $error[0] ===
'systemblockedtext' &&
$user->getBlock() ) {
1688 'apierror-systemblocked',
1693 call_user_func_array( [
$status,
'fatal' ], (
array)$error );
1735 $data = (
array)$data;
1736 if ( $feature !==
null ) {
1737 $data[
'feature'] = $feature;
1740 $this->
addWarning( $msg,
'deprecation', $data );
1744 $msgs = [ $this->
msg(
'api-usage-mailinglist-ref' ) ];
1745 Hooks::run(
'ApiDeprecationHelp', [ &$msgs ] );
1746 if (
count( $msgs ) > 1 ) {
1747 $key =
'$' . join(
' $', range( 1,
count( $msgs ) ) );
1748 $msg = (
new RawMessage( $key ) )->params( $msgs );
1750 $msg = reset( $msgs );
1752 $this->
getMain()->addWarning( $msg,
'deprecation-help' );
1821 if ( $enforceLimits ) {
1840 'apierror-autoblocked',
1863 throw new MWException(
'Successful status passed to ApiBase::dieStatus' );
1876 'apierror-readonly',
1894 $rights = (
array)$rights;
1895 if ( !call_user_func_array( [
$user,
'isAllowedAny' ], $rights ) ) {
1896 $this->
dieWithError( [
'apierror-permissiondenied', $this->
msg(
"action-{$rights[0]}" ) ] );
1914 foreach ( (
array)$actions
as $action ) {
1915 $errors = array_merge( $errors,
$title->getUserPermissionsErrors( $action,
$user ) );
1934 if ( $this->
getConfig()->
get(
'DebugAPI' ) !==
true ) {
1962 protected static function dieDebug( $method, $message ) {
1963 throw new MWException(
"Internal error in $method: $message" );
1974 $s =
'"' . addslashes( $feature ) .
'"' .
1977 ' "' . addslashes(
$request->getHeader(
'Referer' ) ) .
'"' .
1978 ' "' . addslashes( $this->
getMain()->getUserAgent() ) .
'"';
1995 return "apihelp-{$this->getModulePath()}-description";
2010 Hooks::run(
'APIGetDescription', [ &$apiModule, &$desc ] );
2012 if ( is_array( $desc ) ) {
2013 $desc = implode(
"\n", $desc );
2023 if ( !$msg->exists() ) {
2024 $msg = $this->
msg(
'api-help-fallback-description', $desc );
2028 Hooks::run(
'APIGetDescriptionMessages', [ $this, &$msgs ] );
2053 'api-help-param-token',
2082 Hooks::run(
'APIGetParamDescription', [ &$apiModule, &$desc ] );
2091 foreach (
$params as $param => $settings ) {
2092 if ( !is_array( $settings ) ) {
2096 $d = isset( $desc[$param] ) ? $desc[$param] :
'';
2097 if ( is_array( $d ) ) {
2099 $d = array_map(
function (
$line ) {
2100 if ( preg_match(
'/^\s+(\S+)\s+-\s+(.+)$/',
$line, $m ) ) {
2101 $line =
"\n;{$m[1]}:{$m[2]}";
2105 $d = implode(
' ', $d );
2111 $msg = $this->
msg(
"apihelp-{$path}-param-{$param}" );
2112 if ( !$msg->exists() ) {
2113 $msg = $this->
msg(
'api-help-fallback-parameter', $d );
2120 'Value in ApiBase::PARAM_HELP_MSG is not valid' );
2122 $msgs[$param] = [ $msg ];
2127 'ApiBase::PARAM_HELP_MSG_PER_VALUE is not valid' );
2131 'ApiBase::PARAM_HELP_MSG_PER_VALUE may only be used when ' .
2132 'ApiBase::PARAM_TYPE is an array' );
2137 if ( isset( $valueMsgs[
$value] ) ) {
2138 $msg = $valueMsgs[
$value];
2140 $msg =
"apihelp-{$path}-paramvalue-{$param}-{$value}";
2147 [ $m->getKey(),
'api-help-param-no-description' ],
2150 $msgs[$param][] = $m->setContext( $this->
getContext() );
2153 "Value in ApiBase::PARAM_HELP_MSG_PER_VALUE for $value is not valid" );
2161 'Value for ApiBase::PARAM_HELP_MSG_APPEND is not an array' );
2167 $msgs[$param][] = $m;
2170 'Value in ApiBase::PARAM_HELP_MSG_APPEND is not valid' );
2176 Hooks::run(
'APIGetParamDescriptionMessages', [ $this, &$msgs ] );
2203 $flags[] =
'writerights';
2206 $flags[] =
'mustbeposted';
2226 if ( $this->mModuleSource !==
false ) {
2231 $rClass =
new ReflectionClass( $this );
2232 $path = $rClass->getFileName();
2235 $this->mModuleSource =
null;
2241 if ( self::$extensionInfo ===
null ) {
2242 $extDir = $this->
getConfig()->get(
'ExtensionDirectory' );
2243 self::$extensionInfo = [
2244 realpath( __DIR__ ) ?: __DIR__ => [
2246 'name' =>
'MediaWiki',
2247 'license-name' =>
'GPL-2.0+',
2249 realpath(
"$IP/extensions" ) ?:
"$IP/extensions" =>
null,
2250 realpath( $extDir ) ?: $extDir =>
null,
2256 'license-name' =>
null,
2258 foreach ( $this->
getConfig()->
get(
'ExtensionCredits' )
as $group ) {
2259 foreach ( $group
as $ext ) {
2260 if ( !isset(
$ext[
'path'] ) || !isset(
$ext[
'name'] ) ) {
2265 $extpath =
$ext[
'path'];
2266 if ( !is_dir( $extpath ) ) {
2267 $extpath = dirname( $extpath );
2269 self::$extensionInfo[realpath( $extpath ) ?: $extpath] =
2270 array_intersect_key(
$ext, $keep );
2274 $extpath =
$ext[
'path'];
2275 if ( !is_dir( $extpath ) ) {
2276 $extpath = dirname( $extpath );
2278 self::$extensionInfo[realpath( $extpath ) ?: $extpath] =
2279 array_intersect_key(
$ext, $keep );
2286 if ( array_key_exists(
$path, self::$extensionInfo ) ) {
2288 $this->mModuleSource = self::$extensionInfo[
$path];
2294 }
while (
$path !== $oldpath );
2297 $this->mModuleSource =
null;
2468 public function dieUsage( $description, $errorCode, $httpRespCode = 0, $extradata =
null ) {
2470 new RawMessage(
'$1', [ $description ] ),
2489 throw new MWException(
'Successful status passed to ApiBase::dieStatus' );
2492 $errors =
$status->getErrorsByType(
'error' );
2495 $errors =
$status->getErrorsByType(
'warning' );
2499 $errors = [ [
'message' =>
'unknownerror-nocode',
'params' => [] ] ];
2503 $msg = $errors[0][
'message'];
2505 $msg =
new Message( $errors[0][
'message'], $errors[0][
'params'] );
2508 $key = $msg->getKey();
2510 array_unshift(
$params, isset( self::$messageMap[$key] ) ? self::$messageMap[$key] : $key );
2529 'unknownerror' =>
'apierror-unknownerror',
2530 'unknownerror-nocode' =>
'apierror-unknownerror-nocode',
2531 'ns-specialprotected' =>
'ns-specialprotected',
2532 'protectedinterface' =>
'protectedinterface',
2533 'namespaceprotected' =>
'namespaceprotected',
2534 'customcssprotected' =>
'customcssprotected',
2535 'customjsprotected' =>
'customjsprotected',
2536 'cascadeprotected' =>
'cascadeprotected',
2537 'protectedpagetext' =>
'protectedpagetext',
2538 'protect-cantedit' =>
'protect-cantedit',
2539 'deleteprotected' =>
'deleteprotected',
2540 'badaccess-group0' =>
'badaccess-group0',
2541 'badaccess-groups' =>
'badaccess-groups',
2542 'titleprotected' =>
'titleprotected',
2543 'nocreate-loggedin' =>
'nocreate-loggedin',
2544 'nocreatetext' =>
'nocreatetext',
2545 'movenologintext' =>
'movenologintext',
2546 'movenotallowed' =>
'movenotallowed',
2547 'confirmedittext' =>
'confirmedittext',
2548 'blockedtext' =>
'apierror-blocked',
2549 'autoblockedtext' =>
'apierror-autoblocked',
2550 'systemblockedtext' =>
'apierror-systemblocked',
2551 'actionthrottledtext' =>
'apierror-ratelimited',
2552 'alreadyrolled' =>
'alreadyrolled',
2553 'cantrollback' =>
'cantrollback',
2554 'readonlytext' =>
'readonlytext',
2555 'sessionfailure' =>
'sessionfailure',
2556 'cannotdelete' =>
'cannotdelete',
2557 'notanarticle' =>
'apierror-missingtitle',
2558 'selfmove' =>
'selfmove',
2559 'immobile_namespace' =>
'apierror-immobilenamespace',
2560 'articleexists' =>
'articleexists',
2561 'hookaborted' =>
'hookaborted',
2562 'cantmove-titleprotected' =>
'cantmove-titleprotected',
2563 'imagenocrossnamespace' =>
'imagenocrossnamespace',
2564 'imagetypemismatch' =>
'imagetypemismatch',
2565 'ip_range_invalid' =>
'ip_range_invalid',
2566 'range_block_disabled' =>
'range_block_disabled',
2567 'nosuchusershort' =>
'nosuchusershort',
2568 'badipaddress' =>
'badipaddress',
2569 'ipb_expiry_invalid' =>
'ipb_expiry_invalid',
2570 'ipb_already_blocked' =>
'ipb_already_blocked',
2571 'ipb_blocked_as_range' =>
'ipb_blocked_as_range',
2572 'ipb_cant_unblock' =>
'ipb_cant_unblock',
2573 'mailnologin' =>
'apierror-cantsend',
2574 'ipbblocked' =>
'ipbblocked',
2575 'ipbnounblockself' =>
'ipbnounblockself',
2576 'usermaildisabled' =>
'usermaildisabled',
2577 'blockedemailuser' =>
'apierror-blockedfrommail',
2578 'notarget' =>
'apierror-notarget',
2579 'noemail' =>
'noemail',
2580 'rcpatroldisabled' =>
'rcpatroldisabled',
2581 'markedaspatrollederror-noautopatrol' =>
'markedaspatrollederror-noautopatrol',
2582 'delete-toobig' =>
'delete-toobig',
2583 'movenotallowedfile' =>
'movenotallowedfile',
2584 'userrights-no-interwiki' =>
'userrights-no-interwiki',
2585 'userrights-nodatabase' =>
'userrights-nodatabase',
2586 'nouserspecified' =>
'nouserspecified',
2587 'noname' =>
'noname',
2588 'summaryrequired' =>
'apierror-summaryrequired',
2589 'import-rootpage-invalid' =>
'import-rootpage-invalid',
2590 'import-rootpage-nosubpage' =>
'import-rootpage-nosubpage',
2591 'readrequired' =>
'apierror-readapidenied',
2592 'writedisabled' =>
'apierror-noapiwrite',
2593 'writerequired' =>
'apierror-writeapidenied',
2594 'missingparam' =>
'apierror-missingparam',
2595 'invalidtitle' =>
'apierror-invalidtitle',
2596 'nosuchpageid' =>
'apierror-nosuchpageid',
2597 'nosuchrevid' =>
'apierror-nosuchrevid',
2598 'nosuchuser' =>
'nosuchusershort',
2599 'invaliduser' =>
'apierror-invaliduser',
2600 'invalidexpiry' =>
'apierror-invalidexpiry',
2601 'pastexpiry' =>
'apierror-pastexpiry',
2602 'create-titleexists' =>
'apierror-create-titleexists',
2603 'missingtitle-createonly' =>
'apierror-missingtitle-createonly',
2604 'cantblock' =>
'apierror-cantblock',
2605 'canthide' =>
'apierror-canthide',
2606 'cantblock-email' =>
'apierror-cantblock-email',
2607 'cantunblock' =>
'apierror-permissiondenied-generic',
2608 'cannotundelete' =>
'cannotundelete',
2609 'permdenied-undelete' =>
'apierror-permissiondenied-generic',
2610 'createonly-exists' =>
'apierror-articleexists',
2611 'nocreate-missing' =>
'apierror-missingtitle',
2612 'cantchangecontentmodel' =>
'apierror-cantchangecontentmodel',
2613 'nosuchrcid' =>
'apierror-nosuchrcid',
2614 'nosuchlogid' =>
'apierror-nosuchlogid',
2615 'protect-invalidaction' =>
'apierror-protect-invalidaction',
2616 'protect-invalidlevel' =>
'apierror-protect-invalidlevel',
2617 'toofewexpiries' =>
'apierror-toofewexpiries',
2618 'cantimport' =>
'apierror-cantimport',
2619 'cantimport-upload' =>
'apierror-cantimport-upload',
2620 'importnofile' =>
'importnofile',
2621 'importuploaderrorsize' =>
'importuploaderrorsize',
2622 'importuploaderrorpartial' =>
'importuploaderrorpartial',
2623 'importuploaderrortemp' =>
'importuploaderrortemp',
2624 'importcantopen' =>
'importcantopen',
2625 'import-noarticle' =>
'import-noarticle',
2626 'importbadinterwiki' =>
'importbadinterwiki',
2627 'import-unknownerror' =>
'apierror-import-unknownerror',
2628 'cantoverwrite-sharedfile' =>
'apierror-cantoverwrite-sharedfile',
2629 'sharedfile-exists' =>
'apierror-fileexists-sharedrepo-perm',
2630 'mustbeposted' =>
'apierror-mustbeposted',
2631 'show' =>
'apierror-show',
2632 'specialpage-cantexecute' =>
'apierror-specialpage-cantexecute',
2633 'invalidoldimage' =>
'apierror-invalidoldimage',
2634 'nodeleteablefile' =>
'apierror-nodeleteablefile',
2635 'fileexists-forbidden' =>
'fileexists-forbidden',
2636 'fileexists-shared-forbidden' =>
'fileexists-shared-forbidden',
2637 'filerevert-badversion' =>
'filerevert-badversion',
2638 'noimageredirect-anon' =>
'apierror-noimageredirect-anon',
2639 'noimageredirect-logged' =>
'apierror-noimageredirect',
2640 'spamdetected' =>
'apierror-spamdetected',
2641 'contenttoobig' =>
'apierror-contenttoobig',
2642 'noedit-anon' =>
'apierror-noedit-anon',
2643 'noedit' =>
'apierror-noedit',
2644 'wasdeleted' =>
'apierror-pagedeleted',
2645 'blankpage' =>
'apierror-emptypage',
2646 'editconflict' =>
'editconflict',
2647 'hashcheckfailed' =>
'apierror-badmd5',
2648 'missingtext' =>
'apierror-notext',
2649 'emptynewsection' =>
'apierror-emptynewsection',
2650 'revwrongpage' =>
'apierror-revwrongpage',
2651 'undo-failure' =>
'undo-failure',
2652 'content-not-allowed-here' =>
'content-not-allowed-here',
2653 'edit-hook-aborted' =>
'edit-hook-aborted',
2654 'edit-gone-missing' =>
'edit-gone-missing',
2655 'edit-conflict' =>
'edit-conflict',
2656 'edit-already-exists' =>
'edit-already-exists',
2657 'invalid-file-key' =>
'apierror-invalid-file-key',
2658 'nouploadmodule' =>
'apierror-nouploadmodule',
2659 'uploaddisabled' =>
'uploaddisabled',
2660 'copyuploaddisabled' =>
'copyuploaddisabled',
2661 'copyuploadbaddomain' =>
'apierror-copyuploadbaddomain',
2662 'copyuploadbadurl' =>
'apierror-copyuploadbadurl',
2663 'filename-tooshort' =>
'filename-tooshort',
2664 'filename-toolong' =>
'filename-toolong',
2665 'illegal-filename' =>
'illegal-filename',
2666 'filetype-missing' =>
'filetype-missing',
2667 'mustbeloggedin' =>
'apierror-mustbeloggedin',
2676 $msg = Message::newFromSpecifier( $error );
2678 $key = $msg->getKey();
2679 if ( isset( self::$messageMap[$key] ) ) {
2681 array_unshift(
$params, self::$messageMap[$key] );
2701 if ( is_array( $error ) ) {
2702 $first = reset( $error );
2703 if ( is_array( $first ) ) {
2711 'code' => $msg->getApiCode(),
2713 $msg->inLanguage(
'en' )->useDatabase(
false )->text()
2715 'data' => $msg->getApiData()
dieUsageMsgOrDebug( $error)
Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
This is the main API class, used for both external and internal processing.
getConfig()
Get the Config object.
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Exception used to abort API execution with an error.
getContext()
Get the base IContextSource object.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getParent()
Get the parent of this module.
error also a ContextSource you ll probably need to make sure the header is varied on $request
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
getType()
Get the type of target for this particular block.
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
getFinalParams( $flags=0)
Get final list of parameters, after hooks have had a chance to tweak it as needed.
const PARAM_REQUIRED
(boolean) Is the parameter required?
msg()
Get a Message object with context set Parameters are the same as wfMessage()
parseMsg( $error)
Return the error message related to a certain array.
parameterNotEmpty( $x)
Callback function used in requireOnlyOneParameter to check whether required parameters are set.
array null bool $mModuleSource
validateToken( $token, array $params)
Validate the supplied token.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
getExamplesMessages()
Returns usage examples for this module.
const PARAM_ALL
(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true,...
validateTimestamp( $value, $encParamName)
Validate and normalize of parameters of type 'timestamp'.
dieUsageMsg( $error)
Output the error message related to a certain array.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static array $extensionInfo
Maps extension paths to info arrays.
getTitleOrPageId( $params, $load=false)
Get a WikiPage object from a title or pageid param, if possible.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
getDescriptionMessage()
Return the description message.
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 as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
__construct(ApiMain $mainModule, $moduleName, $modulePrefix='')
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
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
mustBePosted()
Indicates whether this module must be called with a POST request.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
logFeatureUsage( $feature)
Write logging information for API features to a debug log, for usage analysis.
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
shouldCheckMaxlag()
Indicates if this module needs maxlag to be checked.
dieWithErrorOrDebug( $msg, $code=null, $data=null, $httpCode=null)
Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static escapeWikiText( $v)
A subset of wfEscapeWikiText for BC texts.
getDB()
Gets a default replica DB connection object.
static makeMessage( $msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
addMessagesFromStatus(StatusValue $status, $types=[ 'warning', 'error'])
Add warnings and/or errors from a Status.
Allows to change the fields on the form that will be generated $name
getRequest()
Get the WebRequest object.
dynamicParameterDocumentation()
Indicate if the module supports dynamically-determined parameters that cannot be included in self::ge...
modifyHelp(array &$help, array $options, array &$tocData)
Called from ApiHelp before the pieces are joined together and returned.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
const PARAM_ALLOW_DUPLICATES
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
getUser()
Get the User object.
Interface for messages with machine-readable data for use by the API.
getModuleProfileName( $db=false)
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
static newWithMessage(ApiBase $module=null, $msg, $code=null, $data=null, $httpCode=0)
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
getWebUITokenSalt(array $params)
Fetch the salt used in the Web UI corresponding to this module.
isMain()
Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.
isReadMode()
Indicates whether this module requires read rights.
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
This abstract class implements many basic API functions, and is the base of all API classes.
Extension of RawMessage implementing IApiMessage.
getModuleFromPath( $path)
Get a module from its module path.
getFinalParamDescription()
Get final parameter descriptions, after hooks have had a chance to tweak it as needed.
Extension of Message implementing IApiMessage.
const PARAM_SENSITIVE
(null|boolean|integer|string) Default value of the parameter.
dieBlocked(Block $block)
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die wit...
parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues, $allSpecifier=null)
Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them a...
getParamDescription()
Returns an array of parameter descriptions.
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
explodeMultiValue( $value, $limit)
Split a multi-valued parameter string, like explode()
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
namespace and then decline to actually register it file or subcat img or subcat $title
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
warnOrDie(ApiMessage $msg, $enforceLimits=false)
Adds a warning to the output, else dies.
getCustomPrinter()
If the module may only be used with a certain format module, it should override this method to return...
getFinalDescription()
Get final module description, after hooks have had a chance to tweak it as needed.
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
getModulePath()
Get the path to this module.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
const LIMIT_BIG1
Fast query, standard limit.
getDescription()
Returns the description string for this module.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
static getTokenTypeSalts()
Get the salts for known token types.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
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 as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers please use GetContentModels hook to make them known to core if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
dieWithException( $exception, array $options=[])
Abort execution with an error derived from an exception.
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
parseMsgInternal( $error)
handleParamNormalization( $paramName, $value, $rawValue)
Handle when a parameter was Unicode-normalized.
when a variable name is used in a it is silently declared as a new masking the global
isDeprecated()
Indicates whether this module is deprecated.
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
const PARAM_EXTRA_NAMESPACES
(int[]) When PARAM_TYPE is 'namespace', include these as additional possible values.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
setContext(IContextSource $context)
Set the IContextSource object.
getHelpUrls()
Return links to more detailed help pages about the module.
validateUser( $value, $encParamName)
Validate and normalize of parameters of type 'user'.
getWatchlistValue( $watchlist, $titleObj, $userOption=null)
Return true if we're to watch the page, false if not, null if no change.
needsToken()
Returns the token type this module requires in order to execute.
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
setWatch( $watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
getContinuationManager()
Get the continuation manager.
addError( $msg, $code=null, $data=null)
Add an error for this module without aborting.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
addDeprecation( $msg, $feature, $data=[])
Add a deprecation warning for this module.
static newGood( $value=null)
Factory function for good results.
const LIMIT_SML2
Slow query, apihighlimits limit.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die wit...
dieReadOnly()
Helper function for readonly errors.
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
checkTitleUserPermissions(Title $title, $actions, $user=null)
Helper function for permission-denied errors.
static newFromID( $id, $from='fromdb')
Constructor from a page id.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getConditionalRequestData( $condition)
Returns data for HTTP conditional request mechanisms.
isWriteMode()
Indicates whether this module requires write mode.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
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
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
static truncateArray(&$arr, $limit)
Truncate an array to a certain length.
Interface for objects which can provide a MediaWiki context on request.
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
const PARAM_RANGE_ENFORCE
(boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX?
const PARAM_VALUE_LINKS
(string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles whic...
requireAtLeastOneParameter( $params, $required)
Die if none of a certain set of parameters is set and not false.
Represents a title within MediaWiki.
setContinuationManager( $manager)
Set the continuation manager.
const LIMIT_BIG2
Fast query, apihighlimits limit.
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
static getToken(User $user, MediaWiki\Session\Session $session, $salt)
Get a token from a salt.
getModuleManager()
Get the module manager, or null if this module has no sub-modules.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
isInternal()
Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party...
getModuleSourceInfo()
Returns information about the source of this module, if known.
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
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
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status 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.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getMain()
Get the main module.
getParameterFromSettings( $paramName, $paramSettings, $parseLimit)
Using the settings determine the value for the given parameter.
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 "<
getTitleFromTitleOrPageId( $params)
Get a Title object from a title or pageid param, if possible.
getExamples()
Returns usage examples for this module.
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
const PARAM_SUBMODULE_PARAM_PREFIX
(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBa...
Message subclass that prepends wikitext for API help.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
getErrorFormatter()
Get the error formatter.
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 as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
requirePostedParameters( $params, $prefix='prefix')
Die if any of the specified parameters were found in the query part of the URL rather than the post b...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
static getBlockInfo(Block $block)
Get basic info about a given block.
getErrorFromStatus( $status, &$extraData=null)
Get error (as code, string) from a Status object.
const LIMIT_SML1
Slow query, standard limit.
the array() calling protocol came about after MediaWiki 1.4rc1.
getHelpFlags()
Generates the list of flags for the help screen and for action=paraminfo.