60 parent::__construct(
$query, $moduleName,
'in' );
68 $pageSet->requestField(
'page_restrictions' );
72 $pageSet->requestField(
'page_is_redirect' );
73 $pageSet->requestField(
'page_is_new' );
75 $pageSet->requestField(
'page_touched' );
76 $pageSet->requestField(
'page_latest' );
77 $pageSet->requestField(
'page_len' );
78 if ( $config->get(
'ContentHandlerUseDB' ) ) {
79 $pageSet->requestField(
'page_content_model' );
81 if ( $config->get(
'PageLanguageUseDB' ) ) {
82 $pageSet->requestField(
'page_lang' );
95 if ( isset( $this->tokenFunctions ) ) {
105 $this->tokenFunctions = [
106 'edit' => [ self::class,
'getEditToken' ],
107 'delete' => [ self::class,
'getDeleteToken' ],
108 'protect' => [ self::class,
'getProtectToken' ],
109 'move' => [ self::class,
'getMoveToken' ],
110 'block' => [ self::class,
'getBlockToken' ],
111 'unblock' => [ self::class,
'getUnblockToken' ],
112 'email' => [ self::class,
'getEmailToken' ],
113 'import' => [ self::class,
'getImportToken' ],
114 'watch' => [ self::class,
'getWatchToken' ],
116 Hooks::run(
'APIQueryInfoTokens', [ &$this->tokenFunctions ] );
127 self::$cachedTokens = [];
138 if ( !$wgUser->isAllowed(
'edit' ) ) {
143 if ( !isset( self::$cachedTokens[
'edit'] ) ) {
144 self::$cachedTokens[
'edit'] = $wgUser->getEditToken();
147 return self::$cachedTokens[
'edit'];
155 if ( !$wgUser->isAllowed(
'delete' ) ) {
160 if ( !isset( self::$cachedTokens[
'delete'] ) ) {
161 self::$cachedTokens[
'delete'] = $wgUser->getEditToken();
164 return self::$cachedTokens[
'delete'];
172 if ( !$wgUser->isAllowed(
'protect' ) ) {
177 if ( !isset( self::$cachedTokens[
'protect'] ) ) {
178 self::$cachedTokens[
'protect'] = $wgUser->getEditToken();
181 return self::$cachedTokens[
'protect'];
189 if ( !$wgUser->isAllowed(
'move' ) ) {
194 if ( !isset( self::$cachedTokens[
'move'] ) ) {
195 self::$cachedTokens[
'move'] = $wgUser->getEditToken();
198 return self::$cachedTokens[
'move'];
206 if ( !$wgUser->isAllowed(
'block' ) ) {
211 if ( !isset( self::$cachedTokens[
'block'] ) ) {
212 self::$cachedTokens[
'block'] = $wgUser->getEditToken();
215 return self::$cachedTokens[
'block'];
231 if ( !$wgUser->canSendEmail() || $wgUser->isBlockedFromEmailuser() ) {
236 if ( !isset( self::$cachedTokens[
'email'] ) ) {
237 self::$cachedTokens[
'email'] = $wgUser->getEditToken();
240 return self::$cachedTokens[
'email'];
248 if ( !$wgUser->isAllowedAny(
'import',
'importupload' ) ) {
253 if ( !isset( self::$cachedTokens[
'import'] ) ) {
254 self::$cachedTokens[
'import'] = $wgUser->getEditToken();
257 return self::$cachedTokens[
'import'];
265 if ( !$wgUser->isLoggedIn() ) {
270 if ( !isset( self::$cachedTokens[
'watch'] ) ) {
271 self::$cachedTokens[
'watch'] = $wgUser->getEditToken(
'watch' );
274 return self::$cachedTokens[
'watch'];
282 if ( !$wgUser->isLoggedIn() ) {
287 if ( !isset( self::$cachedTokens[
'options'] ) ) {
288 self::$cachedTokens[
'options'] = $wgUser->getEditToken();
291 return self::$cachedTokens[
'options'];
296 if ( !is_null( $this->params[
'prop'] ) ) {
297 $prop = array_flip( $this->params[
'prop'] );
298 $this->fld_protection = isset( $prop[
'protection'] );
299 $this->fld_watched = isset( $prop[
'watched'] );
300 $this->fld_watchers = isset( $prop[
'watchers'] );
301 $this->fld_visitingwatchers = isset( $prop[
'visitingwatchers'] );
302 $this->fld_notificationtimestamp = isset( $prop[
'notificationtimestamp'] );
303 $this->fld_talkid = isset( $prop[
'talkid'] );
304 $this->fld_subjectid = isset( $prop[
'subjectid'] );
305 $this->fld_url = isset( $prop[
'url'] );
306 $this->fld_readable = isset( $prop[
'readable'] );
307 $this->fld_preload = isset( $prop[
'preload'] );
308 $this->fld_displaytitle = isset( $prop[
'displaytitle'] );
309 $this->fld_varianttitles = isset( $prop[
'varianttitles'] );
313 $this->titles = $pageSet->getGoodTitles();
314 $this->missing = $pageSet->getMissingTitles();
318 uasort( $this->everything, [ Title::class,
'compare' ] );
319 if ( !is_null( $this->params[
'continue'] ) ) {
322 $cont = explode(
'|', $this->params[
'continue'] );
324 $conttitle = Title::makeTitleSafe( $cont[0], $cont[1] );
325 foreach ( $this->everything
as $pageid =>
$title ) {
326 if ( Title::compare(
$title, $conttitle ) >= 0 ) {
329 unset( $this->titles[$pageid] );
330 unset( $this->missing[$pageid] );
331 unset( $this->everything[$pageid] );
335 $this->pageRestrictions = $pageSet->getCustomField(
'page_restrictions' );
337 $this->pageIsRedir = !$pageSet->isResolvingRedirects()
338 ? $pageSet->getCustomField(
'page_is_redirect' )
340 $this->pageIsNew = $pageSet->getCustomField(
'page_is_new' );
342 $this->pageTouched = $pageSet->getCustomField(
'page_touched' );
343 $this->pageLatest = $pageSet->getCustomField(
'page_latest' );
344 $this->pageLength = $pageSet->getCustomField(
'page_len' );
347 if ( $this->fld_protection ) {
351 if ( $this->fld_watched || $this->fld_notificationtimestamp ) {
355 if ( $this->fld_watchers ) {
359 if ( $this->fld_visitingwatchers ) {
364 if ( $this->fld_talkid || $this->fld_subjectid ) {
368 if ( $this->fld_displaytitle ) {
372 if ( $this->fld_varianttitles ) {
377 foreach ( $this->everything
as $pageid =>
$title ) {
379 $fit = $pageInfo !==
null &&
$result->addValue( [
382 ], $pageid, $pageInfo );
385 $title->getNamespace() .
'|' .
401 $titleExists = $pageid > 0;
402 $ns =
$title->getNamespace();
403 $dbkey =
$title->getDBkey();
405 $pageInfo[
'contentmodel'] =
$title->getContentModel();
407 $pageLanguage =
$title->getPageLanguage();
408 $pageInfo[
'pagelanguage'] = $pageLanguage->getCode();
409 $pageInfo[
'pagelanguagehtmlcode'] = $pageLanguage->getHtmlCode();
410 $pageInfo[
'pagelanguagedir'] = $pageLanguage->getDir();
412 if ( $titleExists ) {
413 $pageInfo[
'touched'] =
wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
414 $pageInfo[
'lastrevid'] = (int)$this->pageLatest[$pageid];
415 $pageInfo[
'length'] = (int)$this->pageLength[$pageid];
417 if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
418 $pageInfo[
'redirect'] =
true;
420 if ( $this->pageIsNew[$pageid] ) {
421 $pageInfo[
'new'] =
true;
425 if ( !is_null( $this->params[
'token'] ) ) {
427 $pageInfo[
'starttimestamp'] =
wfTimestamp( TS_ISO_8601, time() );
428 foreach ( $this->params[
'token']
as $t ) {
430 if ( $val ===
false ) {
431 $this->
addWarning( [
'apiwarn-tokennotallowed', $t ] );
433 $pageInfo[
$t .
'token'] = $val;
438 if ( $this->fld_protection ) {
439 $pageInfo[
'protection'] = [];
440 if ( isset( $this->protections[$ns][$dbkey] ) ) {
441 $pageInfo[
'protection'] =
442 $this->protections[$ns][$dbkey];
446 $pageInfo[
'restrictiontypes'] = [];
447 if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
448 $pageInfo[
'restrictiontypes'] =
449 $this->restrictionTypes[$ns][$dbkey];
454 if ( $this->fld_watched && $this->watched !==
null ) {
455 $pageInfo[
'watched'] = $this->watched[$ns][$dbkey];
458 if ( $this->fld_watchers ) {
459 if ( $this->watchers !==
null && $this->watchers[$ns][$dbkey] !== 0 ) {
460 $pageInfo[
'watchers'] = $this->watchers[$ns][$dbkey];
461 } elseif ( $this->showZeroWatchers ) {
462 $pageInfo[
'watchers'] = 0;
466 if ( $this->fld_visitingwatchers ) {
467 if ( $this->visitingwatchers !==
null && $this->visitingwatchers[$ns][$dbkey] !== 0 ) {
468 $pageInfo[
'visitingwatchers'] = $this->visitingwatchers[$ns][$dbkey];
469 } elseif ( $this->showZeroWatchers ) {
470 $pageInfo[
'visitingwatchers'] = 0;
474 if ( $this->fld_notificationtimestamp ) {
475 $pageInfo[
'notificationtimestamp'] =
'';
476 if ( $this->notificationtimestamps[$ns][$dbkey] ) {
477 $pageInfo[
'notificationtimestamp'] =
478 wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
482 if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
483 $pageInfo[
'talkid'] = $this->talkids[$ns][$dbkey];
486 if ( $this->fld_subjectid && isset( $this->subjectids[$ns][$dbkey] ) ) {
487 $pageInfo[
'subjectid'] = $this->subjectids[$ns][$dbkey];
490 if ( $this->fld_url ) {
495 if ( $this->fld_readable ) {
496 $pageInfo[
'readable'] =
$title->userCan(
'read', $this->
getUser() );
499 if ( $this->fld_preload ) {
500 if ( $titleExists ) {
501 $pageInfo[
'preload'] =
'';
504 Hooks::run(
'EditFormPreloadText', [ &$text, &
$title ] );
506 $pageInfo[
'preload'] = $text;
510 if ( $this->fld_displaytitle ) {
511 if ( isset( $this->displaytitles[$pageid] ) ) {
512 $pageInfo[
'displaytitle'] = $this->displaytitles[$pageid];
514 $pageInfo[
'displaytitle'] =
$title->getPrefixedText();
518 if ( $this->fld_varianttitles && isset( $this->variantTitles[$pageid] ) ) {
519 $pageInfo[
'varianttitles'] = $this->variantTitles[$pageid];
522 if ( $this->params[
'testactions'] ) {
524 if ( $this->countTestedActions >= $limit ) {
528 $detailLevel = $this->params[
'testactionsdetail'];
529 $rigor = $detailLevel ===
'quick' ?
'quick' :
'secure';
531 if ( $errorFormatter->getFormat() ===
'bc' ) {
533 $errorFormatter = $errorFormatter->newWithFormat(
'plaintext' );
537 $pageInfo[
'actions'] = [];
538 foreach ( $this->params[
'testactions']
as $action ) {
539 $this->countTestedActions++;
541 if ( $detailLevel ===
'boolean' ) {
542 $pageInfo[
'actions'][$action] =
$title->userCan( $action,
$user );
544 $pageInfo[
'actions'][$action] = $errorFormatter->arrayFromStatus( $this->
errorArrayToStatus(
545 $title->getUserPermissionsErrors( $action,
$user, $rigor ),
559 $this->protections = [];
560 $db = $this->
getDB();
563 if ( count( $this->titles ) ) {
566 $this->
addFields( [
'pr_page',
'pr_type',
'pr_level',
567 'pr_expiry',
'pr_cascade' ] );
568 $this->
addWhereFld(
'pr_page', array_keys( $this->titles ) );
571 foreach (
$res as $row ) {
573 $title = $this->titles[$row->pr_page];
575 'type' => $row->pr_type,
576 'level' => $row->pr_level,
579 if ( $row->pr_cascade ) {
580 $a[
'cascade'] =
true;
582 $this->protections[
$title->getNamespace()][
$title->getDBkey()][] = $a;
585 foreach ( $this->titles
as $pageId =>
$title ) {
586 if ( $this->pageRestrictions[$pageId] ) {
587 $namespace =
$title->getNamespace();
588 $dbKey =
$title->getDBkey();
589 $restrictions = explode(
':', trim( $this->pageRestrictions[$pageId] ) );
590 foreach ( $restrictions
as $restrict ) {
591 $temp = explode(
'=', trim( $restrict ) );
592 if ( count( $temp ) == 1 ) {
594 $restriction = trim( $temp[0] );
596 if ( $restriction ==
'' ) {
599 $this->protections[$namespace][$dbKey][] = [
601 'level' => $restriction,
602 'expiry' =>
'infinity',
604 $this->protections[$namespace][$dbKey][] = [
606 'level' => $restriction,
607 'expiry' =>
'infinity',
610 $restriction = trim( $temp[1] );
611 if ( $restriction ==
'' ) {
614 $this->protections[$namespace][$dbKey][] = [
616 'level' => $restriction,
617 'expiry' =>
'infinity',
626 if ( count( $this->missing ) ) {
630 $this->
addFields( [
'pt_title',
'pt_namespace',
'pt_create_perm',
'pt_expiry' ] );
631 $this->
addWhere( $lb->constructSet(
'pt', $db ) );
633 foreach (
$res as $row ) {
634 $this->protections[$row->pt_namespace][$row->pt_title][] = [
636 'level' => $row->pt_create_perm,
644 $images = $others = [];
645 foreach ( $this->everything
as $title ) {
647 $images[] =
$title->getDBkey();
652 $this->restrictionTypes[
$title->getNamespace()][
$title->getDBkey()] =
653 array_values(
$title->getRestrictionTypes() );
656 if ( count( $others ) ) {
660 $this->
addTables( [
'page_restrictions',
'page',
'templatelinks' ] );
661 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
662 'page_title',
'page_namespace',
663 'tl_title',
'tl_namespace' ] );
664 $this->
addWhere( $lb->constructSet(
'tl', $db ) );
665 $this->
addWhere(
'pr_page = page_id' );
666 $this->
addWhere(
'pr_page = tl_from' );
670 foreach (
$res as $row ) {
671 $source = Title::makeTitle( $row->page_namespace, $row->page_title );
672 $this->protections[$row->tl_namespace][$row->tl_title][] = [
673 'type' => $row->pr_type,
674 'level' => $row->pr_level,
676 'source' =>
$source->getPrefixedText()
681 if ( count( $images ) ) {
684 $this->
addTables( [
'page_restrictions',
'page',
'imagelinks' ] );
685 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
686 'page_title',
'page_namespace',
'il_to' ] );
687 $this->
addWhere(
'pr_page = page_id' );
688 $this->
addWhere(
'pr_page = il_from' );
693 foreach (
$res as $row ) {
694 $source = Title::makeTitle( $row->page_namespace, $row->page_title );
695 $this->protections[
NS_FILE][$row->il_to][] = [
696 'type' => $row->pr_type,
697 'level' => $row->pr_level,
699 'source' =>
$source->getPrefixedText()
710 $getTitles = $this->talkids = $this->subjectids = [];
713 foreach ( $this->everything
as $t ) {
714 if ( MWNamespace::isTalk(
$t->getNamespace() ) ) {
715 if ( $this->fld_subjectid ) {
716 $getTitles[] =
$t->getSubjectPage();
718 } elseif ( $this->fld_talkid ) {
719 $getTitles[] =
$t->getTalkPage();
722 if ( $getTitles === [] ) {
726 $db = $this->
getDB();
733 $this->
addFields( [
'page_title',
'page_namespace',
'page_id' ] );
734 $this->
addWhere( $lb->constructSet(
'page', $db ) );
736 foreach (
$res as $row ) {
737 if ( MWNamespace::isTalk( $row->page_namespace ) ) {
738 $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
741 $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
748 $this->displaytitles = [];
750 $pageIds = array_keys( $this->titles );
752 if ( $pageIds === [] ) {
758 $this->
addFields( [
'pp_page',
'pp_value' ] );
760 $this->
addWhereFld(
'pp_propname',
'displaytitle' );
763 foreach (
$res as $row ) {
764 $this->displaytitles[$row->pp_page] = $row->pp_value;
769 if ( $this->titles === [] ) {
772 $this->variantTitles = [];
773 foreach ( $this->titles
as $pageId =>
$t ) {
774 $this->variantTitles[$pageId] = isset( $this->displaytitles[$pageId] )
782 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
783 foreach ( $contLang->getVariants()
as $variant ) {
784 $convertTitle = $contLang->autoConvert( $text, $variant );
786 $convertNs = $contLang->convertNamespace( $ns, $variant );
787 $convertTitle = $convertNs .
':' . $convertTitle;
789 $result[$variant] = $convertTitle;
801 if (
$user->isAnon() || count( $this->everything ) == 0
802 || !
$user->isAllowed(
'viewmywatchlist' )
808 $this->notificationtimestamps = [];
810 $store = MediaWikiServices::getInstance()->getWatchedItemStore();
811 $timestamps = $store->getNotificationTimestampsBatch(
$user, $this->everything );
813 if ( $this->fld_watched ) {
814 foreach ( $timestamps
as $namespaceId => $dbKeys ) {
815 $this->watched[$namespaceId] = array_map(
823 if ( $this->fld_notificationtimestamp ) {
824 $this->notificationtimestamps = $timestamps;
832 if ( count( $this->everything ) == 0 ) {
837 $canUnwatchedpages =
$user->isAllowed(
'unwatchedpages' );
838 $unwatchedPageThreshold = $this->
getConfig()->get(
'UnwatchedPageThreshold' );
839 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
843 $this->showZeroWatchers = $canUnwatchedpages;
846 if ( !$canUnwatchedpages ) {
847 $countOptions[
'minimumWatchers'] = $unwatchedPageThreshold;
850 $this->watchers = MediaWikiServices::getInstance()->getWatchedItemStore()->countWatchersMultiple(
865 $db = $this->
getDB();
867 $canUnwatchedpages =
$user->isAllowed(
'unwatchedpages' );
868 $unwatchedPageThreshold = $this->
getConfig()->get(
'UnwatchedPageThreshold' );
869 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
873 $this->showZeroWatchers = $canUnwatchedpages;
875 $titlesWithThresholds = [];
876 if ( $this->titles ) {
881 $this->
addTables( [
'page',
'revision' ] );
882 $this->
addFields( [
'page_namespace',
'page_title',
'rev_timestamp' ] );
884 'page_latest = rev_id',
885 $lb->constructSet(
'page', $db ),
887 $this->
addOption(
'GROUP BY', [
'page_namespace',
'page_title' ] );
888 $timestampRes = $this->
select( __METHOD__ );
890 $age = $config->get(
'WatchersMaxAge' );
892 foreach ( $timestampRes
as $row ) {
893 $revTimestamp =
wfTimestamp( TS_UNIX, (
int)$row->rev_timestamp );
894 $timestamps[$row->page_namespace][$row->page_title] = $revTimestamp - $age;
896 $titlesWithThresholds = array_map(
906 if ( $this->missing ) {
907 $titlesWithThresholds = array_merge(
908 $titlesWithThresholds,
911 return [ $target,
null ];
917 $store = MediaWikiServices::getInstance()->getWatchedItemStore();
918 $this->visitingwatchers = $store->countVisitingWatchersMultiple(
919 $titlesWithThresholds,
920 !$canUnwatchedpages ? $unwatchedPageThreshold :
null
935 if ( array_diff( (
array)
$params[
'prop'], $publicProps ) ) {
940 if (
$params[
'testactions'] ) {
944 if ( !is_null(
$params[
'token'] ) ) {
959 'watchers', #
private
960 'visitingwatchers', #
private
961 'notificationtimestamp', #
private
964 'readable', #
private
980 'testactionsdetail' => [
998 'action=query&prop=info&titles=Main%20Page'
999 =>
'apihelp-query+info-example-simple',
1000 'action=query&prop=info&inprop=protection&titles=Main%20Page'
1001 =>
'apihelp-query+info-example-protection',
1006 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Info';
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
const PARAM_DEPRECATED_VALUES
(array) When PARAM_TYPE is an array, this indicates which of the values are deprecated.
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getErrorFormatter()
Get the error formatter.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
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 LIMIT_SML2
Slow query, apihighlimits limit.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const LIMIT_SML1
Slow query, standard limit.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
resetQueryParams()
Blank the internal arrays with query parameters.
addFields( $value)
Add a set of fields to select to the internal array.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
getDB()
Get the Query database connection (read-only)
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
getPageSet()
Get the PageSet object to work on.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
A query module to show basic page information.
$fld_notificationtimestamp
getTokenFunctions()
Get an array mapping token names to their handler functions.
getVisitingWatcherInfo()
Get the count of watchers who have visited recent edits and put it in $this->visitingwatchers.
getExamplesMessages()
Returns usage examples for this module.
static getUnblockToken( $pageid, $title)
static getWatchToken( $pageid, $title)
static getDeleteToken( $pageid, $title)
getAllVariants( $text, $ns=NS_MAIN)
static getEditToken( $pageid, $title)
static getMoveToken( $pageid, $title)
static getEmailToken( $pageid, $title)
static getProtectToken( $pageid, $title)
getWatchedInfo()
Get information about watched status and put it in $this->watched and $this->notificationtimestamps.
__construct(ApiQuery $query, $moduleName)
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
static getOptionsToken( $pageid, $title)
getProtectionInfo()
Get information about protections and put it in $protections.
static getBlockToken( $pageid, $title)
requestExtraData( $pageSet)
getWatcherInfo()
Get the count of watchers and put it in $this->watchers.
extractPageInfo( $pageid, $title)
Get a result array with information about a title.
getHelpUrls()
Return links to more detailed help pages about the module.
static getImportToken( $pageid, $title)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getTSIDs()
Get talk page IDs (if requested) and subject page IDs (if requested) and put them in $talkids and $su...
getCacheMode( $params)
Get the cache mode for the data generated by this module.
This is the main query class.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Represents a title within MediaWiki.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like select() and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL
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
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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
return true to allow those checks to and false if checking is done & $user
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))