From: Aryeh Gregor Date: Tue, 3 Aug 2010 21:11:16 +0000 (+0000) Subject: Use exact counts in updateCollation.php X-Git-Tag: 1.31.0-rc.0~35741 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=34db6f4b6f7c6622f392e8b6bff3d7657341618e;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 0bc40ecf85..beea497e83 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -30,14 +30,18 @@ TEXT; 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 {