Index: trunk/phase3/includes/User.php |
— | — | @@ -2445,7 +2445,33 @@ |
2446 | 2446 | function isNewbie() { |
2447 | 2447 | return !$this->isAllowed( 'autoconfirmed' ); |
2448 | 2448 | } |
| 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); |
2449 | 2472 | |
| 2473 | + return $count == $wgActiveUserEditCount; |
| 2474 | + } |
| 2475 | + |
2450 | 2476 | /** |
2451 | 2477 | * Check to see if the given clear-text password is one of the accepted passwords |
2452 | 2478 | * @param string $password User password. |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1280,6 +1280,14 @@ |
1281 | 1281 | */ |
1282 | 1282 | $wgDeleteRevisionsLimit = 0; |
1283 | 1283 | |
| 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 | + |
1284 | 1292 | # Proxy scanner settings |
1285 | 1293 | # |
1286 | 1294 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -49,6 +49,9 @@ |
50 | 50 | (default 100) with the new subpage-move functionality of Special:Movepage |
51 | 51 | * Hooks display in Special:Version is now disabled by default, use |
52 | 52 | $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 |
53 | 56 | |
54 | 57 | === New features in 1.13 === |
55 | 58 | |
— | — | @@ -135,6 +138,9 @@ |
136 | 139 | * (bug 14263) Show a diff of the revert on rollback notification page. |
137 | 140 | * (bug 13434) Show a warning when hash identical files exist |
138 | 141 | * 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. |
139 | 145 | |
140 | 146 | === Bug fixes in 1.13 === |
141 | 147 | |