78 private $fld_linkclasses =
false;
83 private $fld_associatedpage =
false;
104 private $watchlistExpiries;
110 private $linkClasses;
112 private $showZeroWatchers =
false;
114 private $countTestedActions = 0;
152 parent::__construct( $queryModule, $moduleName,
'in' );
154 $this->linkBatchFactory = $linkBatchFactory;
155 $this->namespaceInfo = $namespaceInfo;
156 $this->titleFactory = $titleFactory;
157 $this->titleFormatter = $titleFormatter;
158 $this->watchedItemStore = $watchedItemStore;
159 $this->restrictionStore = $restrictionStore;
160 $this->linksMigration = $linksMigration;
161 $this->tempUserCreator = $tempUserCreator;
162 $this->introMessageBuilder = $introMessageBuilder;
163 $this->preloadedContentBuilder = $preloadedContentBuilder;
164 $this->revisionLookup = $revisionLookup;
165 $this->urlUtils = $urlUtils;
176 $pageSet->requestField(
'page_is_redirect' );
177 $pageSet->requestField(
'page_is_new' );
179 $pageSet->requestField(
'page_touched' );
180 $pageSet->requestField(
'page_latest' );
181 $pageSet->requestField(
'page_len' );
182 $pageSet->requestField(
'page_content_model' );
183 if ( $config->get( MainConfigNames::PageLanguageUseDB ) ) {
184 $pageSet->requestField(
'page_lang' );
190 if ( $this->params[
'prop'] !==
null ) {
191 $prop = array_fill_keys( $this->params[
'prop'],
true );
192 $this->fld_protection = isset( $prop[
'protection'] );
193 $this->fld_watched = isset( $prop[
'watched'] );
194 $this->fld_watchers = isset( $prop[
'watchers'] );
195 $this->fld_visitingwatchers = isset( $prop[
'visitingwatchers'] );
196 $this->fld_notificationtimestamp = isset( $prop[
'notificationtimestamp'] );
197 $this->fld_talkid = isset( $prop[
'talkid'] );
198 $this->fld_subjectid = isset( $prop[
'subjectid'] );
199 $this->fld_url = isset( $prop[
'url'] );
200 $this->fld_readable = isset( $prop[
'readable'] );
201 $this->fld_preload = isset( $prop[
'preload'] );
202 $this->fld_preloadcontent = isset( $prop[
'preloadcontent'] );
203 $this->fld_editintro = isset( $prop[
'editintro'] );
204 $this->fld_displaytitle = isset( $prop[
'displaytitle'] );
205 $this->fld_varianttitles = isset( $prop[
'varianttitles'] );
206 $this->fld_linkclasses = isset( $prop[
'linkclasses'] );
207 $this->fld_associatedpage = isset( $prop[
'associatedpage'] );
211 $this->titles = $pageSet->getGoodPages();
212 $this->missing = $pageSet->getMissingPages();
213 $this->everything = $this->titles + $this->missing;
217 ( $this->fld_preloadcontent || $this->fld_editintro ) &&
218 ( count( $this->everything ) > 1 || count( $this->
getPageSet()->getRevisionIDs() ) > 1 )
223 [
'apierror-info-singlepagerevision', $this->
getModulePrefix() ],
'invalidparammix'
227 uasort( $this->everything, [ Title::class,
'compare' ] );
228 if ( $this->params[
'continue'] !==
null ) {
232 $conttitle = $this->titleFactory->makeTitleSafe( $cont[0], $cont[1] );
234 foreach ( $this->everything as $pageid => $page ) {
235 if ( Title::compare( $page, $conttitle ) >= 0 ) {
238 unset( $this->titles[$pageid] );
239 unset( $this->missing[$pageid] );
240 unset( $this->everything[$pageid] );
245 $this->pageIsRedir = !$pageSet->isResolvingRedirects()
246 ? $pageSet->getCustomField(
'page_is_redirect' )
248 $this->pageIsNew = $pageSet->getCustomField(
'page_is_new' );
250 $this->pageTouched = $pageSet->getCustomField(
'page_touched' );
251 $this->pageLatest = $pageSet->getCustomField(
'page_latest' );
252 $this->pageLength = $pageSet->getCustomField(
'page_len' );
255 if ( $this->fld_protection ) {
256 $this->getProtectionInfo();
259 if ( $this->fld_watched || $this->fld_notificationtimestamp ) {
260 $this->getWatchedInfo();
263 if ( $this->fld_watchers ) {
264 $this->getWatcherInfo();
267 if ( $this->fld_visitingwatchers ) {
268 $this->getVisitingWatcherInfo();
272 if ( $this->fld_talkid || $this->fld_subjectid ) {
276 if ( $this->fld_displaytitle ) {
277 $this->getDisplayTitle();
280 if ( $this->fld_varianttitles ) {
281 $this->getVariantTitles();
284 if ( $this->fld_linkclasses ) {
285 $this->getLinkClasses( $this->params[
'linkcontext'] );
289 foreach ( $this->everything as $pageid => $page ) {
290 $pageInfo = $this->extractPageInfo( $pageid, $page );
291 $fit = $pageInfo !==
null && $result->addValue( [
294 ], $pageid, $pageInfo );
297 $page->getNamespace() .
'|' .
298 $this->titleFormatter->getText( $page ) );
310 private function extractPageInfo( $pageid, $page ) {
311 $title = $this->titleFactory->newFromPageIdentity( $page );
314 $pageExists = $pageid > 0;
315 $ns = $page->getNamespace();
316 $dbkey = $page->getDBkey();
318 $pageInfo[
'contentmodel'] = $title->getContentModel();
320 $pageLanguage = $title->getPageLanguage();
321 $pageInfo[
'pagelanguage'] = $pageLanguage->getCode();
322 $pageInfo[
'pagelanguagehtmlcode'] = $pageLanguage->getHtmlCode();
323 $pageInfo[
'pagelanguagedir'] = $pageLanguage->getDir();
326 $pageInfo[
'touched'] =
wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
327 $pageInfo[
'lastrevid'] = (int)$this->pageLatest[$pageid];
328 $pageInfo[
'length'] = (int)$this->pageLength[$pageid];
330 if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
331 $pageInfo[
'redirect'] =
true;
333 if ( $this->pageIsNew[$pageid] ) {
334 $pageInfo[
'new'] =
true;
338 if ( $this->fld_protection ) {
339 $pageInfo[
'protection'] = [];
340 if ( isset( $this->protections[$ns][$dbkey] ) ) {
341 $pageInfo[
'protection'] =
342 $this->protections[$ns][$dbkey];
346 $pageInfo[
'restrictiontypes'] = [];
347 if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
348 $pageInfo[
'restrictiontypes'] =
349 $this->restrictionTypes[$ns][$dbkey];
354 if ( $this->fld_watched ) {
355 $pageInfo[
'watched'] =
false;
357 if ( isset( $this->watched[$ns][$dbkey] ) ) {
358 $pageInfo[
'watched'] = $this->watched[$ns][$dbkey];
361 if ( isset( $this->watchlistExpiries[$ns][$dbkey] ) ) {
362 $pageInfo[
'watchlistexpiry'] = $this->watchlistExpiries[$ns][$dbkey];
366 if ( $this->fld_watchers ) {
367 if ( $this->watchers !==
null && $this->watchers[$ns][$dbkey] !== 0 ) {
368 $pageInfo[
'watchers'] = $this->watchers[$ns][$dbkey];
369 } elseif ( $this->showZeroWatchers ) {
370 $pageInfo[
'watchers'] = 0;
374 if ( $this->fld_visitingwatchers ) {
375 if ( $this->visitingwatchers !==
null && $this->visitingwatchers[$ns][$dbkey] !== 0 ) {
376 $pageInfo[
'visitingwatchers'] = $this->visitingwatchers[$ns][$dbkey];
377 } elseif ( $this->showZeroWatchers ) {
378 $pageInfo[
'visitingwatchers'] = 0;
382 if ( $this->fld_notificationtimestamp ) {
383 $pageInfo[
'notificationtimestamp'] =
'';
384 if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
385 $pageInfo[
'notificationtimestamp'] =
386 wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
390 if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
391 $pageInfo[
'talkid'] = $this->talkids[$ns][$dbkey];
394 if ( $this->fld_subjectid && isset( $this->subjectids[$ns][$dbkey] ) ) {
395 $pageInfo[
'subjectid'] = $this->subjectids[$ns][$dbkey];
398 if ( $this->fld_associatedpage && $ns >=
NS_MAIN ) {
399 $pageInfo[
'associatedpage'] = $this->titleFormatter->getPrefixedText(
400 $this->namespaceInfo->getAssociatedPage( TitleValue::newFromPage( $page ) )
404 if ( $this->fld_url ) {
405 $pageInfo[
'fullurl'] = (string)$this->urlUtils->expand(
408 $pageInfo[
'editurl'] = (string)$this->urlUtils->expand(
411 $pageInfo[
'canonicalurl'] = (string)$this->urlUtils->expand(
415 if ( $this->fld_readable ) {
416 $pageInfo[
'readable'] = $this->
getAuthority()->definitelyCan(
'read', $page );
419 if ( $this->fld_preload ) {
421 $pageInfo[
'preload'] =
'';
425 $this->
getHookRunner()->onEditFormPreloadText( $text, $title );
427 $pageInfo[
'preload'] = $text;
431 if ( $this->fld_preloadcontent ) {
432 $newSection = $this->params[
'preloadnewsection'];
435 if ( !$pageExists || $newSection ) {
436 $content = $this->preloadedContentBuilder->getPreloadedContent(
437 $title->toPageIdentity(),
438 $this->getAuthority(),
439 $this->params[
'preloadcustom'],
440 $this->params[
'preloadparams'] ?? [],
441 $newSection ?
'new' :
null
443 $defaultContent = $newSection ? null :
444 $this->preloadedContentBuilder->getDefaultContent( $title->toPageIdentity() );
445 $contentIsDefault = $defaultContent ?
$content->equals( $defaultContent ) :
$content->isEmpty();
448 $pageInfo[
'preloadcontent'][
'contentmodel'] =
$content->getModel();
449 $pageInfo[
'preloadcontent'][
'contentformat'] =
$content->getDefaultFormat();
454 $pageInfo[
'preloadisdefault'] = $contentIsDefault;
458 if ( $this->fld_editintro ) {
460 $localizerWithPage =
new class( $this, $page ) implements
MessageLocalizer {
472 public function msg( $key, ...$params ) {
473 return $this->base->msg( $key, ...$params )->page( $this->page );
478 'lessframes' => IntroMessageBuilder::LESS_FRAMES,
479 'moreframes' => IntroMessageBuilder::MORE_FRAMES,
482 $revId = array_key_first( $this->
getPageSet()->getLiveRevisionIDs() );
483 $revRecord = $revId ? $this->revisionLookup->getRevisionById( $revId ) :
null;
485 $messages = $this->introMessageBuilder->getIntroMessages(
486 $styleParamMap[ $this->params[
'editintrostyle'] ],
487 $this->params[
'editintroskip'] ?? [],
489 $title->toPageIdentity(),
491 $this->getAuthority(),
492 $this->params[
'editintrocustom'],
500 $pageInfo[
'editintro'] = $messages;
503 if ( $this->fld_displaytitle ) {
504 $pageInfo[
'displaytitle'] = $this->displaytitles[$pageid] ??
505 htmlspecialchars( $this->titleFormatter->getPrefixedText( $page ), ENT_NOQUOTES );
508 if ( $this->fld_varianttitles && isset( $this->variantTitles[$pageid] ) ) {
509 $pageInfo[
'varianttitles'] = $this->variantTitles[$pageid];
512 if ( $this->fld_linkclasses && isset( $this->linkClasses[$pageid] ) ) {
513 $pageInfo[
'linkclasses'] = $this->linkClasses[$pageid];
516 if ( $this->params[
'testactions'] ) {
518 if ( $this->countTestedActions >= $limit ) {
522 $detailLevel = $this->params[
'testactionsdetail'];
524 if ( $errorFormatter->getFormat() ===
'bc' ) {
526 $errorFormatter = $errorFormatter->newWithFormat(
'plaintext' );
529 $pageInfo[
'actions'] = [];
530 foreach ( $this->params[
'testactions'] as $action ) {
531 $this->countTestedActions++;
533 if ( $detailLevel ===
'boolean' ) {
534 $pageInfo[
'actions'][$action] = $this->
getAuthority()->authorizeRead( $action, $page );
537 if ( $detailLevel ===
'quick' ) {
538 $this->
getAuthority()->probablyCan( $action, $page, $status );
540 $this->
getAuthority()->definitelyCan( $action, $page, $status );
543 $pageInfo[
'actions'][$action] = $errorFormatter->arrayFromStatus( $status );
547 if ( $this->params[
'testactionsautocreate'] ) {
548 $pageInfo[
'wouldautocreate'] = [];
549 foreach ( $this->params[
'testactions'] as $action ) {
551 $pageInfo[
'wouldautocreate'][$action] =
552 $this->tempUserCreator->shouldAutoCreate( $this->
getUser(), $action );
563 private function getProtectionInfo() {
564 $this->protections = [];
565 $db = $this->
getDB();
568 if ( count( $this->titles ) ) {
571 $this->
addFields( [
'pr_page',
'pr_type',
'pr_level',
572 'pr_expiry',
'pr_cascade' ] );
573 $this->
addWhereFld(
'pr_page', array_keys( $this->titles ) );
575 $res = $this->
select( __METHOD__ );
576 foreach ( $res as $row ) {
578 $page = $this->titles[$row->pr_page];
580 'type' => $row->pr_type,
581 'level' => $row->pr_level,
584 if ( $row->pr_cascade ) {
585 $a[
'cascade'] =
true;
592 if ( count( $this->missing ) ) {
594 $lb = $this->linkBatchFactory->newLinkBatch( $this->missing );
596 $this->
addFields( [
'pt_title',
'pt_namespace',
'pt_create_perm',
'pt_expiry' ] );
597 $this->
addWhere( $lb->constructSet(
'pt', $db ) );
598 $res = $this->
select( __METHOD__ );
599 foreach ( $res as $row ) {
600 $this->protections[$row->pt_namespace][$row->pt_title][] = [
602 'level' => $row->pt_create_perm,
610 $images = $others = [];
611 foreach ( $this->everything as $page ) {
612 if ( $page->getNamespace() ===
NS_FILE ) {
613 $images[] = $page->getDBkey();
618 $this->restrictionTypes[$page->getNamespace()][$page->getDBkey()] =
619 array_values( $this->restrictionStore->listApplicableRestrictionTypes( $page ) );
622 [ $blNamespace, $blTitle ] = $this->linksMigration->getTitleFields(
'templatelinks' );
623 $queryInfo = $this->linksMigration->getQueryInfo(
'templatelinks' );
625 if ( count( $others ) ) {
627 $lb = $this->linkBatchFactory->newLinkBatch( $others );
629 $this->
addTables( array_merge( [
'page_restrictions',
'page' ], $queryInfo[
'tables'] ) );
631 $this->
addOption(
'USE INDEX', [
'templatelinks' =>
'PRIMARY' ] );
632 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
633 'page_title',
'page_namespace',
634 $blNamespace, $blTitle ] );
635 $this->
addWhere( $lb->constructSet(
'tl', $db ) );
636 $this->
addWhere(
'pr_page = page_id' );
637 $this->
addWhere(
'pr_page = tl_from' );
641 $res = $this->
select( __METHOD__ );
642 foreach ( $res as $row ) {
643 $this->protections[$row->$blNamespace][$row->$blTitle][] = [
644 'type' => $row->pr_type,
645 'level' => $row->pr_level,
647 'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
652 if ( count( $images ) ) {
655 $this->
addTables( [
'page_restrictions',
'page',
'imagelinks' ] );
656 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
657 'page_title',
'page_namespace',
'il_to' ] );
658 $this->
addWhere(
'pr_page = page_id' );
659 $this->
addWhere(
'pr_page = il_from' );
663 $res = $this->
select( __METHOD__ );
664 foreach ( $res as $row ) {
665 $this->protections[
NS_FILE][$row->il_to][] = [
666 'type' => $row->pr_type,
667 'level' => $row->pr_level,
669 'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
679 private function getTSIDs() {
680 $getTitles = $this->talkids = $this->subjectids = [];
681 $nsInfo = $this->namespaceInfo;
684 foreach ( $this->everything as $page ) {
685 if ( $nsInfo->isTalk( $page->getNamespace() ) ) {
686 if ( $this->fld_subjectid ) {
687 $getTitles[] = $nsInfo->getSubjectPage( TitleValue::newFromPage( $page ) );
689 } elseif ( $this->fld_talkid ) {
690 $getTitles[] = $nsInfo->getTalkPage( TitleValue::newFromPage( $page ) );
693 if ( $getTitles === [] ) {
697 $db = $this->
getDB();
701 $lb = $this->linkBatchFactory->newLinkBatch( $getTitles );
704 $this->
addFields( [
'page_title',
'page_namespace',
'page_id' ] );
705 $this->
addWhere( $lb->constructSet(
'page', $db ) );
706 $res = $this->
select( __METHOD__ );
707 foreach ( $res as $row ) {
708 if ( $nsInfo->isTalk( $row->page_namespace ) ) {
709 $this->talkids[$nsInfo->getSubject( $row->page_namespace )][$row->page_title] =
710 (int)( $row->page_id );
712 $this->subjectids[$nsInfo->getTalk( $row->page_namespace )][$row->page_title] =
713 (int)( $row->page_id );
718 private function getDisplayTitle() {
719 $this->displaytitles = [];
721 $pageIds = array_keys( $this->titles );
723 if ( $pageIds === [] ) {
729 $this->
addFields( [
'pp_page',
'pp_value' ] );
731 $this->
addWhereFld(
'pp_propname',
'displaytitle' );
732 $res = $this->
select( __METHOD__ );
734 foreach ( $res as $row ) {
735 $this->displaytitles[$row->pp_page] = $row->pp_value;
746 private function getLinkClasses( ?
LinkTarget $context_title =
null ) {
747 if ( $this->titles === [] ) {
758 foreach ( $this->titles as $pageId => $page ) {
759 $pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
760 $pagemap[$pageId] = $pdbk;
761 $classes[$pdbk] = isset( $this->pageIsRedir[$pageId] ) && $this->pageIsRedir[$pageId] ?
'mw-redirect' :
'';
764 $context_title = $this->titleFactory->newFromLinkTarget(
765 $context_title ?? $this->titleFactory->newMainPage()
768 $pagemap, $classes, $context_title
775 $this->linkClasses = [];
776 foreach ( $this->titles as $pageId => $page ) {
777 $pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
778 $this->linkClasses[$pageId] = preg_split(
779 '/\s+/', $classes[$pdbk] ??
'', -1, PREG_SPLIT_NO_EMPTY
784 private function getVariantTitles() {
785 if ( $this->titles === [] ) {
788 $this->variantTitles = [];
789 foreach ( $this->titles as $pageId => $page ) {
790 $this->variantTitles[$pageId] = isset( $this->displaytitles[$pageId] )
791 ? $this->getAllVariants( $this->displaytitles[$pageId] )
792 : $this->getAllVariants( $this->titleFormatter->getText( $page ), $page->getNamespace() );
796 private function getAllVariants( $text, $ns =
NS_MAIN ) {
798 foreach ( $this->languageConverter->getVariants() as $variant ) {
799 $convertTitle = $this->languageConverter->autoConvert( $text, $variant );
801 $convertNs = $this->languageConverter->convertNamespace( $ns, $variant );
802 $convertTitle = $convertNs .
':' . $convertTitle;
804 $result[$variant] = $convertTitle;
813 private function getWatchedInfo() {
816 if ( !$user->isRegistered() || count( $this->everything ) == 0
817 || !$this->
getAuthority()->isAllowed(
'viewmywatchlist' )
823 $this->watchlistExpiries = [];
824 $this->notificationtimestamps = [];
827 $items = $this->watchedItemStore->loadWatchedItemsBatch( $user, $this->everything );
829 foreach ( $items as $item ) {
830 $nsId = $item->getTarget()->getNamespace();
831 $dbKey = $item->getTarget()->getDBkey();
833 if ( $this->fld_watched ) {
834 $this->watched[$nsId][$dbKey] =
true;
836 $expiry = $item->getExpiry( TS_ISO_8601 );
838 $this->watchlistExpiries[$nsId][$dbKey] = $expiry;
842 if ( $this->fld_notificationtimestamp ) {
843 $this->notificationtimestamps[$nsId][$dbKey] = $item->getNotificationTimestamp();
851 private function getWatcherInfo() {
852 if ( count( $this->everything ) == 0 ) {
856 $canUnwatchedpages = $this->
getAuthority()->isAllowed(
'unwatchedpages' );
857 $unwatchedPageThreshold =
858 $this->
getConfig()->get( MainConfigNames::UnwatchedPageThreshold );
859 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
863 $this->showZeroWatchers = $canUnwatchedpages;
866 if ( !$canUnwatchedpages ) {
867 $countOptions[
'minimumWatchers'] = $unwatchedPageThreshold;
870 $this->watchers = $this->watchedItemStore->countWatchersMultiple(
882 private function getVisitingWatcherInfo() {
884 $db = $this->
getDB();
886 $canUnwatchedpages = $this->
getAuthority()->isAllowed(
'unwatchedpages' );
887 $unwatchedPageThreshold = $config->get( MainConfigNames::UnwatchedPageThreshold );
888 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
892 $this->showZeroWatchers = $canUnwatchedpages;
894 $titlesWithThresholds = [];
895 if ( $this->titles ) {
896 $lb = $this->linkBatchFactory->newLinkBatch( $this->titles );
900 $this->
addTables( [
'page',
'revision' ] );
901 $this->
addFields( [
'page_namespace',
'page_title',
'rev_timestamp' ] );
903 'page_latest = rev_id',
904 $lb->constructSet(
'page', $db ),
906 $this->
addOption(
'GROUP BY', [
'page_namespace',
'page_title' ] );
907 $timestampRes = $this->
select( __METHOD__ );
909 $age = $config->get( MainConfigNames::WatchersMaxAge );
911 foreach ( $timestampRes as $row ) {
912 $revTimestamp =
wfTimestamp( TS_UNIX, (
int)$row->rev_timestamp );
913 $timestamps[$row->page_namespace][$row->page_title] = (int)$revTimestamp - $age;
915 $titlesWithThresholds = array_map(
916 static function (
PageReference $target ) use ( $timestamps ) {
925 if ( $this->missing ) {
926 $titlesWithThresholds = array_merge(
927 $titlesWithThresholds,
930 return [ $target, null ];
936 $this->visitingwatchers = $this->watchedItemStore->countVisitingWatchersMultiple(
937 $titlesWithThresholds,
938 !$canUnwatchedpages ? $unwatchedPageThreshold :
null
954 if ( array_diff( (array)$params[
'prop'], $publicProps ) ) {
959 if ( $params[
'testactions'] ) {
969 ParamValidator::PARAM_ISMULTI =>
true,
970 ParamValidator::PARAM_TYPE => [
974 'watchers', #
private
975 'visitingwatchers', #
private
976 'notificationtimestamp', #
private
980 'readable', #
private
982 'preloadcontent', #
private: checks current user
's permissions
983 'editintro
', # private: checks current user's permissions
986 'linkclasses', #
private: stub length (and possibly hook colors)
991 EnumDef::PARAM_DEPRECATED_VALUES => [
997 ParamValidator::PARAM_TYPE =>
'title',
998 ParamValidator::PARAM_DEFAULT => $this->titleFactory->newMainPage()->getPrefixedText(),
999 TitleDef::PARAM_RETURN_OBJECT =>
true,
1002 ParamValidator::PARAM_TYPE =>
'string',
1003 ParamValidator::PARAM_ISMULTI =>
true,
1005 'testactionsdetail' => [
1006 ParamValidator::PARAM_TYPE => [
'boolean',
'full',
'quick' ],
1007 ParamValidator::PARAM_DEFAULT =>
'boolean',
1010 'testactionsautocreate' =>
false,
1011 'preloadcustom' => [
1014 ParamValidator::PARAM_TYPE =>
'string',
1017 'preloadparams' => [
1018 ParamValidator::PARAM_ISMULTI =>
true,
1021 'preloadnewsection' => [
1022 ParamValidator::PARAM_TYPE =>
'boolean',
1023 ParamValidator::PARAM_DEFAULT =>
false,
1026 'editintrostyle' => [
1027 ParamValidator::PARAM_TYPE => [
'lessframes',
'moreframes' ],
1028 ParamValidator::PARAM_DEFAULT =>
'moreframes',
1031 'editintroskip' => [
1032 ParamValidator::PARAM_TYPE =>
'string',
1033 ParamValidator::PARAM_ISMULTI =>
true,
1036 'editintrocustom' => [
1039 ParamValidator::PARAM_TYPE =>
'string',
1049 $title = Title::newMainPage()->getPrefixedText();
1050 $mp = rawurlencode( $title );
1053 "action=query&prop=info&titles={$mp}"
1054 =>
'apihelp-query+info-example-simple',
1055 "action=query&prop=info&inprop=protection&titles={$mp}"
1056 =>
'apihelp-query+info-example-protection',
1061 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Info';
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
addBlockInfoToStatus(StatusValue $status, Authority $user=null)
Add block info to block messages in a Status.
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
getMain()
Get the main module.
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
parseContinueParamOrDie(string $continue, array $types)
Parse the 'continue' parameter in the usual format and validate the types of each part,...
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, or 'string' with PARAM_ISMULTI,...
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.
getHookRunner()
Get an ApiHookRunner for running core API hooks.
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)
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere( [ $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
getExamplesMessages()
Returns usage examples for this module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
requestExtraData( $pageSet)
getHelpUrls()
Return links to more detailed help pages about the module.
__construct(ApiQuery $queryModule, $moduleName, Language $contentLanguage, LinkBatchFactory $linkBatchFactory, NamespaceInfo $namespaceInfo, TitleFactory $titleFactory, TitleFormatter $titleFormatter, WatchedItemStore $watchedItemStore, LanguageConverterFactory $languageConverterFactory, RestrictionStore $restrictionStore, LinksMigration $linksMigration, TempUserCreator $tempUserCreator, IntroMessageBuilder $introMessageBuilder, PreloadedContentBuilder $preloadedContentBuilder, RevisionLookup $revisionLookup, UrlUtils $urlUtils)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getCacheMode( $params)
Get the cache mode for the data generated by this module.
This is the main query class.
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Base class for language-specific code.
Provides the intro messages (edit notices and others) to be displayed before an edit form.
Provides the initial content of the edit box displayed in an edit form when creating a new page or a ...
A class containing constants representing the names of configuration variables.
Storage layer class for WatchedItems.
The shared interface for all language converters.
Interface for objects (potentially) representing an editable wiki page.
Interface for localizing messages in MediaWiki.