52 private bool $fld_protection =
false;
53 private bool $fld_talkid =
false;
54 private bool $fld_subjectid =
false;
55 private bool $fld_url =
false;
56 private bool $fld_readable =
false;
57 private bool $fld_watched =
false;
58 private bool $fld_watchlistlabels =
false;
59 private bool $fld_watchers =
false;
60 private bool $fld_visitingwatchers =
false;
61 private bool $fld_notificationtimestamp =
false;
62 private bool $fld_preload =
false;
63 private bool $fld_preloadcontent =
false;
64 private bool $fld_editintro =
false;
65 private bool $fld_displaytitle =
false;
66 private bool $fld_varianttitles =
false;
72 private $fld_linkclasses =
false;
77 private $fld_associatedpage =
false;
103 private $pageTouched;
116 private $protections;
118 private $restrictionTypes;
122 private $watchlistLabels;
126 private $visitingwatchers;
128 private $notificationtimestamps;
134 private $displaytitles;
136 private $variantTitles;
142 private $watchlistExpiries;
148 private $linkClasses;
151 private $showZeroWatchers =
false;
154 private $countTestedActions = 0;
173 private readonly
UrlUtils $urlUtils,
176 parent::__construct( $queryModule, $moduleName,
'in' );
188 $pageSet->requestField(
'page_is_redirect' );
189 $pageSet->requestField(
'page_is_new' );
191 $pageSet->requestField(
'page_touched' );
192 $pageSet->requestField(
'page_latest' );
193 $pageSet->requestField(
'page_len' );
194 $pageSet->requestField(
'page_content_model' );
196 $pageSet->requestField(
'page_lang' );
202 if ( $this->params[
'prop'] !==
null ) {
203 $prop = array_fill_keys( $this->params[
'prop'],
true );
204 $this->fld_protection = isset( $prop[
'protection'] );
205 $this->fld_watched = isset( $prop[
'watched'] );
206 $this->fld_watchlistlabels = isset( $prop[
'watchlistlabels'] )
208 $this->fld_watchers = isset( $prop[
'watchers'] );
209 $this->fld_visitingwatchers = isset( $prop[
'visitingwatchers'] );
210 $this->fld_notificationtimestamp = isset( $prop[
'notificationtimestamp'] );
211 $this->fld_talkid = isset( $prop[
'talkid'] );
212 $this->fld_subjectid = isset( $prop[
'subjectid'] );
213 $this->fld_url = isset( $prop[
'url'] );
214 $this->fld_readable = isset( $prop[
'readable'] );
215 $this->fld_preload = isset( $prop[
'preload'] );
216 $this->fld_preloadcontent = isset( $prop[
'preloadcontent'] );
217 $this->fld_editintro = isset( $prop[
'editintro'] );
218 $this->fld_displaytitle = isset( $prop[
'displaytitle'] );
219 $this->fld_varianttitles = isset( $prop[
'varianttitles'] );
220 $this->fld_linkclasses = isset( $prop[
'linkclasses'] );
221 $this->fld_associatedpage = isset( $prop[
'associatedpage'] );
225 $this->titles = $pageSet->getGoodPages();
226 $this->missing = $pageSet->getMissingPages();
227 $this->everything = $this->titles + $this->missing;
231 ( $this->fld_preloadcontent || $this->fld_editintro ) &&
232 ( count( $this->everything ) > 1 || count( $this->
getPageSet()->getRevisionIDs() ) > 1 )
237 [
'apierror-info-singlepagerevision', $this->
getModulePrefix() ],
'invalidparammix'
241 uasort( $this->everything, Title::compare( ... ) );
242 if ( $this->params[
'continue'] !==
null ) {
246 $conttitle = $this->titleFactory->makeTitleSafe( $cont[0], $cont[1] );
248 foreach ( $this->everything as $pageid => $page ) {
249 if ( Title::compare( $page, $conttitle ) >= 0 ) {
252 unset( $this->titles[$pageid] );
253 unset( $this->missing[$pageid] );
254 unset( $this->everything[$pageid] );
259 $this->pageIsRedir = !$pageSet->isResolvingRedirects()
260 ? $pageSet->getCustomField(
'page_is_redirect' )
262 $this->pageIsNew = $pageSet->getCustomField(
'page_is_new' );
264 $this->pageTouched = $pageSet->getCustomField(
'page_touched' );
265 $this->pageLatest = $pageSet->getCustomField(
'page_latest' );
266 $this->pageLength = $pageSet->getCustomField(
'page_len' );
269 if ( $this->fld_protection ) {
270 $this->getProtectionInfo();
273 if ( $this->fld_watched || $this->fld_watchlistlabels || $this->fld_notificationtimestamp ) {
274 $this->getWatchedInfo();
277 if ( $this->fld_watchers ) {
278 $this->getWatcherInfo();
281 if ( $this->fld_visitingwatchers ) {
282 $this->getVisitingWatcherInfo();
286 if ( $this->fld_talkid || $this->fld_subjectid ) {
290 if ( $this->fld_displaytitle ) {
291 $this->getDisplayTitle();
294 if ( $this->fld_varianttitles ) {
295 $this->getVariantTitles();
298 if ( $this->fld_linkclasses ) {
299 $this->getLinkClasses( $this->params[
'linkcontext'], $this->params[
'defaultlinkcaption'] );
303 foreach ( $this->everything as $pageid => $page ) {
304 $pageInfo = $this->extractPageInfo( $pageid, $page );
305 $fit = $pageInfo !==
null && $result->addValue( [
308 ], $pageid, $pageInfo );
311 $page->getNamespace() .
'|' .
312 $this->titleFormatter->getText( $page ) );
324 private function extractPageInfo( $pageid, $page ) {
325 $title = $this->titleFactory->newFromPageIdentity( $page );
328 $pageExists = $pageid > 0;
329 $ns = $page->getNamespace();
330 $dbkey = $page->getDBkey();
332 $pageInfo[
'contentmodel'] = $title->getContentModel();
334 $pageLanguage = $title->getPageLanguage();
335 $pageInfo[
'pagelanguage'] = $pageLanguage->getCode();
336 $pageInfo[
'pagelanguagehtmlcode'] = $pageLanguage->getHtmlCode();
337 $pageInfo[
'pagelanguagedir'] = $pageLanguage->getDir();
340 $pageInfo[
'touched'] =
wfTimestamp( TS::ISO_8601, $this->pageTouched[$pageid] );
341 $pageInfo[
'lastrevid'] = (int)$this->pageLatest[$pageid];
342 $pageInfo[
'length'] = (int)$this->pageLength[$pageid];
344 if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
345 $pageInfo[
'redirect'] =
true;
347 if ( $this->pageIsNew[$pageid] ) {
348 $pageInfo[
'new'] =
true;
352 if ( $this->fld_protection ) {
353 $pageInfo[
'protection'] = [];
354 if ( isset( $this->protections[$ns][$dbkey] ) ) {
355 $pageInfo[
'protection'] =
356 $this->protections[$ns][$dbkey];
360 $pageInfo[
'restrictiontypes'] = [];
361 if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
362 $pageInfo[
'restrictiontypes'] =
363 $this->restrictionTypes[$ns][$dbkey];
368 if ( $this->fld_watched ) {
369 $pageInfo[
'watched'] =
false;
371 if ( isset( $this->watched[$ns][$dbkey] ) ) {
372 $pageInfo[
'watched'] = $this->watched[$ns][$dbkey];
375 if ( isset( $this->watchlistExpiries[$ns][$dbkey] ) ) {
376 $pageInfo[
'watchlistexpiry'] = $this->watchlistExpiries[$ns][$dbkey];
380 if ( $this->fld_watchlistlabels ) {
381 $pageInfo[
'watchlistlabels'] = [];
382 if ( isset( $this->watchlistLabels[$ns][$dbkey] ) ) {
383 $pageInfo[
'watchlistlabels'] = $this->watchlistLabels[$ns][$dbkey];
388 if ( $this->fld_watchers ) {
389 if ( $this->watchers !==
null && $this->watchers[$ns][$dbkey] !== 0 ) {
390 $pageInfo[
'watchers'] = $this->watchers[$ns][$dbkey];
391 } elseif ( $this->showZeroWatchers ) {
392 $pageInfo[
'watchers'] = 0;
396 if ( $this->fld_visitingwatchers ) {
397 if ( $this->visitingwatchers !==
null && $this->visitingwatchers[$ns][$dbkey] !== 0 ) {
398 $pageInfo[
'visitingwatchers'] = $this->visitingwatchers[$ns][$dbkey];
399 } elseif ( $this->showZeroWatchers ) {
400 $pageInfo[
'visitingwatchers'] = 0;
404 if ( $this->fld_notificationtimestamp ) {
405 $pageInfo[
'notificationtimestamp'] =
'';
406 if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
407 $pageInfo[
'notificationtimestamp'] =
408 wfTimestamp( TS::ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
412 if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
413 $pageInfo[
'talkid'] = $this->talkids[$ns][$dbkey];
416 if ( $this->fld_subjectid && isset( $this->subjectids[$ns][$dbkey] ) ) {
417 $pageInfo[
'subjectid'] = $this->subjectids[$ns][$dbkey];
420 if ( $this->fld_associatedpage && $ns >=
NS_MAIN ) {
421 $pageInfo[
'associatedpage'] = $this->titleFormatter->getPrefixedText(
422 $this->namespaceInfo->getAssociatedPage( TitleValue::newFromPage( $page ) )
426 if ( $this->fld_url ) {
427 $pageInfo[
'fullurl'] = (string)$this->urlUtils->expand(
430 $pageInfo[
'editurl'] = (string)$this->urlUtils->expand(
433 $pageInfo[
'canonicalurl'] = (string)$this->urlUtils->expand(
437 if ( $this->fld_readable ) {
438 $pageInfo[
'readable'] = $this->
getAuthority()->definitelyCan(
'read', $page );
441 if ( $this->fld_preload ) {
443 $pageInfo[
'preload'] =
'';
447 $this->
getHookRunner()->onEditFormPreloadText( $text, $title );
449 $pageInfo[
'preload'] = $text;
453 if ( $this->fld_preloadcontent ) {
454 $newSection = $this->params[
'preloadnewsection'];
457 if ( !$pageExists || $newSection ) {
458 $content = $this->preloadedContentBuilder->getPreloadedContent(
459 $title->toPageIdentity(),
460 $this->getAuthority(),
461 $this->params[
'preloadcustom'],
462 $this->params[
'preloadparams'] ?? [],
463 $newSection ?
'new' : null
465 $defaultContent = $newSection ? null :
466 $this->preloadedContentBuilder->getDefaultContent( $title->toPageIdentity() );
467 $contentIsDefault = $defaultContent ? $content->equals( $defaultContent ) : $content->isEmpty();
470 $pageInfo[
'preloadcontent'][
'contentmodel'] = $content->getModel();
471 $pageInfo[
'preloadcontent'][
'contentformat'] = $content->getDefaultFormat();
476 $pageInfo[
'preloadisdefault'] = $contentIsDefault;
480 if ( $this->fld_editintro ) {
482 $localizerWithPage =
new class( $this, $page ) implements MessageLocalizer {
483 private MessageLocalizer $base;
484 private PageReference $page;
486 public function __construct( MessageLocalizer $base, PageReference $page ) {
494 public function msg( $key, ...$params ) {
495 return $this->base->msg( $key, ...$params )->page( $this->page );
500 'lessframes' => IntroMessageBuilder::LESS_FRAMES,
501 'moreframes' => IntroMessageBuilder::MORE_FRAMES,
504 $revId = array_key_first( $this->
getPageSet()->getLiveRevisionIDs() );
505 $revRecord = $revId ? $this->revisionLookup->getRevisionById( $revId ) :
null;
507 $messages = $this->introMessageBuilder->getIntroMessages(
508 $styleParamMap[ $this->params[
'editintrostyle'] ],
509 $this->params[
'editintroskip'] ?? [],
511 $title->toPageIdentity(),
513 $this->getAuthority(),
514 $this->params[
'editintrocustom'],
522 $pageInfo[
'editintro'] = $messages;
525 if ( $this->fld_displaytitle ) {
526 $pageInfo[
'displaytitle'] = $this->displaytitles[$pageid] ??
527 htmlspecialchars( $this->titleFormatter->getPrefixedText( $page ), ENT_NOQUOTES );
530 if ( $this->fld_varianttitles && isset( $this->variantTitles[$pageid] ) ) {
531 $pageInfo[
'varianttitles'] = $this->variantTitles[$pageid];
534 if ( $this->fld_linkclasses && isset( $this->linkClasses[$pageid] ) ) {
535 $pageInfo[
'linkclasses'] = $this->linkClasses[$pageid];
538 if ( $this->params[
'testactions'] ) {
540 if ( $this->countTestedActions >= $limit ) {
544 $detailLevel = $this->params[
'testactionsdetail'];
546 if ( $errorFormatter->getFormat() ===
'bc' ) {
548 $errorFormatter = $errorFormatter->newWithFormat(
'plaintext' );
551 $pageInfo[
'actions'] = [];
552 if ( $this->params[
'testactionsautocreate'] ) {
553 $pageInfo[
'wouldautocreate'] = [];
556 foreach ( $this->params[
'testactions'] as $action ) {
557 $this->countTestedActions++;
559 $shouldAutoCreate = $this->tempUserCreator->shouldAutoCreate( $this->
getUser(), $action );
561 if ( $shouldAutoCreate ) {
562 $authority = $this->userFactory->newTempPlaceholder();
567 if ( $detailLevel ===
'boolean' ) {
568 $pageInfo[
'actions'][$action] = $authority->definitelyCan( $action, $page );
570 $status =
new PermissionStatus();
571 if ( $detailLevel ===
'quick' ) {
572 $authority->probablyCan( $action, $page, $status );
574 $authority->definitelyCan( $action, $page, $status );
577 $pageInfo[
'actions'][$action] = $errorFormatter->arrayFromStatus( $status );
580 if ( $this->params[
'testactionsautocreate'] ) {
581 $pageInfo[
'wouldautocreate'][$action] = $shouldAutoCreate;
592 private function getProtectionInfo() {
593 $this->protections = [];
596 if ( count( $this->titles ) ) {
599 $this->
addFields( [
'pr_page',
'pr_type',
'pr_level',
600 'pr_expiry',
'pr_cascade' ] );
601 $this->
addWhereFld(
'pr_page', array_keys( $this->titles ) );
603 $res = $this->
select( __METHOD__ );
604 foreach ( $res as $row ) {
606 $page = $this->titles[$row->pr_page];
608 'type' => $row->pr_type,
609 'level' => $row->pr_level,
612 if ( $row->pr_cascade ) {
613 $a[
'cascade'] =
true;
615 $this->protections[$page->getNamespace()][$page->getDBkey()][] = $a;
620 if ( count( $this->missing ) ) {
622 $lb = $this->linkBatchFactory->newLinkBatch( $this->missing );
624 $this->
addFields( [
'pt_title',
'pt_namespace',
'pt_create_perm',
'pt_expiry' ] );
625 $this->
addWhere( $lb->constructSet(
'pt', $this->getDB() ) );
626 $res = $this->
select( __METHOD__ );
627 foreach ( $res as $row ) {
628 $this->protections[$row->pt_namespace][$row->pt_title][] = [
630 'level' => $row->pt_create_perm,
638 $images = $others = [];
639 foreach ( $this->everything as $page ) {
640 if ( $page->getNamespace() ===
NS_FILE ) {
641 $images[] = $page->getDBkey();
646 $this->restrictionTypes[$page->getNamespace()][$page->getDBkey()] =
647 array_values( $this->restrictionStore->listApplicableRestrictionTypes( $page ) );
650 if ( count( $others ) ) {
652 $this->
addTables( [
'page_restrictions',
'page' ] );
653 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
654 'page_title',
'page_namespace',
'page_id' ] );
655 $this->
addWhere(
'pr_page = page_id' );
658 $res = $this->
select( __METHOD__ );
660 $protectedPages = [];
661 foreach ( $res as $row ) {
662 $protectedPages[$row->page_id] = [
663 'type' => $row->pr_type,
664 'level' => $row->pr_level,
666 'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
670 if ( $protectedPages ) {
673 $lb = $this->linkBatchFactory->newLinkBatch( $others );
675 $queryInfo = $this->linksMigration->getQueryInfo(
'templatelinks' );
676 $res = $this->
getDB()->newSelectQueryBuilder()
677 ->select( [
'tl_from',
'lt_namespace',
'lt_title' ] )
678 ->tables( $queryInfo[
'tables'] )
679 ->joinConds( $queryInfo[
'joins'] )
680 ->where( [
'tl_from' => array_keys( $protectedPages ) ] )
681 ->andWhere( $lb->constructSet(
'tl', $this->getDB() ) )
682 ->useIndex( [
'templatelinks' =>
'PRIMARY' ] )
683 ->caller( __METHOD__ )
686 foreach ( $res as $row ) {
687 $protection = $protectedPages[$row->tl_from];
688 $this->protections[$row->lt_namespace][$row->lt_title][] = $protection;
695 if ( count( $images ) ) {
697 $this->
addTables( [
'page_restrictions',
'page' ] );
698 $this->
addFields( [
'pr_type',
'pr_level',
'pr_expiry',
699 'page_title',
'page_namespace',
'page_id' ] );
700 $this->
addWhere(
'pr_page = page_id' );
703 $res = $this->
select( __METHOD__ );
705 $protectedPages = [];
706 foreach ( $res as $row ) {
707 $protectedPages[$row->page_id] = [
708 'type' => $row->pr_type,
709 'level' => $row->pr_level,
711 'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
715 if ( $protectedPages ) {
718 $queryInfo = $this->linksMigration->getQueryInfo(
'imagelinks' );
720 $res = $this->
getDB()->newSelectQueryBuilder()
721 ->fields( [
'il_from',
'lt_title' ] )
722 ->tables( $queryInfo[
'tables'] )
723 ->where( [
'il_from' => array_keys( $protectedPages ) ] )
724 ->joinConds( $queryInfo[
'joins'] )
725 ->andWhere( [
'lt_title' => $images,
'lt_namespace' =>
NS_FILE ] )
726 ->caller( __METHOD__ )
729 foreach ( $res as $row ) {
730 $protection = $protectedPages[$row->il_from];
731 $this->protections[
NS_FILE][$row->lt_title][] = $protection;
743 private function getTSIDs() {
744 $getTitles = $this->talkids = $this->subjectids = [];
745 $nsInfo = $this->namespaceInfo;
748 foreach ( $this->everything as $page ) {
749 if ( $nsInfo->isTalk( $page->getNamespace() ) ) {
750 if ( $this->fld_subjectid ) {
751 $getTitles[] = $nsInfo->getSubjectPage( TitleValue::newFromPage( $page ) );
753 } elseif ( $this->fld_talkid ) {
754 $getTitles[] = $nsInfo->getTalkPage( TitleValue::newFromPage( $page ) );
757 if ( $getTitles === [] ) {
761 $db = $this->
getDB();
765 $lb = $this->linkBatchFactory->newLinkBatch( $getTitles );
768 $this->
addFields( [
'page_title',
'page_namespace',
'page_id' ] );
769 $this->
addWhere( $lb->constructSet(
'page', $db ) );
770 $res = $this->
select( __METHOD__ );
771 foreach ( $res as $row ) {
772 if ( $nsInfo->isTalk( $row->page_namespace ) ) {
773 $this->talkids[$nsInfo->getSubject( $row->page_namespace )][$row->page_title] =
774 (int)( $row->page_id );
776 $this->subjectids[$nsInfo->getTalk( $row->page_namespace )][$row->page_title] =
777 (int)( $row->page_id );
782 private function getDisplayTitle() {
783 $this->displaytitles = [];
785 $pageIds = array_keys( $this->titles );
787 if ( $pageIds === [] ) {
793 $this->
addFields( [
'pp_page',
'pp_value' ] );
795 $this->
addWhereFld(
'pp_propname',
'displaytitle' );
796 $res = $this->
select( __METHOD__ );
798 foreach ( $res as $row ) {
799 $this->displaytitles[$row->pp_page] = $row->pp_value;
813 private function getLinkClasses( ?LinkTarget $context_title =
null,
bool $default_link_caption =
false ) {
814 if ( $this->titles === [] ) {
825 foreach ( $this->titles as $pageId => $page ) {
826 $pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
827 $pagemap[$pageId] = $pdbk;
828 $classes[$pdbk] = $this->linkRenderer->getLinkClasses( $page, $default_link_caption );
831 $context_title = $this->titleFactory->newFromLinkTarget(
832 $context_title ?? $this->titleFactory->newMainPage()
835 $pagemap, $classes, $context_title
842 $this->linkClasses = [];
843 foreach ( $this->titles as $pageId => $page ) {
844 $pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
845 $this->linkClasses[$pageId] = preg_split(
846 '/\s+/', $classes[$pdbk] ??
'', -1, PREG_SPLIT_NO_EMPTY
851 private function getVariantTitles() {
852 if ( $this->titles === [] ) {
855 $this->variantTitles = [];
856 foreach ( $this->titles as $pageId => $page ) {
857 $this->variantTitles[$pageId] = isset( $this->displaytitles[$pageId] )
858 ? $this->getAllVariants( $this->displaytitles[$pageId] )
859 : $this->getAllVariants( $this->titleFormatter->getText( $page ), $page->getNamespace() );
863 private function getAllVariants(
string $text,
int $ns =
NS_MAIN ): array {
865 foreach ( $this->languageConverter->getVariants() as $variant ) {
866 $convertTitle = $this->languageConverter->autoConvert( $text, $variant );
868 $convertNs = $this->languageConverter->convertNamespace( $ns, $variant );
869 $convertTitle = $convertNs .
':' . $convertTitle;
871 $result[$variant] = $convertTitle;
880 private function getWatchedInfo() {
883 if ( !$user->isRegistered() || count( $this->everything ) == 0
884 || !$this->
getAuthority()->isAllowed(
'viewmywatchlist' )
890 $this->watchlistExpiries = [];
891 $this->watchlistLabels = [];
892 $this->notificationtimestamps = [];
894 $items = $this->watchedItemStore->loadWatchedItemsBatch( $user, $this->everything );
896 foreach ( $items as $item ) {
897 $nsId = $item->getTarget()->getNamespace();
898 $dbKey = $item->getTarget()->getDBkey();
900 if ( $this->fld_watched ) {
901 $this->watched[$nsId][$dbKey] =
true;
903 $expiry = $item->getExpiry( TS::ISO_8601 );
905 $this->watchlistExpiries[$nsId][$dbKey] = $expiry;
909 if ( $this->fld_watchlistlabels ) {
910 $labels = $item->getLabels();
913 foreach ( $labels as $label ) {
915 'id' => $label->getId(),
916 'name' => $label->getName(),
919 $this->watchlistLabels[$nsId][$dbKey] = $labelData;
923 if ( $this->fld_notificationtimestamp ) {
924 $this->notificationtimestamps[$nsId][$dbKey] = $item->getNotificationTimestamp();
932 private function getWatcherInfo() {
933 if ( count( $this->everything ) == 0 ) {
937 $canUnwatchedpages = $this->
getAuthority()->isAllowed(
'unwatchedpages' );
938 $unwatchedPageThreshold =
940 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
944 $this->showZeroWatchers = $canUnwatchedpages;
947 if ( !$canUnwatchedpages ) {
948 $countOptions[
'minimumWatchers'] = $unwatchedPageThreshold;
951 $this->watchers = $this->watchedItemStore->countWatchersMultiple(
963 private function getVisitingWatcherInfo() {
965 $db = $this->
getDB();
967 $canUnwatchedpages = $this->
getAuthority()->isAllowed(
'unwatchedpages' );
969 if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
973 $this->showZeroWatchers = $canUnwatchedpages;
975 $titlesWithThresholds = [];
976 if ( $this->titles ) {
977 $lb = $this->linkBatchFactory->newLinkBatch( $this->titles );
980 $this->resetQueryParams();
981 $this->
addTables( [
'page',
'revision' ] );
982 $this->
addFields( [
'page_namespace',
'page_title',
'rev_timestamp' ] );
984 'page_latest = rev_id',
985 $lb->constructSet(
'page', $db ),
987 $this->addOption(
'GROUP BY', [
'page_namespace',
'page_title' ] );
988 $timestampRes = $this->select( __METHOD__ );
992 foreach ( $timestampRes as $row ) {
993 $revTimestamp =
wfTimestamp( TS::UNIX, (
int)$row->rev_timestamp );
994 $timestamps[$row->page_namespace][$row->page_title] = (int)$revTimestamp - $age;
996 $titlesWithThresholds = array_map(
997 static function ( PageReference $target ) use ( $timestamps ) {
999 $target, $timestamps[$target->getNamespace()][$target->getDBkey()]
1006 if ( $this->missing ) {
1007 $titlesWithThresholds = array_merge(
1008 $titlesWithThresholds,
1010 static function ( PageReference $target ) {
1011 return [ $target, null ];
1017 $this->visitingwatchers = $this->watchedItemStore->countVisitingWatchersMultiple(
1018 $titlesWithThresholds,
1019 !$canUnwatchedpages ? $unwatchedPageThreshold : null
1036 if ( array_diff( (array)$params[
'prop'], $publicProps ) ) {
1041 if ( $params[
'testactions'] ) {
1052 ParamValidator::PARAM_ISMULTI =>
true,
1053 ParamValidator::PARAM_TYPE => [
1056 'watched', #
private
1057 'watchlistlabels', #
private
1058 'watchers', #
private
1059 'visitingwatchers', #
private
1060 'notificationtimestamp', #
private
1064 'readable', #
private
1066 'preloadcontent', #
private: checks current user
's permissions
1067 'editintro
', # private: checks current user's permissions
1070 'linkclasses', #
private: stub length (and possibly hook colors)
1075 EnumDef::PARAM_DEPRECATED_VALUES => [
1081 ParamValidator::PARAM_TYPE =>
'title',
1082 ParamValidator::PARAM_DEFAULT => $this->titleFactory->newMainPage()->getPrefixedText(),
1083 TitleDef::PARAM_RETURN_OBJECT =>
true,
1085 'defaultlinkcaption' => [
1086 ParamValidator::PARAM_TYPE =>
'boolean',
1087 ParamValidator::PARAM_DEFAULT =>
false,
1090 ParamValidator::PARAM_TYPE =>
'string',
1091 ParamValidator::PARAM_ISMULTI =>
true,
1093 'testactionsdetail' => [
1094 ParamValidator::PARAM_TYPE => [
'boolean',
'full',
'quick' ],
1095 ParamValidator::PARAM_DEFAULT =>
'boolean',
1098 'testactionsautocreate' =>
false,
1099 'preloadcustom' => [
1102 ParamValidator::PARAM_TYPE =>
'string',
1105 'preloadparams' => [
1106 ParamValidator::PARAM_ISMULTI =>
true,
1109 'preloadnewsection' => [
1110 ParamValidator::PARAM_TYPE =>
'boolean',
1111 ParamValidator::PARAM_DEFAULT =>
false,
1114 'editintrostyle' => [
1115 ParamValidator::PARAM_TYPE => [
'lessframes',
'moreframes' ],
1116 ParamValidator::PARAM_DEFAULT =>
'moreframes',
1119 'editintroskip' => [
1120 ParamValidator::PARAM_TYPE =>
'string',
1121 ParamValidator::PARAM_ISMULTI =>
true,
1124 'editintrocustom' => [
1127 ParamValidator::PARAM_TYPE =>
'string',
1138 $title = Title::newMainPage()->getPrefixedText();
1139 $mp = rawurlencode( $title );
1142 "action=query&prop=info&titles={$mp}"
1143 =>
'apihelp-query+info-example-simple',
1144 "action=query&prop=info&inprop=protection&titles={$mp}"
1145 =>
'apihelp-query+info-example-protection',
1151 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Info';