http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70426

Revision: 70426
Author:   simetrical
Date:     2010-08-03 21:11:16 +0000 (Tue, 03 Aug 2010)

Log Message:
-----------
Use exact counts in updateCollation.php

There's no reason to avoid a one-time COUNT(*), is there?  It will be
free if collations are actually up-to-date, because the column is
indexed.

Modified Paths:
--------------
    trunk/phase3/maintenance/updateCollation.php

Modified: trunk/phase3/maintenance/updateCollation.php
===================================================================
--- trunk/phase3/maintenance/updateCollation.php        2010-08-03 21:07:13 UTC 
(rev 70425)
+++ trunk/phase3/maintenance/updateCollation.php        2010-08-03 21:11:16 UTC 
(rev 70426)
@@ -30,14 +30,18 @@
                global $wgCollationVersion, $wgContLang;
 
                $dbw = wfGetDB( DB_MASTER );
-               $count = $dbw->estimateRowCount(
+               $count = $dbw->selectField(
                        'categorylinks',
-                       array( 'cl_from', 'cl_to', 'cl_sortkey_prefix' ),
+                       'COUNT(*)',
                        'cl_collation != ' . $dbw->addQuotes( 
$wgCollationVersion ),
                        __METHOD__
                );
 
-               $this->output( "Fixing collation for around $count rows 
(estimate might be wrong).\n" );
+               if ( $count == 0 ) {
+                       $this->output( "Collations up-to-date.\n" );
+                       return;
+               }
+               $this->output( "Fixing collation for $count rows.\n" );
 
                $count = 0;
                do {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to