Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/95790
Change subject: Show correct links on cached result of Special:DeadendPages ...................................................................... Show correct links on cached result of Special:DeadendPages Reaching this by doing a LinkBatch if the page is cached and than using Linker::link instead of Linker::linkKnown Bug: 56912 Change-Id: I516f95302546ccdf8d0fdc7101c2ff72daa5f2fb --- M RELEASE-NOTES-1.23 M includes/PageQueryPage.php 2 files changed, 29 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/95790/1 diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index d7c252a..c5791ba 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -51,6 +51,7 @@ 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 61a535d..d099ab2 100644 --- a/includes/PageQueryPage.php +++ b/includes/PageQueryPage.php @@ -27,6 +27,29 @@ * @ingroup SpecialPage */ abstract class PageQueryPage extends QueryPage { + + /** + * Pre-cache page existence to speed up link generation + * + * @param $db DatabaseBase connection + * @param ResultWrapper $res + */ + public function preprocessResults( $db, $res ) { + // nothing to do, if query is fresh and only select existing pages + // or there are no data + if ( !$this->isCached() || !$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 +64,11 @@ if ( $title instanceof Title ) { $text = $wgContLang->convert( $title->getPrefixedText() ); - return Linker::linkKnown( $title, htmlspecialchars( $text ) ); + if ( $this->isCached() ) { + return Linker::link( $title, htmlspecialchars( $text ) ); + } else { + return Linker::linkKnown( $title, htmlspecialchars( $text ) ); + } } else { return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), Linker::getInvalidTitleDescription( $this->getContext(), $row->namespace, $row->title ) ); -- To view, visit https://gerrit.wikimedia.org/r/95790 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I516f95302546ccdf8d0fdc7101c2ff72daa5f2fb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits