From: Federico Leva Date: Tue, 9 Dec 2014 14:50:56 +0000 (+0100) Subject: updateArticleCount.php: use "vslow" DB by default, allow master X-Git-Tag: 1.31.0-rc.0~13038 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=605da3663c0e6220f84dcbc5d1ede547d1c2d4ae;p=lhc%2Fweb%2Fwiklou.git updateArticleCount.php: use "vslow" DB by default, allow master Similar to initSiteStats.php, SiteStatsUpdate.php. Needed by I13f866b565f665a00ec6ce61bb5073cf380bd0ff Bug: T68867 Change-Id: I061b1bd7bd4b84db5ca4ecf406980dd6981941d1 --- 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" );