https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113964

Revision: 113964
Author:   reedy
Date:     2012-03-15 22:09:55 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
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: trunk/extensions/WikimediaMaintenance/cleanupBug31576.php
===================================================================
--- trunk/extensions/WikimediaMaintenance/cleanupBug31576.php   2012-03-15 
22:06:40 UTC (rev 113963)
+++ trunk/extensions/WikimediaMaintenance/cleanupBug31576.php   2012-03-15 
22:09:55 UTC (rev 113964)
@@ -30,12 +30,19 @@
                $pCount = 0;
                $vCount = 0;
                $this->output( "Fixing pages with template links to $synonym 
...\n" );
+               $from = null;
                while ( true ) {
+                       $where = array(
+                               'tl_namespace' => NS_TEMPLATE,
+                               'tl_title ' . $dbr->buildLike( $synonym, 
$dbr->anyString() )
+                       );
+                       if ( $from !== null ) {
+                               $where[] = 'tl_from > ' . $dbr->addQuotes( 
$from );
+                               $from = null;
+                       }
                        $res = $dbr->select( 'templatelinks', array( 
'tl_title', 'tl_from' ),
-                               array(
-                                       'tl_namespace' => NS_TEMPLATE,
-                                       'tl_title' => $synonym
-                               ), __METHOD__,
+                               $where,
+                               __METHOD__,
                                array( 'ORDER BY' => array( 'tl_title', 
'tl_from' ), 'LIMIT' => $this->batchsize )
                        );
                        if ( $dbr->numRows( $res ) == 0 ) {
@@ -53,6 +60,9 @@
                                $this->processed[$row->tl_from] = true;
                                $pCount++;
                        }
+                       if ( isset( $row ) ) {
+                               $from = $row->tl_from;
+                       }
                        $this->output( "{$pCount}/{$vCount} pages processed\n" 
);
                        wfWaitForSlaves();
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to