From 3a3407520e6466620d09b73e6d684d5a0753776c Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 16 Jul 2013 11:15:09 -0700 Subject: [PATCH] Make it easier to override the DB used for a Pager subclass Change-Id: I7341ae499e7a5a97061a130b5a4927bada283330 --- includes/Pager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Pager.php b/includes/Pager.php index 89930e2a77..3ada0e2a03 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -150,7 +150,8 @@ abstract class IndexPager extends ContextSource implements Pager { } $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' ); - $this->mDb = wfGetDB( DB_SLAVE ); + # Let the subclass set the DB here; otherwise use a slave DB for the current wiki + $this->mDb = $this->mDb ?: wfGetDB( DB_SLAVE ); $index = $this->getIndexField(); // column to sort on $extraSort = $this->getExtraSortFields(); // extra columns to sort on for query planning -- 2.20.1