From: Aaron Schulz Date: Tue, 16 Jul 2013 18:15:09 +0000 (-0700) Subject: Make it easier to override the DB used for a Pager subclass X-Git-Tag: 1.31.0-rc.0~19183 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user_edit%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=3a3407520e6466620d09b73e6d684d5a0753776c;p=lhc%2Fweb%2Fwiklou.git Make it easier to override the DB used for a Pager subclass Change-Id: I7341ae499e7a5a97061a130b5a4927bada283330 --- 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