r113415 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113414‎ | r113415 | r113416 >
Date:22:51, 8 March 2012
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
(bug 25095) Special:Categories doesn't show first relevant item when "from" is filled
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/specials/SpecialCategories.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -266,6 +266,7 @@
267267 * (bug 34604) [mw.config] wgActionPaths should be an object instead of a numeral
268268 array.
269269 * (bug 29753) mw.util.tooltipAccessKeyPrefix should be alt-shift for Chrome on Windows
 270+* (bug 25095) Special:Categories doesn't show first relevant item when "from" is filled.
270271
271272 === API changes in 1.19 ===
272273 * Made action=edit less likely to return "unknownerror", by returning the actual error
Index: trunk/phase3/includes/specials/SpecialCategories.php
@@ -59,12 +59,16 @@
6060 * @ingroup SpecialPage Pager
6161 */
6262 class CategoryPager extends AlphabeticPager {
 63+ private $conds = array( 'cat_pages > 0' );
 64+
6365 function __construct( IContextSource $context, $from ) {
6466 parent::__construct( $context );
6567 $from = str_replace( ' ', '_', $from );
6668 if( $from !== '' ) {
6769 $from = Title::capitalize( $from, NS_CATEGORY );
68 - $this->mOffset = $from;
 70+ $dbr = wfGetDB( DB_SLAVE );
 71+ $this->conds[] = 'cat_title >= ' . $dbr->addQuotes( $from );
 72+ $this->setOffset( '' );
6973 }
7074 }
7175
@@ -72,7 +76,7 @@
7377 return array(
7478 'tables' => array( 'category' ),
7579 'fields' => array( 'cat_title','cat_pages' ),
76 - 'conds' => array( 'cat_pages > 0' ),
 80+ 'conds' => $this->conds,
7781 'options' => array( 'USE INDEX' => 'cat_title' ),
7882 );
7983 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r113454release-notes (rr113415)krinkle05:40, 9 March 2012
r113935MFT r112918, r113214, r113394, r113415, r113617, r113710, r113727, r113737, r...reedy17:27, 15 March 2012
r114015MFT r112918, r113214, r113268, r113277, r113312, r113415, r113454, r113737, r...reedy15:18, 16 March 2012

Comments

#Comment by Aaron Schulz (talk | contribs)   23:42, 8 March 2012
+ $dbr = wfGetDB( DB_SLAVE );
+ $this->conds[] = 'cat_title >= ' . $dbr->addQuotes( $from );

Please move this to getQueryInfo().

#Comment by MaxSem (talk | contribs)   23:45, 8 March 2012

Why? :)

#Comment by Saper (talk | contribs)   16:44, 16 April 2012

Because not doing so causes bug 36019 :)

Status & tagging log