From 3d8e6c6448b260ee8ca259d5e2aaffddaffccee7 Mon Sep 17 00:00:00 2001 From: DannyS712 Date: Wed, 19 Feb 2020 00:47:46 +0000 Subject: [PATCH] Replace WebRequest::getLimitOffset with ::getLimitOffsetForUser Bug: T243805 Change-Id: I8b084e447e12a330bdce2bff18fd7c756ac5f698 --- includes/page/ImageHistoryPseudoPager.php | 6 +++++- includes/pager/IndexPager.php | 5 +++-- includes/specialpage/QueryPage.php | 5 +++-- includes/specials/SpecialSearch.php | 6 +++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/includes/page/ImageHistoryPseudoPager.php b/includes/page/ImageHistoryPseudoPager.php index 06dad7ff47a..14130b5c346 100644 --- a/includes/page/ImageHistoryPseudoPager.php +++ b/includes/page/ImageHistoryPseudoPager.php @@ -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, + '' + ); } /** diff --git a/includes/pager/IndexPager.php b/includes/pager/IndexPager.php index 3ae232df87f..523fa7be908 100644 --- a/includes/pager/IndexPager.php +++ b/includes/pager/IndexPager.php @@ -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; } diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 0fbc2497ec8..78520949504 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -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 diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 80f082d7aad..88d2be3b82d 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -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 );