Replace WebRequest::getLimitOffset with ::getLimitOffsetForUser

Bug: T243805
Change-Id: I8b084e447e12a330bdce2bff18fd7c756ac5f698
This commit is contained in:
DannyS712 2020-02-19 00:47:46 +00:00
parent 4b87844469
commit 3d8e6c6448
4 changed files with 16 additions and 6 deletions

View file

@ -66,7 +66,11 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
$this->mLimitsShown = array_merge( [ 10 ], $this->mLimitsShown );
$this->mDefaultLimit = 10;
list( $this->mLimit, /* $offset */ ) =
$this->mRequest->getLimitOffset( $this->mDefaultLimit, '' );
$this->mRequest->getLimitOffsetForUser(
$this->getUser(),
$this->mDefaultLimit,
''
);
}
/**

View file

@ -178,7 +178,8 @@ abstract class IndexPager extends ContextSource implements Pager {
$this->mDefaultLimit = $this->getUser()->getIntOption( 'rclimit' );
if ( !$this->mLimit ) {
// Don't override if a subclass calls $this->setLimit() in its constructor.
list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset();
list( $this->mLimit, /* $offset */ ) = $this->mRequest
->getLimitOffsetForUser( $this->getUser() );
}
$this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
@ -309,7 +310,7 @@ abstract class IndexPager extends ContextSource implements Pager {
*/
function setLimit( $limit ) {
$limit = (int)$limit;
// WebRequest::getLimitOffset() puts a cap of 5000, so do same here.
// WebRequest::getLimitOffsetForUser() puts a cap of 5000, so do same here.
if ( $limit > 5000 ) {
$limit = 5000;
}

View file

@ -547,7 +547,7 @@ abstract class QueryPage extends SpecialPage {
}
/**
* Returns limit and offset, as returned by $this->getRequest()->getLimitOffset().
* Returns limit and offset, as returned by $this->getRequest()->getLimitOffsetForUser().
* Subclasses may override this to further restrict or modify limit and offset.
*
* @note Restricts the offset parameter, as most query pages have inefficient paging
@ -559,7 +559,8 @@ abstract class QueryPage extends SpecialPage {
* @return int[] list( $limit, $offset )
*/
protected function getLimitOffset() {
list( $limit, $offset ) = $this->getRequest()->getLimitOffset();
list( $limit, $offset ) = $this->getRequest()
->getLimitOffsetForUser( $this->getUser() );
if ( $this->getConfig()->get( 'MiserMode' ) ) {
$maxResults = $this->getMaxResults();
// Can't display more than max results on a page

View file

@ -213,7 +213,11 @@ class SpecialSearch extends SpecialPage {
$this->loadStatus = new Status();
$request = $this->getRequest();
list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, '' );
list( $this->limit, $this->offset ) = $request->getLimitOffsetForUser(
$this->getUser(),
20,
''
);
$this->mPrefix = $request->getVal( 'prefix', '' );
if ( $this->mPrefix !== '' ) {
$this->setExtraParam( 'prefix', $this->mPrefix );