47 $this->dbr = $database;
48 } elseif ( $database ) {
60 $this->
edits = $this->dbr->selectField(
'revision',
'COUNT(*)',
'', __METHOD__ );
61 $this->
edits += $this->dbr->selectField(
'archive',
'COUNT(*)',
'', __METHOD__ );
71 $services = MediaWikiServices::getInstance();
75 'page_namespace' => $services->getNamespaceInfo()->getContentNamespaces(),
76 'page_is_redirect' => 0,
79 if ( $services->getMainConfig()->get(
'ArticleCountMethod' ) ==
'link' ) {
80 $tables[] =
'pagelinks';
81 $conds[] =
'pl_from=page_id';
84 $this->
articles = $this->dbr->selectField(
86 'COUNT(DISTINCT page_id)',
99 $this->
pages = $this->dbr->selectField(
'page',
'COUNT(*)',
'', __METHOD__ );
109 $this->
users = $this->dbr->selectField(
'user',
'COUNT(*)',
'', __METHOD__ );
119 $this->
files = $this->dbr->selectField(
'image',
'COUNT(*)',
'', __METHOD__ );
135 $options += [
'update' =>
false,
'activeUsers' => false ];
138 $counter =
new self( $database );
141 $counter->articles();
149 if ( $options[
'activeUsers'] ) {
159 $exists = $dbw->selectField(
'site_stats',
'1', [
'ss_row_id' => 1 ], __METHOD__ );
160 if ( $exists ===
false ) {
197 private static function getDB( $index, $groups = [] ) {
198 return MediaWikiServices::getInstance()
199 ->getDBLoadBalancer()
200 ->getConnectionRef( $index, $groups );