r104219 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104218‎ | r104219 | r104220 >
Date:04:44, 25 November 2011
Author:yuvipanda
Status:ok
Tags:
Comment:
Slight code cleanup, plus potential fix for non-mysql databases
Modified paths:
  • /trunk/extensions/ShortUrl/populateShortUrlTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ShortUrl/populateShortUrlTable.php
@@ -29,15 +29,15 @@
3030
3131 $last_processed_id = 0;
3232
33 - $insertBuffer = array();
3433
3534 while( true ) {
 35+ $insertBuffer = array();
3636 $res = $dbr->select(
3737 'page',
3838 array( 'page_id', 'page_namespace', 'page_title' ),
39 - array( "page_id > " . $last_processed_id ),
 39+ array( 'page_id > ' . $last_processed_id ),
4040 __METHOD__,
41 - array( 'LIMIT' => 100 )
 41+ array( 'LIMIT' => 100, 'ORDER BY' => 'page_id' )
4242 );
4343 if( $res->numRows() == 0 ) {
4444 break;
@@ -50,14 +50,12 @@
5151 'su_namespace' => $row->page_namespace,
5252 'su_title' => $row->page_title
5353 );
54 - $this->output( $insertBuffer );
55 - array_push( $insertBuffer, $rowData );
 54+ $insertBuffer[] = $rowData;
5655
5756 $last_processed_id = $row->page_id;
5857 }
5958
6059 $this->insertRows( $insertBuffer );
61 - $insertBuffer = array();
6260 wfWaitForSlaves(); // 'Kill' lag
6361 $this->output( $rowCount . " titles done\n" );
6462 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103665Initial insertion of ShortURL entries done in batchesyuvipanda11:53, 19 November 2011

Status & tagging log