r72200 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72199‎ | r72200 | r72201 >
Date:16:03, 2 September 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Followup r72181, condense code, use selectRow()
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -3539,20 +3539,13 @@
35403540 */
35413541 public function isInCategory( $category ) {
35423542 $dbr = wfGetDB( DB_SLAVE );
3543 - $res = $dbr->select(
3544 - 'categorylinks',
3545 - '*',
 3543+ return $dbr->selectRow( 'categorylinks', '*',
35463544 array(
35473545 'cl_from' => $this->getArticleId(),
35483546 'cl_to' => $category,
35493547 ),
3550 - __METHOD__,
3551 - array(
3552 - 'LIMIT' => 1
3553 - )
 3548+ __METHOD__
35543549 );
3555 -
3556 - return ( $dbr->numRows( $res ) > 0 );
35573550 }
35583551
35593552 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r72222Followup r72200, cast return to boolreedy20:11, 2 September 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72181Add a "isInCategory" function to check if a specific title is in a certain ca...reedy23:58, 1 September 2010

Comments

#Comment by 😂 (talk | contribs)   19:46, 2 September 2010

isInCategory() implies it returns a boolean. Should cast the selectRow() result.

Status & tagging log