r10200 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10199‎ | r10200 | r10201 >
Date:02:55, 19 July 2005
Author:avar
Status:old
Tags:
Comment:
* Using Database::select() instead of a raw SQL query
* Cleanup
Modified paths:
  • /trunk/phase3/includes/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialAllpages.php
@@ -211,21 +211,27 @@
212212 */
213213 function indexShowChunk( $namespace = NS_MAIN, $from, $including = false ) {
214214 global $wgOut, $wgUser, $indexMaxperpage, $wgContLang;
 215+
 216+ $fname = 'indexShowChunk';
 217+
215218 $sk = $wgUser->getSkin();
216 - $maxPlusOne = $indexMaxperpage + 1;
217219
218 - $out = '';
219 - $dbr =& wfGetDB( DB_SLAVE );
220 - $page = $dbr->tableName( 'page' );
221 -
222220 $fromTitle = Title::newFromURL( $from );
223221 $fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
224222
225 - $sql = "SELECT page_namespace,page_title FROM $page" .
226 - " WHERE page_namespace=$namespace" .
227 - " AND page_title >= ". $dbr->addQuotes( $fromKey ) .
228 - " ORDER BY page_title LIMIT " . $maxPlusOne;
229 - $res = $dbr->query( $sql, 'indexShowChunk' );
 223+ $dbr =& wfGetDB( DB_SLAVE );
 224+ $res = $dbr->select( 'page',
 225+ array( 'page_namespace', 'page_title' ),
 226+ array(
 227+ 'page_namespace' => $namespace,
 228+ 'page_title >= ' . $dbr->addQuotes( $fromKey )
 229+ ),
 230+ $fname,
 231+ array(
 232+ 'ORDER BY' => 'page_title',
 233+ 'LIMIT' => $indexMaxperpage + 1
 234+ )
 235+ );
230236
231237 ### FIXME: side link to previous
232238

Status & tagging log