From 34db6f4b6f7c6622f392e8b6bff3d7657341618e Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 3 Aug 2010 21:11:16 +0000 Subject: [PATCH] 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. --- maintenance/updateCollation.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 { -- 2.20.1