(bug 25095) Special:Categories doesn't show first relevant item when "from" is filled
authorMax Semenik <maxsem@users.mediawiki.org>
Thu, 8 Mar 2012 22:51:39 +0000 (22:51 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Thu, 8 Mar 2012 22:51:39 +0000 (22:51 +0000)
RELEASE-NOTES-1.19
includes/specials/SpecialCategories.php

index 87d51b9..e38648c 100644 (file)
@@ -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
index 6d2831c..338cd70 100644 (file)
@@ -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' ),
                );
        }