Index: trunk/extensions/ApprovedRevs/ApprovedRevs_body.php |
— | — | @@ -68,10 +68,14 @@ |
69 | 69 | // property - for some reason, calling the standard |
70 | 70 | // getProperty() function doesn't work, so we just do a DB |
71 | 71 | // 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 | + ); |
76 | 80 | $row = $dbr->fetchRow( $res ); |
77 | 81 | $isApprovable = ( $row[0] == '1' ); |
78 | 82 | $title->isApprovable = $isApprovable; |