From 59104b32a226bbcf52c6ac38432c7aa6322772f1 Mon Sep 17 00:00:00 2001 From: Florianschmidtwelzow Date: Wed, 27 May 2015 08:21:26 +0200 Subject: [PATCH] Show correct default limit in Special:BlockList Instead of hardcoded default of 50, use the default, which is used in BlockListPager, which can be a user setting. Bug: T71132 Change-Id: I5a7f0eb71782cc2282098368a2caf9c893b688fa --- includes/specials/SpecialBlockList.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index ebc02a55e4..9defaba7f1 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -65,6 +65,9 @@ class SpecialBlockList extends SpecialPage { return; } + # setup BlockListPager here to get the actual default Limit + $pager = $this->getBlockListPager(); + # Just show the block list $fields = array( 'Target' => array( @@ -96,7 +99,7 @@ class SpecialBlockList extends SpecialPage { $lang->formatNum( 500 ) => 500, ), 'name' => 'limit', - 'default' => 50, + 'default' => $pager->getLimit(), ), ); $context = new DerivativeContext( $this->getContext() ); @@ -109,10 +112,14 @@ class SpecialBlockList extends SpecialPage { $form->prepareForm(); $form->displayForm( '' ); - $this->showList(); + $this->showList( $pager ); } - function showList() { + /** + * Setup a new BlockListPager instance. + * @return BlockListPager + */ + protected function getBlockListPager() { $conds = array(); # Is the user allowed to see hidden blocks? if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { @@ -163,12 +170,20 @@ class SpecialBlockList extends SpecialPage { $conds[] = "ipb_range_end = ipb_range_start"; } + return new BlockListPager( $this, $conds ); + } + + /** + * Show the list of blocked accounts matching the actual filter. + * @param BlockListPager $pager The BlockListPager instance for this page + */ + protected function showList( BlockListPager $pager ) { + $out = $this->getOutput(); + # Check for other blocks, i.e. global/tor blocks $otherBlockLink = array(); Hooks::run( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) ); - $out = $this->getOutput(); - # Show additional header for the local block only when other blocks exists. # Not necessary in a standard installation without such extensions enabled if ( count( $otherBlockLink ) ) { @@ -177,7 +192,6 @@ class SpecialBlockList extends SpecialPage { ); } - $pager = new BlockListPager( $this, $conds ); if ( $pager->getNumRows() ) { $out->addParserOutputContent( $pager->getFullOutput() ); } elseif ( $this->target ) { -- 2.20.1