* (bug 39957) Added $wgUnwatchedPageThreshold, specifying minimum count
of page watchers required for the number to be accessible to users
without the unwatchedpages permission.
+* $wgPageInfoTransclusionLimit limits the list size of transcluded articles
+ on the info action. Default is 50.
=== New features in 1.21 ===
* (bug 38110) Schema changes (adding or dropping tables, indicies and
*/
$wgDisableCounters = false;
+/**
+ * InfoAction retrieves a list of transclusion links (both to and from).
+ * This number puts a limit on that query in the case of highly transcluded
+ * templates.
+ */
+$wgPageInfoTransclusionLimit = 50;
+
/**
* Set this to an integer to only do synchronous site_stats updates
* one every *this many* updates. The other requests go into pending
/**
* Returns HTML for the "templates used on this page" list.
*
+ * Make an HTML list of templates, and then add a "More..." link at
+ * the bottom. If $more is null, do not add a "More..." link. If $more
+ * is a Title, make a link to that title and use it. If $more is a string,
+ * directly paste it in as the link.
+ *
* @param $templates Array of templates from Article::getUsedTemplate
* or similar
- * @param $preview Boolean: whether this is for a preview
- * @param $section Boolean: whether this is for a section edit
+ * @param bool $preview Whether this is for a preview
+ * @param bool $section Whether this is for a section edit
+ * @param Title|string|null $more A link for "More..." of the templates
* @return String: HTML output
*/
- public static function formatTemplates( $templates, $preview = false, $section = false ) {
+ public static function formatTemplates( $templates, $preview = false, $section = false, $more = null ) {
wfProfileIn( __METHOD__ );
$outText = '';
. wfMessage( 'word-separator' )->escaped()
. $protected . '</li>';
}
+
+ if ( $more instanceof Title ) {
+ $outText .= '<li>' . self::link( $more, wfMessage( 'moredotdotdot' ) ) . '</li>';
+ } elseif ( $more ) {
+ $outText .= "<li>$more</li>";
+ }
+
$outText .= '</ul>';
}
wfProfileOut( __METHOD__ );
* @return array
*/
protected function pageInfo() {
- global $wgContLang, $wgRCMaxAge, $wgMemc, $wgUnwatchedPageThreshold;
+ global $wgContLang, $wgRCMaxAge, $wgMemc, $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
$user = $this->getUser();
$lang = $this->getLanguage();
$localizedList = Html::rawElement( 'ul', array(), implode( '', $listItems ) );
$hiddenCategories = $this->page->getHiddenCategories();
- $transcludedTemplates = $title->getTemplateLinksFrom();
- if ( count( $listItems ) > 0
- || count( $hiddenCategories ) > 0
- || count( $transcludedTemplates ) > 0 ) {
+ if (
+ count( $listItems ) > 0 ||
+ count( $hiddenCategories ) > 0 ||
+ $pageCounts['transclusion']['from'] > 0 ||
+ $pageCounts['transclusion']['to'] > 0
+ ) {
+ $options = array( 'LIMIT' => $wgPageInfoTransclusionLimit );
+ $transcludedTemplates = $title->getTemplateLinksFrom( $options );
+ $transcludedTargets = $title->getTemplateLinksTo( $options );
+
// Page properties
$pageInfo['header-properties'] = array();
}
// Transcluded templates
- if ( count( $transcludedTemplates ) > 0 ) {
+ if ( $pageCounts['transclusion']['from'] > 0 ) {
+ if ( $pageCounts['transclusion']['from'] > count( $transcludedTemplates ) ) {
+ $more = $this->msg( 'morenotlisted' )->escaped();
+ } else {
+ $more = null;
+ }
+
$pageInfo['header-properties'][] = array(
$this->msg( 'pageinfo-templates' )
- ->numParams( count( $transcludedTemplates ) ),
- Linker::formatTemplates( $transcludedTemplates )
+ ->numParams( $pageCounts['transclusion']['from'] ),
+ Linker::formatTemplates(
+ $transcludedTemplates,
+ false,
+ false,
+ $more )
+ );
+ }
+
+ if ( $pageCounts['transclusion']['to'] > 0 ) {
+ if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) {
+ $more = Linker::link(
+ $whatLinksHere,
+ $this->msg( 'moredotdotdot' )->escaped(),
+ array(),
+ array( 'hidelinks' => 1, 'hideredirs' => 1 )
+ );
+ } else {
+ $more = null;
+ }
+
+ $pageInfo['header-properties'][] = array(
+ $this->msg( 'pageinfo-transclusions' )
+ ->numParams( $pageCounts['transclusion']['to'] ),
+ Linker::formatTemplates(
+ $transcludedTargets,
+ false,
+ false,
+ $more )
);
}
}
+ $result['subpages']['nonredirects'];
}
+ // Counts for the number of transclusion links (to/from)
+ $result['transclusion']['to'] = (int) $dbr->selectField(
+ 'templatelinks',
+ 'COUNT(tl_from)',
+ array(
+ 'tl_namespace' => $title->getNamespace(),
+ 'tl_title' => $title->getDBkey()
+ ),
+ __METHOD__
+ );
+
+ $result['transclusion']['from'] = (int) $dbr->selectField(
+ 'templatelinks',
+ 'COUNT(*)',
+ array( 'tl_from' => $title->getArticleID() ),
+ __METHOD__
+ );
+
wfProfileOut( __METHOD__ );
return $result;
}
'moredotdotdot' => 'More...',
'mypage' => 'Page',
'mytalk' => 'Talk',
+'morenotlisted' => 'More not listed...',
'anontalk' => 'Talk for this IP address',
'navigation' => 'Navigation',
'and' => ' and',
'pageinfo-hidden-categories' => 'Hidden {{PLURAL:$1|category|categories}} ($1)',
'pageinfo-templates' => 'Transcluded {{PLURAL:$1|template|templates}} ($1)',
'pageinfo-footer' => '-', # do not translate or duplicate this message to other languages
+'pageinfo-transclusions' => '{{PLURAL:$1|Page|Pages}} transcluded on ($1)',
'pageinfo-toolboxlink' => 'Page information',
'pageinfo-redirectsto' => 'Redirects to',
'pageinfo-redirectsto-info' => 'info',
* {{msg-mw|Anontalk}}
* {{msg-mw|Accesskey-pt-anontalk}}
* {{msg-mw|Tooltip-pt-anontalk}}',
+'morenotlisted' => 'An indication that more of a certain list is not shown.',
'navigation' => 'This is shown as a section header in the sidebar of most skins.
{{Identical|Navigation}}',
* $1 is the number of hidden categories on the page.',
'pageinfo-templates' => 'The list of templates transcluded within the page. Parameters:
* $1 is the number of templates transcluded within the page.',
+'pageinfo-transclusions' => 'The list of pages on which this page is transcluded. Parameters:
+* $1 is the number of pages the current page is transcluded on.',
'pageinfo-toolboxlink' => "Information link for the page (like 'What links here', but to action=info for the current page instead)",
'pageinfo-redirectsto' => 'Key for the row shown if this page is a redirect. Verb. See [http://en.wikipedia.org/w/index.php?title=Main_page&action=info example].',
'pageinfo-redirectsto-info' => 'Text to put in parentheses for the link to the action=info of the redirect target.',
'newwindow',
'cancel',
'moredotdotdot',
+ 'morenotlisted',
'mypage',
'mytalk',
'anontalk',
'pageinfo-magic-words',
'pageinfo-hidden-categories',
'pageinfo-templates',
+ 'pageinfo-transclusions',
'pageinfo-footer',
'pageinfo-toolboxlink',
'pageinfo-redirectsto',