r35877 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35876‎ | r35877 | r35878 >
Date:20:07, 4 June 2008
Author:demon
Status:old
Tags:
Comment:
Recommitting User::isActiveUser() as User::isActiveEditor() per suggestions from Brion.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -2445,7 +2445,33 @@
24462446 function isNewbie() {
24472447 return !$this->isAllowed( 'autoconfirmed' );
24482448 }
 2449+
 2450+ /**
 2451+ * Is the user active? We check to see if they've made at least
 2452+ * X number of edits in the last Y days.
 2453+ *
 2454+ * @return bool true if the user is active, false if not
 2455+ */
 2456+ public function isActiveEditor() {
 2457+ global $wgActiveUserEditCount, $wgActiveUserDays;
 2458+ $dbr = wfGetDB( DB_SLAVE );
 2459+
 2460+ // Stolen without shame from RC
 2461+ $cutoff_unixtime = time() - ( $wgActiveUserDays * 86400 );
 2462+ $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
 2463+ $oldTime = $dbr->addQuotes( $dbr->timestamp( $cutoff_unixtime ) );
 2464+
 2465+ $res = $dbr->select( 'revision', '1',
 2466+ array( 'rev_user_text' => $this->getName(), "rev_timestamp > $oldTime"),
 2467+ __METHOD__,
 2468+ array('LIMIT' => $wgActiveUserEditCount ) );
 2469+
 2470+ $count = $dbr->numRows($res);
 2471+ $dbr->freeResult($res);
24492472
 2473+ return $count == $wgActiveUserEditCount;
 2474+ }
 2475+
24502476 /**
24512477 * Check to see if the given clear-text password is one of the accepted passwords
24522478 * @param string $password User password.
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1280,6 +1280,14 @@
12811281 */
12821282 $wgDeleteRevisionsLimit = 0;
12831283
 1284+/**
 1285+ * Used to figure out if a user is "active" or not. User::isActiveEditor()
 1286+ * sees if a user has made at least $wgActiveUserEditCount number of edits
 1287+ * within the last $wgActiveUserDays days.
 1288+ */
 1289+$wgActiveUserEditCount = 30;
 1290+$wgActiveUserDays = 30;
 1291+
12841292 # Proxy scanner settings
12851293 #
12861294
Index: trunk/phase3/RELEASE-NOTES
@@ -49,6 +49,9 @@
5050 (default 100) with the new subpage-move functionality of Special:Movepage
5151 * Hooks display in Special:Version is now disabled by default, use
5252 $wgSpecialVersionShowHooks = true; to enable it.
 53+* $wgActiveUserEditCount sets the number of edits that must be performed over
 54+ a certain number of days to be considered active
 55+* $wgActiveUserDays is that number of days
5356
5457 === New features in 1.13 ===
5558
@@ -135,6 +138,9 @@
136139 * (bug 14263) Show a diff of the revert on rollback notification page.
137140 * (bug 13434) Show a warning when hash identical files exist
138141 * Sidebar is now cached for all languages
 142+* The User class now contains a public function called isActiveEditor. Figures
 143+ out if a user is active based on at least $wgActiveUserEditCount number of
 144+ edits in the last $wgActiveUserDays days.
139145
140146 === Bug fixes in 1.13 ===
141147

Follow-up revisions

RevisionCommit summaryAuthorDate
r54815Revert r35877, early commit that can only be explained by a complete naivete....demon21:47, 11 August 2009

Status & tagging log