private static function isSane( $row ) {
if(
$row === false
- or $row->ss_total_pages < $row->ss_good_articles
- or $row->ss_total_edits < $row->ss_total_pages
+ || $row->ss_total_pages < $row->ss_good_articles
+ || $row->ss_total_edits < $row->ss_total_pages
) {
return false;
}
'total_pages', 'users', 'admins', 'images' ) as $member ) {
if(
$row->{"ss_$member"} > 2000000000
- or $row->{"ss_$member"} < 0
+ || $row->{"ss_$member"} < 0
) {
return false;
}
}
public static function cacheUpdate( $dbw ) {
+ global $wgActiveUserDays;
$dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', '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.
array(
'rc_user != 0',
'rc_bot' => 0,
- "rc_log_type != 'newusers' OR rc_log_type IS NULL"
+ "rc_log_type != 'newusers' OR rc_log_type IS NULL",
+ "rc_timestamp >= '{$dbw->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 )}'",
),
__METHOD__
);
* @return Integer
*/
public function articles() {
- global $wgContentNamespaces;
- $this->mArticles = $this->db->selectField(
- 'page',
- 'COUNT(*)',
- array(
- 'page_namespace' => $wgContentNamespaces,
- 'page_is_redirect' => 0,
- 'page_len > 0'
- ),
- __METHOD__
+ global $wgUseCommaCount;
+
+ $tables = array( 'page' );
+ $conds = array(
+ 'page_namespace' => MWNamespace::getContentNamespaces(),
+ 'page_is_redirect' => 0,
+ 'page_len > 0'
);
+
+ if ( !$wgUseCommaCount ) {
+ $tables[] = 'pagelinks';
+ $conds[] = 'pl_from=page_id';
+ }
+
+ $this->mArticles = $this->db->selectField( $tables, 'COUNT(DISTINCT page_id)',
+ $conds, __METHOD__ );
return $this->mArticles;
}