From: daniel Date: Thu, 16 Apr 2015 15:10:43 +0000 (+0200) Subject: Introduce PageHistoryPager::doBatchLookups hook. X-Git-Tag: 1.31.0-rc.0~11681^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=a7f26eb3b7d2e83c81d58c4469479b49cf8bd6e9;p=lhc%2Fweb%2Fwiklou.git Introduce PageHistoryPager::doBatchLookups hook. The intention of the new hook is to allow extensions to prefetch any information that may be needed for displaying history rows. In particular, this is needed by Wikibase to allow us to inject localized entity labels into the edit summaries. Bug: T95672 Change-Id: Ie10ef99154da35713a4f583e2de2162fba28eef2 --- diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index 89dad119d6..bf9341db08 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -34,6 +34,7 @@ changes to languages because of Bugzilla reports. === Other changes in 1.26 === * ChangeTags::tagDescription() will return false if the interface message for the tag is disabled. +* Added PageHistoryPager::doBatchLookups hook. == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index 877b7ed709..6f59b2d3a7 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2112,6 +2112,13 @@ constructed. $pager: the pager $queryInfo: the query parameters +'PageHistoryPager::doBatchLookups': Called after the pager query was run, before +any output is generated, to allow batch lookups for prefetching information +needed for display. If the hook handler returns false, the regular behavior of +doBatchLookups() is skipped. +$pager: the PageHistoryPager +$result: a ResultWrapper representing the query result + 'PageRenderingHash': Alter the parser cache option hash key. A parser extension which depends on user options should install this hook and append its values to the key. diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 669317809d..83185e4d61 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -448,6 +448,10 @@ class HistoryPager extends ReverseChronologicalPager { } function doBatchLookups() { + if ( !Hooks::run( 'PageHistoryPager::doBatchLookups', array( $this, $this->mResult ) ) ) { + return; + } + # Do a link batch query $this->mResult->seek( 0 ); $batch = new LinkBatch();