a3bd93aa5d50be00cec2c2b2055d711e5a34b2f0
3 * Displays information about a page.
5 * Copyright © 2011 Alexandre Emsenhuber
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 * Displays information about a page.
30 class InfoAction
extends FormlessAction
{
34 * Returns the name of the action this object responds to.
36 * @return string Lowercase name
38 public function getName() {
43 * Whether this action can still be executed by a blocked user.
47 public function requiresUnblock() {
52 * Whether this action requires the wiki not to be locked.
56 public function requiresWrite() {
61 * Clear the info cache for a given Title.
64 * @param Title $title Title to clear cache for
65 * @param int|null $revid Revision id to clear
67 public static function invalidateCache( Title
$title, $revid = null ) {
69 $revision = Revision
::newFromTitle( $title, 0, Revision
::READ_LATEST
);
70 $revid = $revision ?
$revision->getId() : null;
72 if ( $revid !== null ) {
73 $key = self
::getCacheKey( $title, $revid );
74 ObjectCache
::getMainWANInstance()->delete( $key );
79 * Shows page information on GET request.
81 * @return string Page information that will be added to the output
83 public function onView() {
87 $oldid = $this->page
->getOldID();
89 $revision = $this->page
->getRevisionFetched();
91 // Revision is missing
92 if ( $revision === null ) {
93 return $this->msg( 'missing-revision', $oldid )->parse();
96 // Revision is not current
97 if ( !$revision->isCurrent() ) {
98 return $this->msg( 'pageinfo-not-current' )->plain();
103 if ( !$this->msg( 'pageinfo-header' )->isDisabled() ) {
104 $content .= $this->msg( 'pageinfo-header' )->parse();
107 // Hide "This page is a member of # hidden categories" explanation
108 $content .= Html
::element( 'style', array(),
109 '.mw-hiddenCategoriesExplanation { display: none; }' ) . "\n";
111 // Hide "Templates used on this page" explanation
112 $content .= Html
::element( 'style', array(),
113 '.mw-templatesUsedExplanation { display: none; }' ) . "\n";
115 // Get page information
116 $pageInfo = $this->pageInfo();
118 // Allow extensions to add additional information
119 Hooks
::run( 'InfoAction', array( $this->getContext(), &$pageInfo ) );
121 // Render page information
122 foreach ( $pageInfo as $header => $infoTable ) {
124 // pageinfo-header-basic, pageinfo-header-edits, pageinfo-header-restrictions,
125 // pageinfo-header-properties, pageinfo-category-info
126 $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() ) . "\n";
128 foreach ( $infoTable as $infoRow ) {
129 $name = ( $infoRow[0] instanceof Message
) ?
$infoRow[0]->escaped() : $infoRow[0];
130 $value = ( $infoRow[1] instanceof Message
) ?
$infoRow[1]->escaped() : $infoRow[1];
131 $id = ( $infoRow[0] instanceof Message
) ?
$infoRow[0]->getKey() : null;
132 $table = $this->addRow( $table, $name, $value, $id ) . "\n";
134 $content = $this->addTable( $content, $table ) . "\n";
138 if ( !$this->msg( 'pageinfo-footer' )->isDisabled() ) {
139 $content .= $this->msg( 'pageinfo-footer' )->parse();
146 * Creates a header that can be added to the output.
148 * @param string $header The header text.
149 * @return string The HTML.
151 protected function makeHeader( $header ) {
152 $spanAttribs = array( 'class' => 'mw-headline', 'id' => Sanitizer
::escapeId( $header ) );
154 return Html
::rawElement( 'h2', array(), Html
::element( 'span', $spanAttribs, $header ) );
158 * Adds a row to a table that will be added to the content.
160 * @param string $table The table that will be added to the content
161 * @param string $name The name of the row
162 * @param string $value The value of the row
163 * @param string $id The ID to use for the 'tr' element
164 * @return string The table with the row added
166 protected function addRow( $table, $name, $value, $id ) {
170 $id === null ?
array() : array( 'id' => 'mw-' . $id ),
171 Html
::rawElement( 'td', array( 'style' => 'vertical-align: top;' ), $name ) .
172 Html
::rawElement( 'td', array(), $value )
177 * Adds a table to the content that will be added to the output.
179 * @param string $content The content that will be added to the output
180 * @param string $table The table
181 * @return string The content with the table added
183 protected function addTable( $content, $table ) {
184 return $content . Html
::rawElement( 'table', array( 'class' => 'wikitable mw-page-info' ),
189 * Returns page information in an easily-manipulated format. Array keys are used so extensions
190 * may add additional information in arbitrary positions. Array values are arrays with one
191 * element to be rendered as a header, arrays with two elements to be rendered as a table row.
195 protected function pageInfo() {
198 $user = $this->getUser();
199 $lang = $this->getLanguage();
200 $title = $this->getTitle();
201 $id = $title->getArticleID();
202 $config = $this->context
->getConfig();
204 $pageCounts = $this->pageCounts( $this->page
);
206 $pageProperties = array();
207 $props = PageProps
::getInstance()->getProperties( $title );
208 if ( isset( $props[$id] ) ) {
209 $pageProperties = $props[$id];
214 $pageInfo['header-basic'] = array();
217 $displayTitle = $title->getPrefixedText();
218 if ( isset( $pageProperties['displaytitle'] ) ) {
219 $displayTitle = $pageProperties['displaytitle'];
222 $pageInfo['header-basic'][] = array(
223 $this->msg( 'pageinfo-display-title' ), $displayTitle
226 // Is it a redirect? If so, where to?
227 if ( $title->isRedirect() ) {
228 $pageInfo['header-basic'][] = array(
229 $this->msg( 'pageinfo-redirectsto' ),
230 Linker
::link( $this->page
->getRedirectTarget() ) .
231 $this->msg( 'word-separator' )->escaped() .
232 $this->msg( 'parentheses' )->rawParams( Linker
::link(
233 $this->page
->getRedirectTarget(),
234 $this->msg( 'pageinfo-redirectsto-info' )->escaped(),
236 array( 'action' => 'info' )
242 $sortKey = $title->getCategorySortkey();
243 if ( isset( $pageProperties['defaultsort'] ) ) {
244 $sortKey = $pageProperties['defaultsort'];
247 $sortKey = htmlspecialchars( $sortKey );
248 $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-default-sort' ), $sortKey );
250 // Page length (in bytes)
251 $pageInfo['header-basic'][] = array(
252 $this->msg( 'pageinfo-length' ), $lang->formatNum( $title->getLength() )
255 // Page ID (number not localised, as it's a database ID)
256 $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-article-id' ), $id );
258 // Language in which the page content is (supposed to be) written
259 $pageLang = $title->getPageLanguage()->getCode();
261 if ( $config->get( 'PageLanguageUseDB' )
262 && $this->getTitle()->userCan( 'pagelang', $this->getUser() )
264 // Link to Special:PageLanguage with pre-filled page title if user has permissions
265 $titleObj = SpecialPage
::getTitleFor( 'PageLanguage', $title->getPrefixedText() );
266 $langDisp = Linker
::link(
268 $this->msg( 'pageinfo-language' )->escaped()
271 // Display just the message
272 $langDisp = $this->msg( 'pageinfo-language' )->escaped();
275 $pageInfo['header-basic'][] = array( $langDisp,
276 Language
::fetchLanguageName( $pageLang, $lang->getCode() )
277 . ' ' . $this->msg( 'parentheses', $pageLang )->escaped() );
279 // Content model of the page
280 $pageInfo['header-basic'][] = array(
281 $this->msg( 'pageinfo-content-model' ),
282 htmlspecialchars( ContentHandler
::getLocalizedName( $title->getContentModel() ) )
285 // Search engine status
286 $pOutput = new ParserOutput();
287 if ( isset( $pageProperties['noindex'] ) ) {
288 $pOutput->setIndexPolicy( 'noindex' );
290 if ( isset( $pageProperties['index'] ) ) {
291 $pOutput->setIndexPolicy( 'index' );
294 // Use robot policy logic
295 $policy = $this->page
->getRobotPolicy( 'view', $pOutput );
296 $pageInfo['header-basic'][] = array(
297 // Messages: pageinfo-robot-index, pageinfo-robot-noindex
298 $this->msg( 'pageinfo-robot-policy' ),
299 $this->msg( "pageinfo-robot-${policy['index']}" )
302 $unwatchedPageThreshold = $config->get( 'UnwatchedPageThreshold' );
304 $user->isAllowed( 'unwatchedpages' ) ||
305 ( $unwatchedPageThreshold !== false &&
306 $pageCounts['watchers'] >= $unwatchedPageThreshold )
308 // Number of page watchers
309 $pageInfo['header-basic'][] = array(
310 $this->msg( 'pageinfo-watchers' ),
311 $lang->formatNum( $pageCounts['watchers'] )
314 $config->get( 'ShowUpdatedMarker' ) &&
315 isset( $pageCounts['visitingWatchers'] )
317 $minToDisclose = $config->get( 'UnwatchedPageSecret' );
318 if ( $pageCounts['visitingWatchers'] > $minToDisclose ||
319 $user->isAllowed( 'unwatchedpages' ) ) {
320 $pageInfo['header-basic'][] = array(
321 $this->msg( 'pageinfo-visiting-watchers' ),
322 $lang->formatNum( $pageCounts['visitingWatchers'] )
325 $pageInfo['header-basic'][] = array(
326 $this->msg( 'pageinfo-visiting-watchers' ),
327 $this->msg( 'pageinfo-few-visiting-watchers' )
331 } elseif ( $unwatchedPageThreshold !== false ) {
332 $pageInfo['header-basic'][] = array(
333 $this->msg( 'pageinfo-watchers' ),
334 $this->msg( 'pageinfo-few-watchers' )->numParams( $unwatchedPageThreshold )
338 // Redirects to this page
339 $whatLinksHere = SpecialPage
::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
340 $pageInfo['header-basic'][] = array(
343 $this->msg( 'pageinfo-redirects-name' )->escaped(),
348 'hideimages' => $title->getNamespace() == NS_FILE
351 $this->msg( 'pageinfo-redirects-value' )
352 ->numParams( count( $title->getRedirectsHere() ) )
355 // Is it counted as a content page?
356 if ( $this->page
->isCountable() ) {
357 $pageInfo['header-basic'][] = array(
358 $this->msg( 'pageinfo-contentpage' ),
359 $this->msg( 'pageinfo-contentpage-yes' )
363 // Subpages of this page, if subpages are enabled for the current NS
364 if ( MWNamespace
::hasSubpages( $title->getNamespace() ) ) {
365 $prefixIndex = SpecialPage
::getTitleFor(
366 'Prefixindex', $title->getPrefixedText() . '/' );
367 $pageInfo['header-basic'][] = array(
368 Linker
::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ),
369 $this->msg( 'pageinfo-subpages-value' )
371 $pageCounts['subpages']['total'],
372 $pageCounts['subpages']['redirects'],
373 $pageCounts['subpages']['nonredirects'] )
377 if ( $title->inNamespace( NS_CATEGORY
) ) {
378 $category = Category
::newFromTitle( $title );
380 // $allCount is the total number of cat members,
381 // not the count of how many members are normal pages.
382 $allCount = (int)$category->getPageCount();
383 $subcatCount = (int)$category->getSubcatCount();
384 $fileCount = (int)$category->getFileCount();
385 $pagesCount = $allCount - $subcatCount - $fileCount;
387 $pageInfo['category-info'] = array(
389 $this->msg( 'pageinfo-category-total' ),
390 $lang->formatNum( $allCount )
393 $this->msg( 'pageinfo-category-pages' ),
394 $lang->formatNum( $pagesCount )
397 $this->msg( 'pageinfo-category-subcats' ),
398 $lang->formatNum( $subcatCount )
401 $this->msg( 'pageinfo-category-files' ),
402 $lang->formatNum( $fileCount )
408 $pageInfo['header-restrictions'] = array();
410 // Is this page affected by the cascading protection of something which includes it?
411 if ( $title->isCascadeProtected() ) {
413 $sources = $title->getCascadeProtectionSources()[0];
415 foreach ( $sources as $sourceTitle ) {
416 $cascadingFrom .= Html
::rawElement(
417 'li', array(), Linker
::linkKnown( $sourceTitle ) );
420 $cascadingFrom = Html
::rawElement( 'ul', array(), $cascadingFrom );
421 $pageInfo['header-restrictions'][] = array(
422 $this->msg( 'pageinfo-protect-cascading-from' ),
427 // Is out protection set to cascade to other pages?
428 if ( $title->areRestrictionsCascading() ) {
429 $pageInfo['header-restrictions'][] = array(
430 $this->msg( 'pageinfo-protect-cascading' ),
431 $this->msg( 'pageinfo-protect-cascading-yes' )
436 foreach ( $title->getRestrictionTypes() as $restrictionType ) {
437 $protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) );
439 if ( $protectionLevel == '' ) {
441 $message = $this->msg( 'protect-default' )->escaped();
443 // Administrators only
444 // Messages: protect-level-autoconfirmed, protect-level-sysop
445 $message = $this->msg( "protect-level-$protectionLevel" );
446 if ( $message->isDisabled() ) {
447 // Require "$1" permission
448 $message = $this->msg( "protect-fallback", $protectionLevel )->parse();
450 $message = $message->escaped();
453 $expiry = $title->getRestrictionExpiry( $restrictionType );
454 $formattedexpiry = $this->msg( 'parentheses',
455 $this->getLanguage()->formatExpiry( $expiry ) )->escaped();
456 $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry;
458 // Messages: restriction-edit, restriction-move, restriction-create,
459 // restriction-upload
460 $pageInfo['header-restrictions'][] = array(
461 $this->msg( "restriction-$restrictionType" ), $message
465 if ( !$this->page
->exists() ) {
470 $pageInfo['header-edits'] = array();
472 $firstRev = $this->page
->getOldestRevision();
473 $lastRev = $this->page
->getRevision();
474 $batch = new LinkBatch
;
477 $firstRevUser = $firstRev->getUserText( Revision
::FOR_THIS_USER
);
478 if ( $firstRevUser !== '' ) {
479 $batch->add( NS_USER
, $firstRevUser );
480 $batch->add( NS_USER_TALK
, $firstRevUser );
485 $lastRevUser = $lastRev->getUserText( Revision
::FOR_THIS_USER
);
486 if ( $lastRevUser !== '' ) {
487 $batch->add( NS_USER
, $lastRevUser );
488 $batch->add( NS_USER_TALK
, $lastRevUser );
496 $pageInfo['header-edits'][] = array(
497 $this->msg( 'pageinfo-firstuser' ),
498 Linker
::revUserTools( $firstRev )
501 // Date of page creation
502 $pageInfo['header-edits'][] = array(
503 $this->msg( 'pageinfo-firsttime' ),
506 htmlspecialchars( $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ) ),
508 array( 'oldid' => $firstRev->getId() )
515 $pageInfo['header-edits'][] = array(
516 $this->msg( 'pageinfo-lastuser' ),
517 Linker
::revUserTools( $lastRev )
520 // Date of latest edit
521 $pageInfo['header-edits'][] = array(
522 $this->msg( 'pageinfo-lasttime' ),
526 $lang->userTimeAndDate( $this->page
->getTimestamp(), $user )
529 array( 'oldid' => $this->page
->getLatest() )
534 // Total number of edits
535 $pageInfo['header-edits'][] = array(
536 $this->msg( 'pageinfo-edits' ), $lang->formatNum( $pageCounts['edits'] )
539 // Total number of distinct authors
540 if ( $pageCounts['authors'] > 0 ) {
541 $pageInfo['header-edits'][] = array(
542 $this->msg( 'pageinfo-authors' ), $lang->formatNum( $pageCounts['authors'] )
546 // Recent number of edits (within past 30 days)
547 $pageInfo['header-edits'][] = array(
548 $this->msg( 'pageinfo-recent-edits',
549 $lang->formatDuration( $config->get( 'RCMaxAge' ) ) ),
550 $lang->formatNum( $pageCounts['recent_edits'] )
553 // Recent number of distinct authors
554 $pageInfo['header-edits'][] = array(
555 $this->msg( 'pageinfo-recent-authors' ),
556 $lang->formatNum( $pageCounts['recent_authors'] )
559 // Array of MagicWord objects
560 $magicWords = MagicWord
::getDoubleUnderscoreArray();
562 // Array of magic word IDs
563 $wordIDs = $magicWords->names
;
565 // Array of IDs => localized magic words
566 $localizedWords = $wgContLang->getMagicWords();
568 $listItems = array();
569 foreach ( $pageProperties as $property => $value ) {
570 if ( in_array( $property, $wordIDs ) ) {
571 $listItems[] = Html
::element( 'li', array(), $localizedWords[$property][1] );
575 $localizedList = Html
::rawElement( 'ul', array(), implode( '', $listItems ) );
576 $hiddenCategories = $this->page
->getHiddenCategories();
579 count( $listItems ) > 0 ||
580 count( $hiddenCategories ) > 0 ||
581 $pageCounts['transclusion']['from'] > 0 ||
582 $pageCounts['transclusion']['to'] > 0
584 $options = array( 'LIMIT' => $config->get( 'PageInfoTransclusionLimit' ) );
585 $transcludedTemplates = $title->getTemplateLinksFrom( $options );
586 if ( $config->get( 'MiserMode' ) ) {
587 $transcludedTargets = array();
589 $transcludedTargets = $title->getTemplateLinksTo( $options );
593 $pageInfo['header-properties'] = array();
596 if ( count( $listItems ) > 0 ) {
597 $pageInfo['header-properties'][] = array(
598 $this->msg( 'pageinfo-magic-words' )->numParams( count( $listItems ) ),
604 if ( count( $hiddenCategories ) > 0 ) {
605 $pageInfo['header-properties'][] = array(
606 $this->msg( 'pageinfo-hidden-categories' )
607 ->numParams( count( $hiddenCategories ) ),
608 Linker
::formatHiddenCategories( $hiddenCategories )
612 // Transcluded templates
613 if ( $pageCounts['transclusion']['from'] > 0 ) {
614 if ( $pageCounts['transclusion']['from'] > count( $transcludedTemplates ) ) {
615 $more = $this->msg( 'morenotlisted' )->escaped();
620 $pageInfo['header-properties'][] = array(
621 $this->msg( 'pageinfo-templates' )
622 ->numParams( $pageCounts['transclusion']['from'] ),
623 Linker
::formatTemplates(
624 $transcludedTemplates,
631 if ( !$config->get( 'MiserMode' ) && $pageCounts['transclusion']['to'] > 0 ) {
632 if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) {
633 $more = Linker
::link(
635 $this->msg( 'moredotdotdot' )->escaped(),
637 array( 'hidelinks' => 1, 'hideredirs' => 1 )
643 $pageInfo['header-properties'][] = array(
644 $this->msg( 'pageinfo-transclusions' )
645 ->numParams( $pageCounts['transclusion']['to'] ),
646 Linker
::formatTemplates(
659 * Returns page counts that would be too "expensive" to retrieve by normal means.
661 * @param WikiPage|Article|Page $page
664 protected function pageCounts( Page
$page ) {
666 $config = $this->context
->getConfig();
668 return ObjectCache
::getMainWANInstance()->getWithSetCallback(
669 self
::getCacheKey( $page->getTitle(), $page->getLatest() ),
671 function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
672 $title = $page->getTitle();
673 $id = $title->getArticleID();
675 $dbr = wfGetDB( DB_SLAVE
);
676 $dbrWatchlist = wfGetDB( DB_SLAVE
, 'watchlist' );
678 $setOpts +
= Database
::getCacheSetOptions( $dbr, $dbrWatchlist );
682 // Number of page watchers
683 $watchers = (int)$dbrWatchlist->selectField(
687 'wl_namespace' => $title->getNamespace(),
688 'wl_title' => $title->getDBkey(),
692 $result['watchers'] = $watchers;
694 if ( $config->get( 'ShowUpdatedMarker' ) ) {
695 // Threshold: last visited about 26 weeks before latest edit
696 $updated = wfTimestamp( TS_UNIX
, $page->getTimestamp() );
697 $age = $config->get( 'WatchersMaxAge' );
698 $threshold = $dbrWatchlist->timestamp( $updated - $age );
699 // Number of page watchers who also visited a "recent" edit
700 $visitingWatchers = (int)$dbrWatchlist->selectField(
704 'wl_namespace' => $title->getNamespace(),
705 'wl_title' => $title->getDBkey(),
706 'wl_notificationtimestamp >= ' .
707 $dbrWatchlist->addQuotes( $threshold ) .
708 ' OR wl_notificationtimestamp IS NULL'
712 $result['visitingWatchers'] = $visitingWatchers;
715 // Total number of edits
716 $edits = (int)$dbr->selectField(
719 array( 'rev_page' => $id ),
722 $result['edits'] = $edits;
724 // Total number of distinct authors
725 if ( $config->get( 'MiserMode' ) ) {
726 $result['authors'] = 0;
728 $result['authors'] = (int)$dbr->selectField(
730 'COUNT(DISTINCT rev_user_text)',
731 array( 'rev_page' => $id ),
736 // "Recent" threshold defined by RCMaxAge setting
737 $threshold = $dbr->timestamp( time() - $config->get( 'RCMaxAge' ) );
739 // Recent number of edits
740 $edits = (int)$dbr->selectField(
745 "rev_timestamp >= " . $dbr->addQuotes( $threshold )
749 $result['recent_edits'] = $edits;
751 // Recent number of distinct authors
752 $result['recent_authors'] = (int)$dbr->selectField(
754 'COUNT(DISTINCT rev_user_text)',
757 "rev_timestamp >= " . $dbr->addQuotes( $threshold )
762 // Subpages (if enabled)
763 if ( MWNamespace
::hasSubpages( $title->getNamespace() ) ) {
764 $conds = array( 'page_namespace' => $title->getNamespace() );
765 $conds[] = 'page_title ' .
766 $dbr->buildLike( $title->getDBkey() . '/', $dbr->anyString() );
768 // Subpages of this page (redirects)
769 $conds['page_is_redirect'] = 1;
770 $result['subpages']['redirects'] = (int)$dbr->selectField(
777 // Subpages of this page (non-redirects)
778 $conds['page_is_redirect'] = 0;
779 $result['subpages']['nonredirects'] = (int)$dbr->selectField(
786 // Subpages of this page (total)
787 $result['subpages']['total'] = $result['subpages']['redirects']
788 +
$result['subpages']['nonredirects'];
791 // Counts for the number of transclusion links (to/from)
792 if ( $config->get( 'MiserMode' ) ) {
793 $result['transclusion']['to'] = 0;
795 $result['transclusion']['to'] = (int)$dbr->selectField(
799 'tl_namespace' => $title->getNamespace(),
800 'tl_title' => $title->getDBkey()
806 $result['transclusion']['from'] = (int)$dbr->selectField(
809 array( 'tl_from' => $title->getArticleID() ),
819 * Returns the name that goes in the "<h1>" page title.
823 protected function getPageTitle() {
824 return $this->msg( 'pageinfo-title', $this->getTitle()->getPrefixedText() )->text();
828 * Get a list of contributors of $article
829 * @return string Html
831 protected function getContributors() {
832 $contributors = $this->page
->getContributors();
833 $real_names = array();
834 $user_names = array();
837 # Sift for real versus user names
838 /** @var $user User */
839 foreach ( $contributors as $user ) {
840 $page = $user->isAnon()
841 ? SpecialPage
::getTitleFor( 'Contributions', $user->getName() )
842 : $user->getUserPage();
844 $hiddenPrefs = $this->context
->getConfig()->get( 'HiddenPrefs' );
845 if ( $user->getID() == 0 ) {
846 $anon_ips[] = Linker
::link( $page, htmlspecialchars( $user->getName() ) );
847 } elseif ( !in_array( 'realname', $hiddenPrefs ) && $user->getRealName() ) {
848 $real_names[] = Linker
::link( $page, htmlspecialchars( $user->getRealName() ) );
850 $user_names[] = Linker
::link( $page, htmlspecialchars( $user->getName() ) );
854 $lang = $this->getLanguage();
856 $real = $lang->listToText( $real_names );
858 # "ThisSite user(s) A, B and C"
859 if ( count( $user_names ) ) {
860 $user = $this->msg( 'siteusers' )
861 ->rawParams( $lang->listToText( $user_names ) )
862 ->params( count( $user_names ) )->escaped();
867 if ( count( $anon_ips ) ) {
868 $anon = $this->msg( 'anonusers' )
869 ->rawParams( $lang->listToText( $anon_ips ) )
870 ->params( count( $anon_ips ) )->escaped();
875 # This is the big list, all mooshed together. We sift for blank strings
877 foreach ( array( $real, $user, $anon ) as $s ) {
879 array_push( $fulllist, $s );
883 $count = count( $fulllist );
885 # "Based on work by ..."
887 ?
$this->msg( 'othercontribs' )->rawParams(
888 $lang->listToText( $fulllist ) )->params( $count )->escaped()
893 * Returns the description that goes below the "<h1>" tag.
897 protected function getDescription() {
902 * @param Title $title
906 protected static function getCacheKey( Title
$title, $revId ) {
907 return wfMemcKey( 'infoaction', md5( $title->getPrefixedText() ), $revId, self
::VERSION
);