From 1a5edfa6c0584e2cdc8310f302962fd8daea31eb Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Thu, 8 Mar 2012 22:51:39 +0000 Subject: [PATCH] (bug 25095) Special:Categories doesn't show first relevant item when "from" is filled --- RELEASE-NOTES-1.19 | 1 + includes/specials/SpecialCategories.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 87d51b9f0d..e38648cefe 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -266,6 +266,7 @@ production. * (bug 34604) [mw.config] wgActionPaths should be an object instead of a numeral array. * (bug 29753) mw.util.tooltipAccessKeyPrefix should be alt-shift for Chrome on Windows +* (bug 25095) Special:Categories doesn't show first relevant item when "from" is filled. === API changes in 1.19 === * Made action=edit less likely to return "unknownerror", by returning the actual error diff --git a/includes/specials/SpecialCategories.php b/includes/specials/SpecialCategories.php index 6d2831c7b0..338cd70666 100644 --- a/includes/specials/SpecialCategories.php +++ b/includes/specials/SpecialCategories.php @@ -59,12 +59,16 @@ class SpecialCategories extends SpecialPage { * @ingroup SpecialPage Pager */ class CategoryPager extends AlphabeticPager { + private $conds = array( 'cat_pages > 0' ); + function __construct( IContextSource $context, $from ) { parent::__construct( $context ); $from = str_replace( ' ', '_', $from ); if( $from !== '' ) { $from = Title::capitalize( $from, NS_CATEGORY ); - $this->mOffset = $from; + $dbr = wfGetDB( DB_SLAVE ); + $this->conds[] = 'cat_title >= ' . $dbr->addQuotes( $from ); + $this->setOffset( '' ); } } @@ -72,7 +76,7 @@ class CategoryPager extends AlphabeticPager { return array( 'tables' => array( 'category' ), 'fields' => array( 'cat_title','cat_pages' ), - 'conds' => array( 'cat_pages > 0' ), + 'conds' => $this->conds, 'options' => array( 'USE INDEX' => 'cat_title' ), ); } -- 2.20.1