From 605da3663c0e6220f84dcbc5d1ede547d1c2d4ae Mon Sep 17 00:00:00 2001 From: Federico Leva Date: Tue, 9 Dec 2014 15:50:56 +0100 Subject: [PATCH] updateArticleCount.php: use "vslow" DB by default, allow master Similar to initSiteStats.php, SiteStatsUpdate.php. Needed by I13f866b565f665a00ec6ce61bb5073cf380bd0ff Bug: T68867 Change-Id: I061b1bd7bd4b84db5ca4ecf406980dd6981941d1 --- maintenance/updateArticleCount.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maintenance/updateArticleCount.php b/maintenance/updateArticleCount.php index 470647a4c4..55f535d20e 100644 --- a/maintenance/updateArticleCount.php +++ b/maintenance/updateArticleCount.php @@ -37,12 +37,18 @@ class UpdateArticleCount extends Maintenance { parent::__construct(); $this->mDescription = "Count of the number of articles and update the site statistics table"; $this->addOption( 'update', 'Update the site_stats table with the new count' ); + $this->addOption( 'use-master', 'Count using the master database' ); } public function execute() { $this->output( "Counting articles..." ); - $counter = new SiteStatsInit( false ); + if ( $this->hasOption( 'use-master' ) ) { + $dbr = wfGetDB( DB_MASTER ); + } else { + $dbr = wfGetDB( DB_SLAVE, 'vslow' ); + } + $counter = new SiteStatsInit( $dbr ); $result = $counter->articles(); $this->output( "found {$result}.\n" ); -- 2.20.1