r113964 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113963‎ | r113964 | r113965 >
Date:22:09, 15 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Just because we pull a result from the database, doesn't mean it needs fixing. As such, if we pull 50 with nothing to fix, pulling another 50 won't pull anything. And then we're going nowhere

Appropriate quote:

God gave us offset parameters for a reason. -- Tim Starling
Modified paths:
  • /trunk/extensions/WikimediaMaintenance/cleanupBug31576.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaMaintenance/cleanupBug31576.php
@@ -30,12 +30,19 @@
3131 $pCount = 0;
3232 $vCount = 0;
3333 $this->output( "Fixing pages with template links to $synonym ...\n" );
 34+ $from = null;
3435 while ( true ) {
 36+ $where = array(
 37+ 'tl_namespace' => NS_TEMPLATE,
 38+ 'tl_title ' . $dbr->buildLike( $synonym, $dbr->anyString() )
 39+ );
 40+ if ( $from !== null ) {
 41+ $where[] = 'tl_from > ' . $dbr->addQuotes( $from );
 42+ $from = null;
 43+ }
3544 $res = $dbr->select( 'templatelinks', array( 'tl_title', 'tl_from' ),
36 - array(
37 - 'tl_namespace' => NS_TEMPLATE,
38 - 'tl_title' => $synonym
39 - ), __METHOD__,
 45+ $where,
 46+ __METHOD__,
4047 array( 'ORDER BY' => array( 'tl_title', 'tl_from' ), 'LIMIT' => $this->batchsize )
4148 );
4249 if ( $dbr->numRows( $res ) == 0 ) {
@@ -53,6 +60,9 @@
5461 $this->processed[$row->tl_from] = true;
5562 $pCount++;
5663 }
 64+ if ( isset( $row ) ) {
 65+ $from = $row->tl_from;
 66+ }
5767 $this->output( "{$pCount}/{$vCount} pages processed\n" );
5868 wfWaitForSlaves();
5969 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r113965MFT r113964reedy22:15, 15 March 2012

Status & tagging log