public static function factory( array $deltas ) {
$update = new self( 0, 0, 0 );
+ foreach ( $deltas as $name => $unused ) {
+ if ( !in_array( $name, self::$counters ) ) { // T187585
+ throw new UnexpectedValueException( __METHOD__ . ": no field called '$name'" );
+ }
+ }
+
foreach ( self::$counters as $field ) {
if ( isset( $deltas[$field] ) && $deltas[$field] ) {
$update->$field = $deltas[$field];
$dbr = $services->getDBLoadBalancer()->getConnection( DB_REPLICA, 'vslow' );
# Get non-bot users than did some recent action other than making accounts.
# If account creation is included, the number gets inflated ~20+ fold on enwiki.
+ $rcQuery = RecentChange::getQueryInfo();
$activeUsers = $dbr->selectField(
- 'recentchanges',
- 'COUNT( DISTINCT rc_user_text )',
+ $rcQuery['tables'],
+ 'COUNT( DISTINCT ' . $rcQuery['fields']['rc_user_text'] . ' )',
[
'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ), // Exclude external (Wikidata)
- 'rc_user != 0',
+ ActorMigration::newMigration()->isNotAnon( $rcQuery['fields']['rc_user'] ),
'rc_bot' => 0,
'rc_log_type != ' . $dbr->addQuotes( 'newusers' ) . ' OR rc_log_type IS NULL',
'rc_timestamp >= ' . $dbr->addQuotes(
$dbr->timestamp( time() - $config->get( 'ActiveUserDays' ) * 24 * 3600 ) ),
],
- __METHOD__
+ __METHOD__,
+ [],
+ $rcQuery['joins']
);
$dbw->update(
'site_stats',