Introduce PageHistoryPager::doBatchLookups hook.
authordaniel <daniel.kinzler@wikimedia.de>
Thu, 16 Apr 2015 15:10:43 +0000 (17:10 +0200)
committerDaniel Kinzler <daniel.kinzler@wikimedia.de>
Thu, 16 Apr 2015 16:02:13 +0000 (16:02 +0000)
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

RELEASE-NOTES-1.26
docs/hooks.txt
includes/actions/HistoryAction.php

index 89dad11..bf9341d 100644 (file)
@@ -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 ==
 
index 877b7ed..6f59b2d 100644 (file)
@@ -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.
index 6693178..83185e4 100644 (file)
@@ -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();