r51878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51877‎ | r51878 | r51879 >
Date:10:34, 15 June 2009
Author:jojo
Status:ok
Tags:
Comment:
optimize page-in-category check
Modified paths:
  • /trunk/extensions/Collection/Collection.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.hooks.php
@@ -370,15 +370,15 @@
371371
372372 static protected function pageInCategory( $pageId, $categoryName ) {
373373 $dbr = wfGetDB( DB_SLAVE );
374 - $count = $dbr->selectField(
 374+ $exists = $dbr->selectField(
375375 'categorylinks',
376 - 'COUNT(*)',
 376+ '1',
377377 array(
378378 'cl_from' => $pageId,
379379 'cl_to' => $categoryName
380380 ),
381381 __METHOD__
382382 );
383 - return ( $count > 0 );
 383+ return (bool)$exists;
384384 }
385385 }

Status & tagging log