From: daniel Date: Wed, 17 Jun 2015 15:26:03 +0000 (+0200) Subject: Allow limit and offset to be restricted in subclasses of QueryPage.php X-Git-Tag: 1.31.0-rc.0~11044 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=9f34e31d33d4002812b1a46bfdbdedf12e196a15;p=lhc%2Fweb%2Fwiklou.git Allow limit and offset to be restricted in subclasses of QueryPage.php Change-Id: Ib54b50619a0f412e53f92d48821221a243f19756 --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 05e229d0c0..b9c9b862ed 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -774,7 +774,7 @@ class WebRequest { * * @param int $deflimit Limit to use if no input and the user hasn't set the option. * @param string $optionname To specify an option other than rclimit to pull from. - * @return array First element is limit, second is offset + * @return int[] First element is limit, second is offset */ public function getLimitOffset( $deflimit = 50, $optionname = 'rclimit' ) { global $wgUser; diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index bd3b55bd5f..69e1d8cd6b 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -470,6 +470,18 @@ abstract class QueryPage extends SpecialPage { return $this->cachedTimestamp; } + /** + * Returns limit and offset, as returned by $this->getRequest()->getLimitOffset(). + * Subclasses may override this to further restrict or modify limit and offset. + * + * @since 1.26 + * + * @return int[] list( $limit, $offset ) + */ + protected function getLimitOffset() { + return $this->getRequest()->getLimitOffset(); + } + /** * This is the actual workhorse. It does everything needed to make a * real, honest-to-gosh query page. @@ -495,7 +507,7 @@ abstract class QueryPage extends SpecialPage { $out->setSyndicated( $this->isSyndicated() ); if ( $this->limit == 0 && $this->offset == 0 ) { - list( $this->limit, $this->offset ) = $this->getRequest()->getLimitOffset(); + list( $this->limit, $this->offset ) = $this->getLimitOffset(); } // @todo Use doQuery()