X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FupdateArticleCount.php;h=c72e74fbbf82bd3edd06b6990acfff1ed494f87e;hb=d71db83e748fc4e68ba2105ff5501b986589cebe;hp=55f535d20e3401eea9a0165ea010959cd8a699f1;hpb=4d78d40d821227a9368e87306f447ffd3be5db88;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateArticleCount.php b/maintenance/updateArticleCount.php index 55f535d20e..c72e74fbbf 100644 --- a/maintenance/updateArticleCount.php +++ b/maintenance/updateArticleCount.php @@ -35,7 +35,7 @@ class UpdateArticleCount extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Count of the number of articles and update the site statistics table"; + $this->addDescription( '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' ); } @@ -44,9 +44,9 @@ class UpdateArticleCount extends Maintenance { $this->output( "Counting articles..." ); if ( $this->hasOption( 'use-master' ) ) { - $dbr = wfGetDB( DB_MASTER ); + $dbr = $this->getDB( DB_MASTER ); } else { - $dbr = wfGetDB( DB_SLAVE, 'vslow' ); + $dbr = $this->getDB( DB_REPLICA, 'vslow' ); } $counter = new SiteStatsInit( $dbr ); $result = $counter->articles(); @@ -54,11 +54,11 @@ class UpdateArticleCount extends Maintenance { $this->output( "found {$result}.\n" ); if ( $this->hasOption( 'update' ) ) { $this->output( "Updating site statistics table... " ); - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); $dbw->update( 'site_stats', - array( 'ss_good_articles' => $result ), - array( 'ss_row_id' => 1 ), + [ 'ss_good_articles' => $result ], + [ 'ss_row_id' => 1 ], __METHOD__ ); $this->output( "done.\n" ); @@ -69,5 +69,5 @@ class UpdateArticleCount extends Maintenance { } } -$maintClass = "UpdateArticleCount"; +$maintClass = UpdateArticleCount::class; require_once RUN_MAINTENANCE_IF_MAIN;