From 5d87350cecdfe6c3dd93cced0173c47769d83790 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 16 Nov 2013 21:27:54 +0100 Subject: [PATCH] Show correct link color on cached result of Special:DeadendPages Reaching this by doing a LinkBatch and than using Linker::link instead of Linker::linkKnown. This adds also the stub color to the link. Bug: 56912 Change-Id: I516f95302546ccdf8d0fdc7101c2ff72daa5f2fb --- RELEASE-NOTES-1.23 | 1 + includes/PageQueryPage.php | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index d7c252a2db..c5791ba0fd 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -51,6 +51,7 @@ production. behavior of several other features where (bogus) section edit links will disappear, such as file description pages loaded via $wgUseInstantCommons or pages transcluded cross-wiki via $wgEnableScaryTranscluding. +* (bug 56912) Show correct link color on cached result of Special:DeadendPages. === API changes in 1.23 === * (bug 54884) action=parse&prop=categories now indicates hidden and missing diff --git a/includes/PageQueryPage.php b/includes/PageQueryPage.php index 61a535d668..02a883ab93 100644 --- a/includes/PageQueryPage.php +++ b/includes/PageQueryPage.php @@ -27,6 +27,28 @@ * @ingroup SpecialPage */ abstract class PageQueryPage extends QueryPage { + /** + * Run a LinkBatch to pre-cache LinkCache information, + * like page existence and information for stub color and redirect hints. + * This should be done for live data and cached data. + * + * @param $db DatabaseBase connection + * @param ResultWrapper $res + */ + public function preprocessResults( $db, $res ) { + if ( !$res->numRows() ) { + return; + } + + $batch = new LinkBatch(); + foreach ( $res as $row ) { + $batch->add( $row->namespace, $row->title ); + } + $batch->execute(); + + $res->seek( 0 ); + } + /** * Format the result as a simple link to the page * @@ -41,7 +63,7 @@ abstract class PageQueryPage extends QueryPage { if ( $title instanceof Title ) { $text = $wgContLang->convert( $title->getPrefixedText() ); - return Linker::linkKnown( $title, htmlspecialchars( $text ) ); + return Linker::link( $title, htmlspecialchars( $text ) ); } else { return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), Linker::getInvalidTitleDescription( $this->getContext(), $row->namespace, $row->title ) ); -- 2.20.1