Esempio n. 1
0
 /**
  * @param IDatabase $dbw
  * @return bool|mixed
  */
 public static function cacheUpdate($dbw)
 {
     global $wgActiveUserDays;
     $dbr = wfGetDB(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.
     $activeUsers = $dbr->selectField('recentchanges', 'COUNT( DISTINCT rc_user_text )', ['rc_user != 0', 'rc_bot' => 0, 'rc_log_type != ' . $dbr->addQuotes('newusers') . ' OR rc_log_type IS NULL', 'rc_timestamp >= ' . $dbr->addQuotes($dbr->timestamp(wfTimestamp(TS_UNIX) - $wgActiveUserDays * 24 * 3600))], __METHOD__);
     $dbw->update('site_stats', ['ss_active_users' => intval($activeUsers)], ['ss_row_id' => 1], __METHOD__);
     // Invalid cache used by parser functions
     SiteStats::unload();
     return $activeUsers;
 }