Go to the documentation of this file.
100 public function __construct( $mainModule, $moduleName, $modulePrefix =
'' ) {
101 $this->mMainModule = $mainModule;
102 $this->mModuleName = $moduleName;
103 $this->mModulePrefix = $modulePrefix;
106 $this->
setContext( $mainModule->getContext() );
130 abstract public function execute();
179 return 'API:' . $this->mModuleName .
'-DB';
198 public function isMain() {
213 return $this->
getMain()->getResult();
250 if ( isset( $data[
'warnings'][$moduleName] ) ) {
252 $oldWarning = $data[
'warnings'][$moduleName][
'*'];
253 $warnPos = strpos( $oldWarning, $warning );
255 if ( $warnPos !==
false && ( $warnPos === 0 || $oldWarning[$warnPos - 1] ===
"\n" ) ) {
257 $warnPos += strlen( $warning );
258 if ( strlen( $oldWarning ) <= $warnPos || $oldWarning[$warnPos] ===
"\n" ) {
263 $warning =
"$oldWarning\n$warning";
268 $result->addValue(
'warnings', $moduleName,
288 static $lnPrfx =
"\n ";
292 if ( $msg !==
false ) {
294 if ( !is_array( $msg ) ) {
299 $msg = $lnPrfx . implode( $lnPrfx, $msg ) .
"\n";
304 $msg .=
"\nThis module requires read rights";
307 $msg .=
"\nThis module requires write rights";
310 $msg .=
"\nThis module only accepts POST requests";
320 if ( $paramsMsg !==
false ) {
321 $msg .=
"Parameters:\n$paramsMsg";
326 if ( !is_array( $examples ) ) {
331 $msg .=
"Example" . ( count( $examples ) > 1 ?
's' :
'' ) .
":\n";
332 foreach ( $examples
as $k => $v ) {
333 if ( is_numeric( $k ) ) {
336 if ( is_array( $v ) ) {
337 $msgExample = implode(
"\n", array_map(
array( $this,
'indentExampleText' ), $v ) );
342 $msg .= wordwrap( $msgExample, 100,
"\n" ) .
"\n $k\n";
366 if ( $input ===
false ) {
369 if ( !is_array( $input ) ) {
370 $input =
array( $input );
373 if ( count( $input ) > 0 ) {
375 $msg =
$title . ( count( $input ) > 1 ?
's' :
'' ) .
":\n ";
379 $msg .= implode( $prefix, $input ) .
"\n";
398 $paramPrefix =
"\n" . str_repeat(
' ', 24 );
399 $descWordwrap =
"\n" . str_repeat(
' ', 28 );
400 foreach (
$params as $paramName => $paramSettings ) {
401 $desc = isset( $paramsDescription[$paramName] ) ? $paramsDescription[$paramName] :
'';
402 if ( is_array( $desc ) ) {
403 $desc = implode( $paramPrefix, $desc );
407 if ( !is_array( $paramSettings ) ) {
408 $paramSettings =
array(
409 self::PARAM_DFLT => $paramSettings,
418 if ( is_bool( $dflt ) ) {
420 } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
422 } elseif ( is_int( $dflt ) ) {
427 if ( isset( $paramSettings[self::PARAM_DEPRECATED] )
428 && $paramSettings[self::PARAM_DEPRECATED]
430 $desc =
"DEPRECATED! $desc";
433 if ( isset( $paramSettings[self::PARAM_REQUIRED] )
434 && $paramSettings[self::PARAM_REQUIRED]
436 $desc .= $paramPrefix .
"This parameter is required";
439 $type = isset( $paramSettings[self::PARAM_TYPE] )
442 if ( isset(
$type ) ) {
443 $hintPipeSeparated =
true;
444 $multi = isset( $paramSettings[self::PARAM_ISMULTI] )
448 $prompt =
'Values (separate with \'|\'): ';
450 $prompt =
'One value: ';
453 if ( is_array(
$type ) ) {
458 $nothingPrompt =
'Can be empty, or ';
463 $desc .= $paramPrefix . $nothingPrompt . $prompt;
464 $choicesstring = implode(
', ', $choices );
465 $desc .= wordwrap( $choicesstring, 100, $descWordwrap );
466 $hintPipeSeparated =
false;
472 $desc .= $paramPrefix . $prompt;
474 100, $descWordwrap );
475 $hintPipeSeparated =
false;
478 $desc .= $paramPrefix .
"No more than {$paramSettings[self::PARAM_MAX]}";
479 if ( isset( $paramSettings[self::PARAM_MAX2] ) ) {
480 $desc .=
" ({$paramSettings[self::PARAM_MAX2]} for bots)";
485 $s = $multi ?
's' :
'';
486 $hasMin = isset( $paramSettings[self::PARAM_MIN] );
487 $hasMax = isset( $paramSettings[self::PARAM_MAX] );
488 if ( $hasMin || $hasMax ) {
490 $intRangeStr =
"The value$s must be no less than " .
491 "{$paramSettings[self::PARAM_MIN]}";
492 } elseif ( !$hasMin ) {
493 $intRangeStr =
"The value$s must be no more than " .
494 "{$paramSettings[self::PARAM_MAX]}";
496 $intRangeStr =
"The value$s must be between " .
497 "{$paramSettings[self::PARAM_MIN]} and {$paramSettings[self::PARAM_MAX]}";
500 $desc .= $paramPrefix . $intRangeStr;
504 $desc .= $paramPrefix .
"Must be posted as a file upload using multipart/form-data";
510 if ( $hintPipeSeparated ) {
511 $desc .= $paramPrefix .
"Separate values with '|'";
514 $isArray = is_array(
$type );
516 || $isArray && count(
$type ) > self::LIMIT_SML1
518 $desc .= $paramPrefix .
"Maximum number of values " .
519 self::LIMIT_SML1 .
" (" . self::LIMIT_SML2 .
" for bots)";
524 $default = isset( $paramSettings[self::PARAM_DFLT] ) ? $paramSettings[
self::PARAM_DFLT] :
null;
525 if ( !is_null( $default ) && $default !==
false ) {
526 $desc .= $paramPrefix .
"Default: $default";
529 $msg .= sprintf(
" %-19s - %s\n", $this->
encodeParamName( $paramName ), $desc );
648 foreach ( array_keys( $tokenFunctions )
as $token ) {
649 $props[
''][$token .
'token'] =
array(
676 return $this->mModulePrefix . $paramName;
690 if ( !isset( $this->mParamCache[$parseLimit] ) ) {
695 foreach (
$params as $paramName => $paramSettings ) {
697 $paramName, $paramSettings, $parseLimit );
700 $this->mParamCache[$parseLimit] = $results;
703 return $this->mParamCache[$parseLimit];
712 protected function getParameter( $paramName, $parseLimit =
true ) {
714 $paramSettings =
$params[$paramName];
724 $required = func_get_args();
725 array_shift( $required );
728 $intersection = array_intersect( array_keys( array_filter(
$params,
729 array( $this,
"parameterNotEmpty" ) ) ), $required );
731 if ( count( $intersection ) > 1 ) {
733 "The parameters {$p}" . implode(
", {$p}", $intersection ) .
' can not be used together',
735 } elseif ( count( $intersection ) == 0 ) {
737 "One of the parameters {$p}" . implode(
", {$p}", $required ) .
' is required',
755 'code' =>
"{$p}missingparam",
756 'info' =>
"One of the parameters {$p}{$params} is required"
759 'code' =>
"{$p}invalidparammix",
760 'info' =>
"The parameters {$p}{$params} can not be used together"
771 $required = func_get_args();
772 array_shift( $required );
775 $intersection = array_intersect( array_keys( array_filter(
$params,
776 array( $this,
"parameterNotEmpty" ) ) ), $required );
778 if ( count( $intersection ) > 1 ) {
780 "The parameters {$p}" . implode(
", {$p}", $intersection ) .
' can not be used together',
798 'code' =>
"{$p}invalidparammix",
799 'info' =>
"The parameters {$p}{$params} can not be used together"
812 $required = func_get_args();
813 array_shift( $required );
816 $intersection = array_intersect(
817 array_keys( array_filter(
$params,
array( $this,
"parameterNotEmpty" ) ) ),
821 if ( count( $intersection ) == 0 ) {
822 $this->
dieUsage(
"At least one of the parameters {$p}" .
823 implode(
", {$p}", $required ) .
' is required',
"{$p}missingparam" );
840 'code' =>
"{$p}missingparam",
841 'info' =>
"At least one of the parameters {$p}{$params} is required",
858 if ( isset(
$params[
'title'] ) ) {
860 if ( !$titleObj || $titleObj->isExternal() ) {
863 if ( !$titleObj->canExist() ) {
864 $this->
dieUsage(
"Namespace doesn't allow actual pages",
'pagecannotexist' );
867 if ( $load !==
false ) {
868 $pageObj->loadPageData( $load );
870 } elseif ( isset(
$params[
'pageid'] ) ) {
871 if ( $load ===
false ) {
890 array(
'invalidtitle',
'title' ),
891 array(
'nosuchpageid',
'pageid' ),
903 return !is_null( $x ) && $x !==
false;
914 protected function getWatchlistValue( $watchlist, $titleObj, $userOption =
null ) {
918 switch ( $watchlist ) {
926 # If the user is already watching, don't bother checking
927 if ( $userWatching ) {
930 # If no user option was passed, use watchdefault and watchcreations
931 if ( is_null( $userOption ) ) {
932 return $this->
getUser()->getBoolOption(
'watchdefault' ) ||
933 $this->
getUser()->getBoolOption(
'watchcreations' ) && !$titleObj->exists();
936 # Watch the article based on the user preference
937 return $this->
getUser()->getBoolOption( $userOption );
940 return $userWatching;
943 return $userWatching;
953 protected function setWatch( $watch, $titleObj, $userOption =
null ) {
975 if ( !is_array( $paramSettings ) ) {
976 $default = $paramSettings;
978 $type = gettype( $paramSettings );
983 $default = isset( $paramSettings[self::PARAM_DFLT] )
986 $multi = isset( $paramSettings[self::PARAM_ISMULTI] )
989 $type = isset( $paramSettings[self::PARAM_TYPE] )
992 $dupes = isset( $paramSettings[self::PARAM_ALLOW_DUPLICATES] )
995 $deprecated = isset( $paramSettings[self::PARAM_DEPRECATED] )
998 $required = isset( $paramSettings[self::PARAM_REQUIRED] )
1003 if ( !isset(
$type ) ) {
1004 if ( isset( $default ) ) {
1005 $type = gettype( $default );
1012 if (
$type ==
'boolean' ) {
1013 if ( isset( $default ) && $default !==
false ) {
1017 "Boolean param $encParamName's default is set to '$default'. " .
1018 "Boolean parameters must default to false."
1023 } elseif (
$type ==
'upload' ) {
1024 if ( isset( $default ) ) {
1028 "File upload param $encParamName's default is set to " .
1029 "'$default'. File upload parameters may not have a default." );
1032 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1035 if ( !
$value->exists() ) {
1039 $value = $this->
getMain()->getRequest()->unsetVal( $encParamName );
1042 "File upload param $encParamName is not a file upload; " .
1043 "be sure to use multipart/form-data for your POST and include " .
1044 "a filename in the Content-Disposition header.",
1045 "badupload_{$encParamName}"
1050 $value = $this->
getMain()->getVal( $encParamName, $default );
1057 if ( isset(
$value ) && ( $multi || is_array(
$type ) ) ) {
1069 if ( !is_array(
$type ) ) {
1074 if ( $required &&
$value ===
'' ) {
1079 $min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[
self::PARAM_MIN] :
null;
1080 $max = isset( $paramSettings[self::PARAM_MAX] ) ? $paramSettings[
self::PARAM_MAX] :
null;
1081 $enforceLimits = isset( $paramSettings[self::PARAM_RANGE_ENFORCE] )
1084 if ( is_array(
$value ) ) {
1086 if ( !is_null( $min ) || !is_null( $max ) ) {
1088 $this->
validateLimit( $paramName, $v, $min, $max,
null, $enforceLimits );
1093 if ( !is_null( $min ) || !is_null( $max ) ) {
1099 if ( !$parseLimit ) {
1103 if ( !isset( $paramSettings[self::PARAM_MAX] )
1104 || !isset( $paramSettings[self::PARAM_MAX2] )
1108 "MAX1 or MAX2 are not defined for the limit $encParamName"
1112 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1114 $min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[
self::PARAM_MIN] : 0;
1126 $paramSettings[self::PARAM_MAX],
1127 $paramSettings[self::PARAM_MAX2]
1133 ApiBase::dieDebug( __METHOD__,
"Multi-values not supported for $encParamName" );
1137 if ( is_array(
$value ) ) {
1138 foreach (
$value as $key => $val ) {
1146 if ( is_array(
$value ) ) {
1147 foreach (
$value as $key => $val ) {
1157 ApiBase::dieDebug( __METHOD__,
"Param $encParamName's type is unknown - $type" );
1162 if ( !$dupes && is_array(
$value ) ) {
1167 if ( $deprecated &&
$value !==
false ) {
1168 $this->
setWarning(
"The $encParamName parameter has been deprecated." );
1170 } elseif ( $required ) {
1191 if ( trim(
$value ) ===
'' && $allowMultiple ) {
1197 $valuesList = explode(
'|',
$value, self::LIMIT_SML2 + 1 );
1198 $sizeLimit = count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits()
1202 if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
1203 $this->
setWarning(
"Too many values supplied for parameter '$valueName': " .
1204 "the limit is $sizeLimit" );
1207 if ( !$allowMultiple && count( $valuesList ) != 1 ) {
1209 if ( in_array(
$value, $allowedValues,
true ) ) {
1213 $possibleValues = is_array( $allowedValues )
1214 ?
"of '" . implode(
"', '", $allowedValues ) .
"'"
1217 "Only one $possibleValues is allowed for parameter '$valueName'",
1218 "multival_$valueName"
1222 if ( is_array( $allowedValues ) ) {
1224 $unknown = array_diff( $valuesList, $allowedValues );
1225 if ( count( $unknown ) ) {
1226 if ( $allowMultiple ) {
1227 $s = count( $unknown ) > 1 ?
's' :
'';
1228 $vals = implode(
", ", $unknown );
1229 $this->
setWarning(
"Unrecognized value$s for parameter '$valueName': $vals" );
1232 "Unrecognized value for parameter '$valueName': {$valuesList[0]}",
1233 "unknown_$valueName"
1238 $valuesList = array_intersect( $valuesList, $allowedValues );
1241 return $allowMultiple ? $valuesList : $valuesList[0];
1254 function validateLimit( $paramName, &
$value, $min, $max, $botMax =
null, $enforceLimits =
false ) {
1255 if ( !is_null( $min ) &&
$value < $min ) {
1257 $msg = $this->
encodeParamName( $paramName ) .
" may not be less than $min (set to $value)";
1258 $this->
warnOrDie( $msg, $enforceLimits );
1264 if ( $this->
getMain()->isInternalMode() ) {
1270 if ( !is_null( $max ) &&
$value > $max ) {
1271 if ( !is_null( $botMax ) && $this->
getMain()->canApiHighLimits() ) {
1272 if (
$value > $botMax ) {
1274 " may not be over $botMax (set to $value) for bots or sysops";
1275 $this->
warnOrDie( $msg, $enforceLimits );
1279 $msg = $this->
encodeParamName( $paramName ) .
" may not be over $max (set to $value) for users";
1280 $this->
warnOrDie( $msg, $enforceLimits );
1294 if ( $unixTimestamp ===
false ) {
1296 "Invalid value '$value' for timestamp parameter $encParamName",
1297 "badtimestamp_{$encParamName}"
1314 "Invalid value '$value' for user parameter $encParamName",
1315 "baduser_{$encParamName}"
1319 return $title->getText();
1328 private function warnOrDie( $msg, $enforceLimits =
false ) {
1329 if ( $enforceLimits ) {
1330 $this->
dieUsage( $msg,
'integeroutofrange' );
1344 while ( count( $arr ) >
$limit ) {
1364 public function dieUsage( $description, $errorCode, $httpRespCode = 0, $extradata =
null ) {
1382 if ( $status->isGood() ) {
1383 throw new MWException(
'Successful status passed to ApiBase::dieStatus' );
1386 $errors = $status->getErrorsArray();
1389 $errors = $status->getWarningsArray();
1393 $errors =
array(
array(
'unknownerror-nocode' ) );
1398 if ( $errors[0] instanceof Message ) {
1400 $code = $msg->getKey();
1402 $code = array_shift( $errors[0] );
1410 return array( $code, $msg->inLanguage(
'en' )->useDatabase(
false )->plain() );
1432 'unknownerror' =>
array(
'code' =>
'unknownerror',
'info' =>
"Unknown error: \"\$1\"" ),
1433 'unknownerror-nocode' =>
array(
'code' =>
'unknownerror',
'info' =>
'Unknown error' ),
1436 'ns-specialprotected' =>
array(
1437 'code' =>
'unsupportednamespace',
1438 'info' =>
"Pages in the Special namespace can't be edited"
1440 'protectedinterface' =>
array(
1441 'code' =>
'protectednamespace-interface',
1442 'info' =>
"You're not allowed to edit interface messages"
1444 'namespaceprotected' =>
array(
1445 'code' =>
'protectednamespace',
1446 'info' =>
"You're not allowed to edit pages in the \"\$1\" namespace"
1448 'customcssprotected' =>
array(
1449 'code' =>
'customcssprotected',
1450 'info' =>
"You're not allowed to edit custom CSS pages"
1452 'customjsprotected' =>
array(
1453 'code' =>
'customjsprotected',
1454 'info' =>
"You're not allowed to edit custom JavaScript pages"
1456 'cascadeprotected' =>
array(
1457 'code' =>
'cascadeprotected',
1458 'info' =>
"The page you're trying to edit is protected because it's included in a cascade-protected page"
1460 'protectedpagetext' =>
array(
1461 'code' =>
'protectedpage',
1462 'info' =>
"The \"\$1\" right is required to edit this page"
1464 'protect-cantedit' =>
array(
1465 'code' =>
'cantedit',
1466 'info' =>
"You can't protect this page because you can't edit it"
1468 'badaccess-group0' =>
array(
1469 'code' =>
'permissiondenied',
1470 'info' =>
"Permission denied"
1472 'badaccess-groups' =>
array(
1473 'code' =>
'permissiondenied',
1474 'info' =>
"Permission denied"
1476 'titleprotected' =>
array(
1477 'code' =>
'protectedtitle',
1478 'info' =>
"This title has been protected from creation"
1480 'nocreate-loggedin' =>
array(
1481 'code' =>
'cantcreate',
1482 'info' =>
"You don't have permission to create new pages"
1484 'nocreatetext' =>
array(
1485 'code' =>
'cantcreate-anon',
1486 'info' =>
"Anonymous users can't create new pages"
1488 'movenologintext' =>
array(
1489 'code' =>
'cantmove-anon',
1490 'info' =>
"Anonymous users can't move pages"
1492 'movenotallowed' =>
array(
1493 'code' =>
'cantmove',
1494 'info' =>
"You don't have permission to move pages"
1496 'confirmedittext' =>
array(
1497 'code' =>
'confirmemail',
1498 'info' =>
"You must confirm your email address before you can edit"
1500 'blockedtext' =>
array(
1501 'code' =>
'blocked',
1502 'info' =>
"You have been blocked from editing"
1504 'autoblockedtext' =>
array(
1505 'code' =>
'autoblocked',
1506 'info' =>
"Your IP address has been blocked automatically, because it was used by a blocked user"
1510 'actionthrottledtext' =>
array(
1511 'code' =>
'ratelimited',
1512 'info' =>
"You've exceeded your rate limit. Please wait some time and try again"
1514 'alreadyrolled' =>
array(
1515 'code' =>
'alreadyrolled',
1516 'info' =>
"The page you tried to rollback was already rolled back"
1518 'cantrollback' =>
array(
1519 'code' =>
'onlyauthor',
1520 'info' =>
"The page you tried to rollback only has one author"
1522 'readonlytext' =>
array(
1523 'code' =>
'readonly',
1524 'info' =>
"The wiki is currently in read-only mode"
1526 'sessionfailure' =>
array(
1527 'code' =>
'badtoken',
1528 'info' =>
"Invalid token" ),
1529 'cannotdelete' =>
array(
1530 'code' =>
'cantdelete',
1531 'info' =>
"Couldn't delete \"\$1\". Maybe it was deleted already by someone else"
1533 'notanarticle' =>
array(
1534 'code' =>
'missingtitle',
1535 'info' =>
"The page you requested doesn't exist"
1537 'selfmove' =>
array(
'code' =>
'selfmove',
'info' =>
"Can't move a page to itself"
1539 'immobile_namespace' =>
array(
1540 'code' =>
'immobilenamespace',
1541 'info' =>
"You tried to move pages from or to a namespace that is protected from moving"
1543 'articleexists' =>
array(
1544 'code' =>
'articleexists',
1545 'info' =>
"The destination article already exists and is not a redirect to the source article"
1547 'protectedpage' =>
array(
1548 'code' =>
'protectedpage',
1549 'info' =>
"You don't have permission to perform this move"
1551 'hookaborted' =>
array(
1552 'code' =>
'hookaborted',
1553 'info' =>
"The modification you tried to make was aborted by an extension hook"
1555 'cantmove-titleprotected' =>
array(
1556 'code' =>
'protectedtitle',
1557 'info' =>
"The destination article has been protected from creation"
1559 'imagenocrossnamespace' =>
array(
1560 'code' =>
'nonfilenamespace',
1561 'info' =>
"Can't move a file to a non-file namespace"
1563 'imagetypemismatch' =>
array(
1564 'code' =>
'filetypemismatch',
1565 'info' =>
"The new file extension doesn't match its type"
1569 'ip_range_invalid' =>
array(
'code' =>
'invalidrange',
'info' =>
"Invalid IP range" ),
1570 'range_block_disabled' =>
array(
1571 'code' =>
'rangedisabled',
1572 'info' =>
"Blocking IP ranges has been disabled"
1574 'nosuchusershort' =>
array(
1575 'code' =>
'nosuchuser',
1576 'info' =>
"The user you specified doesn't exist"
1578 'badipaddress' =>
array(
'code' =>
'invalidip',
'info' =>
"Invalid IP address specified" ),
1579 'ipb_expiry_invalid' =>
array(
'code' =>
'invalidexpiry',
'info' =>
"Invalid expiry time" ),
1580 'ipb_already_blocked' =>
array(
1581 'code' =>
'alreadyblocked',
1582 'info' =>
"The user you tried to block was already blocked"
1584 'ipb_blocked_as_range' =>
array(
1585 'code' =>
'blockedasrange',
1586 'info' =>
"IP address \"\$1\" was blocked as part of range \"\$2\". You can't unblock the IP individually, but you can unblock the range as a whole."
1588 'ipb_cant_unblock' =>
array(
1589 'code' =>
'cantunblock',
1590 'info' =>
"The block you specified was not found. It may have been unblocked already"
1592 'mailnologin' =>
array(
1593 'code' =>
'cantsend',
1594 'info' =>
"You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email"
1596 'ipbblocked' =>
array(
1597 'code' =>
'ipbblocked',
1598 'info' =>
'You cannot block or unblock users while you are yourself blocked'
1600 'ipbnounblockself' =>
array(
1601 'code' =>
'ipbnounblockself',
1602 'info' =>
'You are not allowed to unblock yourself'
1604 'usermaildisabled' =>
array(
1605 'code' =>
'usermaildisabled',
1606 'info' =>
"User email has been disabled"
1608 'blockedemailuser' =>
array(
1609 'code' =>
'blockedfrommail',
1610 'info' =>
"You have been blocked from sending email"
1612 'notarget' =>
array(
1613 'code' =>
'notarget',
1614 'info' =>
"You have not specified a valid target for this action"
1617 'code' =>
'noemail',
1618 'info' =>
"The user has not specified a valid email address, or has chosen not to receive email from other users"
1620 'rcpatroldisabled' =>
array(
1621 'code' =>
'patroldisabled',
1622 'info' =>
"Patrolling is disabled on this wiki"
1624 'markedaspatrollederror-noautopatrol' =>
array(
1625 'code' =>
'noautopatrol',
1626 'info' =>
"You don't have permission to patrol your own changes"
1628 'delete-toobig' =>
array(
1629 'code' =>
'bigdelete',
1630 'info' =>
"You can't delete this page because it has more than \$1 revisions"
1632 'movenotallowedfile' =>
array(
1633 'code' =>
'cantmovefile',
1634 'info' =>
"You don't have permission to move files"
1636 'userrights-no-interwiki' =>
array(
1637 'code' =>
'nointerwikiuserrights',
1638 'info' =>
"You don't have permission to change user rights on other wikis"
1640 'userrights-nodatabase' =>
array(
1641 'code' =>
'nosuchdatabase',
1642 'info' =>
"Database \"\$1\" does not exist or is not local"
1644 'nouserspecified' =>
array(
'code' =>
'invaliduser',
'info' =>
"Invalid username \"\$1\"" ),
1645 'noname' =>
array(
'code' =>
'invaliduser',
'info' =>
"Invalid username \"\$1\"" ),
1646 'summaryrequired' =>
array(
'code' =>
'summaryrequired',
'info' =>
'Summary required' ),
1647 'import-rootpage-invalid' =>
array(
1648 'code' =>
'import-rootpage-invalid',
1649 'info' =>
'Root page is an invalid title'
1651 'import-rootpage-nosubpage' =>
array(
1652 'code' =>
'import-rootpage-nosubpage',
1653 'info' =>
'Namespace "$1" of the root page does not allow subpages'
1657 'readrequired' =>
array(
1658 'code' =>
'readapidenied',
1659 'info' =>
"You need read permission to use this module"
1661 'writedisabled' =>
array(
1662 'code' =>
'noapiwrite',
1663 'info' =>
"Editing of this wiki through the API is disabled. Make sure the \$wgEnableWriteAPI=true; statement is included in the wiki's LocalSettings.php file"
1665 'writerequired' =>
array(
1666 'code' =>
'writeapidenied',
1667 'info' =>
"You're not allowed to edit this wiki through the API"
1669 'missingparam' =>
array(
'code' =>
'no$1',
'info' =>
"The \$1 parameter must be set" ),
1670 'invalidtitle' =>
array(
'code' =>
'invalidtitle',
'info' =>
"Bad title \"\$1\"" ),
1671 'nosuchpageid' =>
array(
'code' =>
'nosuchpageid',
'info' =>
"There is no page with ID \$1" ),
1672 'nosuchrevid' =>
array(
'code' =>
'nosuchrevid',
'info' =>
"There is no revision with ID \$1" ),
1673 'nosuchuser' =>
array(
'code' =>
'nosuchuser',
'info' =>
"User \"\$1\" doesn't exist" ),
1674 'invaliduser' =>
array(
'code' =>
'invaliduser',
'info' =>
"Invalid username \"\$1\"" ),
1675 'invalidexpiry' =>
array(
'code' =>
'invalidexpiry',
'info' =>
"Invalid expiry time \"\$1\"" ),
1676 'pastexpiry' =>
array(
'code' =>
'pastexpiry',
'info' =>
"Expiry time \"\$1\" is in the past" ),
1677 'create-titleexists' =>
array(
1678 'code' =>
'create-titleexists',
1679 'info' =>
"Existing titles can't be protected with 'create'"
1681 'missingtitle-createonly' =>
array(
1682 'code' =>
'missingtitle-createonly',
1683 'info' =>
"Missing titles can only be protected with 'create'"
1685 'cantblock' =>
array(
'code' =>
'cantblock',
1686 'info' =>
"You don't have permission to block users"
1688 'canthide' =>
array(
1689 'code' =>
'canthide',
1690 'info' =>
"You don't have permission to hide user names from the block log"
1692 'cantblock-email' =>
array(
1693 'code' =>
'cantblock-email',
1694 'info' =>
"You don't have permission to block users from sending email through the wiki"
1696 'unblock-notarget' =>
array(
1697 'code' =>
'notarget',
1698 'info' =>
"Either the id or the user parameter must be set"
1700 'unblock-idanduser' =>
array(
1701 'code' =>
'idanduser',
1702 'info' =>
"The id and user parameters can't be used together"
1704 'cantunblock' =>
array(
1705 'code' =>
'permissiondenied',
1706 'info' =>
"You don't have permission to unblock users"
1708 'cannotundelete' =>
array(
1709 'code' =>
'cantundelete',
1710 'info' =>
"Couldn't undelete: the requested revisions may not exist, or may have been undeleted already"
1712 'permdenied-undelete' =>
array(
1713 'code' =>
'permissiondenied',
1714 'info' =>
"You don't have permission to restore deleted revisions"
1716 'createonly-exists' =>
array(
1717 'code' =>
'articleexists',
1718 'info' =>
"The article you tried to create has been created already"
1720 'nocreate-missing' =>
array(
1721 'code' =>
'missingtitle',
1722 'info' =>
"The article you tried to edit doesn't exist"
1724 'nosuchrcid' =>
array(
1725 'code' =>
'nosuchrcid',
1726 'info' =>
"There is no change with rcid \"\$1\""
1728 'protect-invalidaction' =>
array(
1729 'code' =>
'protect-invalidaction',
1730 'info' =>
"Invalid protection type \"\$1\""
1732 'protect-invalidlevel' =>
array(
1733 'code' =>
'protect-invalidlevel',
1734 'info' =>
"Invalid protection level \"\$1\""
1736 'toofewexpiries' =>
array(
1737 'code' =>
'toofewexpiries',
1738 'info' =>
"\$1 expiry timestamps were provided where \$2 were needed"
1740 'cantimport' =>
array(
1741 'code' =>
'cantimport',
1742 'info' =>
"You don't have permission to import pages"
1744 'cantimport-upload' =>
array(
1745 'code' =>
'cantimport-upload',
1746 'info' =>
"You don't have permission to import uploaded pages"
1748 'importnofile' =>
array(
'code' =>
'nofile',
'info' =>
"You didn't upload a file" ),
1749 'importuploaderrorsize' =>
array(
1750 'code' =>
'filetoobig',
1751 'info' =>
'The file you uploaded is bigger than the maximum upload size'
1753 'importuploaderrorpartial' =>
array(
1754 'code' =>
'partialupload',
1755 'info' =>
'The file was only partially uploaded'
1757 'importuploaderrortemp' =>
array(
1758 'code' =>
'notempdir',
1759 'info' =>
'The temporary upload directory is missing'
1761 'importcantopen' =>
array(
1762 'code' =>
'cantopenfile',
1763 'info' =>
"Couldn't open the uploaded file"
1765 'import-noarticle' =>
array(
1766 'code' =>
'badinterwiki',
1767 'info' =>
'Invalid interwiki title specified'
1769 'importbadinterwiki' =>
array(
1770 'code' =>
'badinterwiki',
1771 'info' =>
'Invalid interwiki title specified'
1773 'import-unknownerror' =>
array(
1774 'code' =>
'import-unknownerror',
1775 'info' =>
"Unknown error on import: \"\$1\""
1777 'cantoverwrite-sharedfile' =>
array(
1778 'code' =>
'cantoverwrite-sharedfile',
1779 'info' =>
'The target file exists on a shared repository and you do not have permission to override it'
1781 'sharedfile-exists' =>
array(
1782 'code' =>
'fileexists-sharedrepo-perm',
1783 'info' =>
'The target file exists on a shared repository. Use the ignorewarnings parameter to override it.'
1785 'mustbeposted' =>
array(
1786 'code' =>
'mustbeposted',
1787 'info' =>
"The \$1 module requires a POST request"
1791 'info' =>
'Incorrect parameter - mutually exclusive values may not be supplied'
1793 'specialpage-cantexecute' =>
array(
1794 'code' =>
'specialpage-cantexecute',
1795 'info' =>
"You don't have permission to view the results of this special page"
1797 'invalidoldimage' =>
array(
1798 'code' =>
'invalidoldimage',
1799 'info' =>
'The oldimage parameter has invalid format'
1801 'nodeleteablefile' =>
array(
1802 'code' =>
'nodeleteablefile',
1803 'info' =>
'No such old version of the file'
1805 'fileexists-forbidden' =>
array(
1806 'code' =>
'fileexists-forbidden',
1807 'info' =>
'A file with name "$1" already exists, and cannot be overwritten.'
1809 'fileexists-shared-forbidden' =>
array(
1810 'code' =>
'fileexists-shared-forbidden',
1811 'info' =>
'A file with name "$1" already exists in the shared file repository, and cannot be overwritten.'
1813 'filerevert-badversion' =>
array(
1814 'code' =>
'filerevert-badversion',
1815 'info' =>
'There is no previous local version of this file with the provided timestamp.'
1819 'noimageredirect-anon' =>
array(
1820 'code' =>
'noimageredirect-anon',
1821 'info' =>
"Anonymous users can't create image redirects"
1823 'noimageredirect-logged' =>
array(
1824 'code' =>
'noimageredirect',
1825 'info' =>
"You don't have permission to create image redirects"
1827 'spamdetected' =>
array(
1828 'code' =>
'spamdetected',
1829 'info' =>
"Your edit was refused because it contained a spam fragment: \"\$1\""
1831 'contenttoobig' =>
array(
1832 'code' =>
'contenttoobig',
1833 'info' =>
"The content you supplied exceeds the article size limit of \$1 kilobytes"
1835 'noedit-anon' =>
array(
'code' =>
'noedit-anon',
'info' =>
"Anonymous users can't edit pages" ),
1836 'noedit' =>
array(
'code' =>
'noedit',
'info' =>
"You don't have permission to edit pages" ),
1837 'wasdeleted' =>
array(
1838 'code' =>
'pagedeleted',
1839 'info' =>
"The page has been deleted since you fetched its timestamp"
1841 'blankpage' =>
array(
1842 'code' =>
'emptypage',
1843 'info' =>
"Creating new, empty pages is not allowed"
1845 'editconflict' =>
array(
'code' =>
'editconflict',
'info' =>
"Edit conflict detected" ),
1846 'hashcheckfailed' =>
array(
'code' =>
'badmd5',
'info' =>
"The supplied MD5 hash was incorrect" ),
1847 'missingtext' =>
array(
1849 'info' =>
"One of the text, appendtext, prependtext and undo parameters must be set"
1851 'emptynewsection' =>
array(
1852 'code' =>
'emptynewsection',
1853 'info' =>
'Creating empty new sections is not possible.'
1855 'revwrongpage' =>
array(
1856 'code' =>
'revwrongpage',
1857 'info' =>
"r\$1 is not a revision of \"\$2\""
1859 'undo-failure' =>
array(
1860 'code' =>
'undofailure',
1861 'info' =>
'Undo failed due to conflicting intermediate edits'
1865 'edit-hook-aborted' =>
array(
1866 'code' =>
'edit-hook-aborted',
1867 'info' =>
"Your edit was aborted by an ArticleSave hook"
1869 'edit-gone-missing' =>
array(
1870 'code' =>
'edit-gone-missing',
1871 'info' =>
"The page you tried to edit doesn't seem to exist anymore"
1873 'edit-conflict' =>
array(
'code' =>
'editconflict',
'info' =>
"Edit conflict detected" ),
1874 'edit-already-exists' =>
array(
1875 'code' =>
'edit-already-exists',
1876 'info' =>
'It seems the page you tried to create already exist'
1880 'invalid-file-key' =>
array(
'code' =>
'invalid-file-key',
'info' =>
'Not a valid file key' ),
1881 'nouploadmodule' =>
array(
'code' =>
'nouploadmodule',
'info' =>
'No upload module set' ),
1882 'uploaddisabled' =>
array(
1883 'code' =>
'uploaddisabled',
1884 'info' =>
'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true'
1886 'copyuploaddisabled' =>
array(
1887 'code' =>
'copyuploaddisabled',
1888 'info' =>
'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.'
1890 'copyuploadbaddomain' =>
array(
1891 'code' =>
'copyuploadbaddomain',
1892 'info' =>
'Uploads by URL are not allowed from this domain.'
1894 'copyuploadbadurl' =>
array(
1895 'code' =>
'copyuploadbadurl',
1896 'info' =>
'Upload not allowed from this URL.'
1899 'filename-tooshort' =>
array(
1900 'code' =>
'filename-tooshort',
1901 'info' =>
'The filename is too short'
1903 'filename-toolong' =>
array(
'code' =>
'filename-toolong',
'info' =>
'The filename is too long' ),
1904 'illegal-filename' =>
array(
1905 'code' =>
'illegal-filename',
1906 'info' =>
'The filename is not allowed'
1908 'filetype-missing' =>
array(
1909 'code' =>
'filetype-missing',
1910 'info' =>
'The file is missing an extension'
1913 'mustbeloggedin' =>
array(
'code' =>
'mustbeloggedin',
'info' =>
'You must be logged in to $1.' )
1922 $this->
dieUsage( $parsed[
'info'], $parsed[
'code'], 0,
1931 # most of the time we send a 1 element, so we might as well send it as
1932 # a string and make this an array here.
1933 if ( is_string(
$error ) ) {
1937 $this->
dieUsage( $parsed[
'info'], $parsed[
'code'] );
1948 if ( $wgDebugAPI !==
true ) {
1952 if ( is_string(
$error ) ) {
1957 $this->
setWarning(
'$wgDebugAPI: ' . $parsed[
'code'] .
' - ' . $parsed[
'info'] );
1969 'Invalid continue param. You should pass the original value returned by the previous query',
1981 $key = array_shift(
$error );
1985 if ( is_array( $key ) ) {
1987 $key = array_shift(
$error );
1990 if ( isset( self::$messageMap[$key] ) ) {
2007 protected static function dieDebug( $method, $message ) {
2008 throw new MWException(
"Internal error in $method: $message" );
2072 if ( !is_null(
$params[
'owner'] ) && !is_null(
$params[
'token'] ) ) {
2075 $this->
dieUsage(
'Specified user does not exist',
'bad_wlowner' );
2077 $token =
$user->getOption(
'watchlisttoken' );
2078 if ( $token ==
'' || $token !=
$params[
'token'] ) {
2080 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences',
2085 if ( !$this->
getUser()->isLoggedIn() ) {
2086 $this->
dieUsage(
'You must be logged-in to have a watchlist',
'notloggedin' );
2088 if ( !$this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
2089 $this->
dieUsage(
'You don\'t have permission to view your watchlist',
'permissiondenied' );
2119 foreach (
$params as $paramName => $paramSettings ) {
2123 $ret[] =
array(
'missingparam', $paramName );
2126 if ( array_key_exists(
'continue',
$params ) ) {
2128 'code' =>
'badcontinue',
2129 'info' =>
'Invalid continue param. You should pass the ' .
2130 'original value returned by the previous query'
2153 $ret[] =
array(
'missingparam',
'token' );
2170 wfRunHooks(
'APIGetPossibleErrors',
array( $this, &$possibleErrors ) );
2172 return $possibleErrors;
2184 foreach ( $errors
as $row ) {
2185 if ( isset( $row[
'code'] ) && isset( $row[
'info'] ) ) {
2204 if ( $this->mTimeIn !== 0 ) {
2207 $this->mTimeIn = microtime(
true );
2215 if ( $this->mTimeIn === 0 ) {
2218 if ( $this->mDBTimeIn !== 0 ) {
2221 'Must be called after database profiling is done with profileDBOut()'
2235 if ( $this->mTimeIn !== 0 ) {
2236 if ( $this->mDBTimeIn !== 0 ) {
2248 if ( $this->mTimeIn !== 0 ) {
2264 if ( $this->mTimeIn === 0 ) {
2267 'Must be called while profiling the entire module with profileIn()'
2270 if ( $this->mDBTimeIn !== 0 ) {
2273 $this->mDBTimeIn = microtime(
true );
2281 if ( $this->mTimeIn === 0 ) {
2283 'the entire module with profileIn()' );
2285 if ( $this->mDBTimeIn === 0 ) {
2290 $this->mDBTimeIn = 0;
2292 $this->mDBTime +=
$time;
2302 if ( $this->mDBTimeIn !== 0 ) {
2313 protected function getDB() {
2314 if ( !isset( $this->mSlaveDB ) ) {
2330 print
"\n\n<pre><b>Debugging value '$name':</b>\n\n";
createContext()
Create a new RequestContext object to use e.g.
dieUsageMsgOrDebug( $error)
Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
makeHelpMsgParameters()
Generates the parameter descriptions for this module, to be displayed in the module's help.
dieStatus( $status)
Throw a UsageException based on the errors in the Status object.
$mDBTimeIn
Profiling: database execution time.
__construct( $mainModule, $moduleName, $modulePrefix='')
Constructor.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
see documentation in includes Linker php for Linker::makeImageLink & $time
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getContext()
Get the RequestContext object.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
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.
static instance()
Singleton.
getTokenSalt()
Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the mo...
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.
static setContent(&$arr, $value, $subElemName=null)
Adds a content element to an array.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
getProfileDBTime()
Total time the module used the database.
validateTimestamp( $value, $encParamName)
Validate and normalize of parameters of type 'timestamp'.
dieUsageMsg( $error)
Output the error message related to a certain array.
indentExampleText( $item)
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
profileDBIn()
Start module profiling.
getTitleOrPageId( $params, $load=false)
getResult()
Get the result object.
wfProfileIn( $functionname)
Begin profiling of a function.
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
profileDBOut()
End database profiling.
mustBePosted()
Indicates whether this module must be called with a POST request.
shouldCheckMaxlag()
Indicates if this module needs maxlag to be checked.
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
getDB()
Gets a default slave database connection object.
makeHelpArrayToString( $prefix, $title, $input)
const PARAM_ALLOW_DUPLICATES
it s the revision text itself In either if gzip is the revision text is gzipped $flags
getUser()
Get the User object.
getModuleProfileName( $db=false)
Get the name of the module as shown in the profiler log.
isMain()
Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.
isReadMode()
Indicates whether this module requires read rights.
This abstract class implements many basic API functions, and is the base of all API classes.
getFinalParamDescription()
Get final parameter descriptions, after hooks have had a chance to tweak it as needed.
$mTimeIn
Profiling: total module execution time.
static $messageMap
Array that maps message keys to error messages.
getParamDescription()
Returns an array of parameter descriptions.
wfBacktrace()
Get a debug backtrace as a string.
profileOut()
End module profiling.
An IContextSource implementation which will inherit context from another source but allow individual ...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
getFinalResultProperties()
Get final possible result properties, after hooks have had a chance to tweak it as needed.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getFinalPossibleErrors()
Get final list of possible errors, after hooks have had a chance to tweak it as needed.
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.
This exception will be thrown when dieUsage is called to stop module execution.
getDescription()
Returns the description string for this module.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
const IGNORE_USER_RIGHTS
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.
getVersion()
Returns a string that identifies the version of the extending class.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
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 just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables 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 "<
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues)
Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them a...
getRequireOnlyOneParameterErrorMessages( $params)
Generates the possible errors requireOnlyOneParameter() can die with.
setContext(IContextSource $context)
Set the IContextSource object.
requireAtLeastOneParameter( $params)
Die if none of a certain set of parameters is set and not false.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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 whether this module requires a token to execute It is used to show possible errors in action=...
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.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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,...
presenting them properly to the user as errors is done by the caller $title
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
Allows to change the fields on the form that will be generated $name
dieContinueUsageIf( $condition)
Die with the $prefix.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
dieReadOnly()
Helper function for readonly errors.
requireOnlyOneParameter( $params)
Die if none or more than one of a certain set of parameters is set and not false.
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
getResultData()
Get the result data array (read-only)
static addTokenProperties(&$props, $tokenFunctions)
Add token properties to the array used by getResultProperties, based on a token functions mapping.
static newFromID( $id, $from='fromdb')
Constructor from a page id.
getPossibleErrors()
Returns a list of all possible errors returned by the module.
isWriteMode()
Indicates whether this module requires write mode.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
static truncateArray(&$arr, $limit)
Truncate an array to a certain length.
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
profileIn()
Start module profiling.
const PARAM_RANGE_ENFORCE
setWarning( $warning)
Set warning section for this module.
getProfileTime()
Total time the module was executed.
const ADD_ON_TOP
For addValue() and setElement(), if the value does not exist, add it as the first element.
getErrorFromStatus( $status)
Get error (as code, string) from a Status object.
wfReadOnlyReason()
Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.
getModuleManager()
Get the module manager, or null if this module has no sub-modules.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
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
safeProfileOut()
When modules crash, sometimes it is needed to do a profileOut() regardless of the profiling state the...
getModuleName()
Get the name of the module being executed by this instance.
warnOrDie( $msg, $enforceLimits=false)
Adds a warning to the output, else dies.
const OVERRIDE
override existing value in addValue() and setElement()
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
static debugPrint( $value, $name='unknown', $backtrace=false)
Debugging function that prints a value and an optional backtrace.
makeHelpMsg()
Generates help message for this module, or false if there is no description.
getMain()
Get the main module.
getParameterFromSettings( $paramName, $paramSettings, $parseLimit)
Using the settings determine the value for the given parameter.
getExamples()
Returns usage examples for this module.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
getRequireMaxOneParameterErrorMessages( $params)
Generates the possible error requireMaxOneParameter() can die with.
requireMaxOneParameter( $params)
Die if more than one of a certain set of parameters is set and not false.
parseErrors( $errors)
Parses a list of errors into a standardised format.
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.
getRequireAtLeastOneParameterErrorMessages( $params)
Generates the possible errors requireAtLeastOneParameter() can die with.
getTitleOrPageIdErrorMessage()