}
/**
- *
+ * Class for handling updates to the site_stats table
*/
-class SiteStatsUpdate {
+class SiteStatsUpdate implements DeferrableUpdate {
var $mViews, $mEdits, $mGood, $mPages, $mUsers;
if ( $database instanceof DatabaseBase ) {
$this->db = $database;
} else {
- $this->db = wfGetDB( $useMaster ? DB_MASTER : DB_SLAVE );
+ $this->db = wfGetDB( $database ? DB_MASTER : DB_SLAVE );
}
}
$this->mPages = $this->db->selectField( 'page', 'COUNT(*)', '', __METHOD__ );
return $this->mPages;
}
-
+
/**
* Count total users
* @return Integer
$this->mUsers = $this->db->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
return $this->mUsers;
}
-
+
/**
* Count views
* @return Integer
/**
* Do all updates and commit them. More or less a replacement
- * for the original initStats, but without the calls to wfOut()
+ * for the original initStats, but without output.
*
* @param $database Boolean or DatabaseBase:
* - Boolean: whether to use the master DB