r69321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69320‎ | r69321 | r69322 >
Date:01:15, 14 July 2010
Author:yaron
Status:ok
Tags:
Comment:
Changed from $dbr->query() to $dbr->select()
Modified paths:
  • /trunk/extensions/ApprovedRevs/ApprovedRevs_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/ApprovedRevs_body.php
@@ -68,10 +68,14 @@
6969 // property - for some reason, calling the standard
7070 // getProperty() function doesn't work, so we just do a DB
7171 // query on the page_props table
72 - $dbr = wfGetDB( DB_SLAVE );
73 - extract( $dbr->tableNames( 'page', 'page_props' ) );
74 - $sql = "SELECT COUNT(*) FROM $page_props WHERE pp_page = {$title->getArticleID()} AND pp_propname = 'approvedrevs' AND pp_value = 'y'";
75 - $res = $dbr->query( $sql );
 72+ $dbr = wfGetDB( DB_SLAVE );
 73+ $res = $dbr->select( 'page_props', 'COUNT(*)',
 74+ array(
 75+ 'pp_page' => $title->getArticleID(),
 76+ 'pp_propname' => 'approvedrevs',
 77+ 'pp_value' => 'y'
 78+ )
 79+ );
7680 $row = $dbr->fetchRow( $res );
7781 $isApprovable = ( $row[0] == '1' );
7882 $title->isApprovable = $isApprovable;

Status & tagging log