Revert r35857, 35858, 35859 for the moment. Some notes:
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 4 Jun 2008 16:56:31 +0000 (16:56 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 4 Jun 2008 16:56:31 +0000 (16:56 +0000)
* Calling $user->isActiveUser() looks a bit redundant. :) Consider either shortening it to isActive() or changing the last word to be clearer, say $user->isActiveEditor()
* $wgActiveUserEditcount <- consider fully casing here; "editcount" isn't a word. :D -> $wgActiveUserEditCount
* $oldTime is dumped into SQL without any escaping or quoting. This will happen to work on MySQL but will fail on PostgreSQL, and is generally a bad practice. Use addQuotes() to ensure the formatted timestamp string is escaped and quoted for your raw SQL construct
* the database result object is not freed, which will leak resources if used in a long-running script

RELEASE-NOTES
includes/DefaultSettings.php
includes/User.php

index 39edd09..5ba98eb 100644 (file)
@@ -49,9 +49,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   (default 100) with the new subpage-move functionality of Special:Movepage
 * Hooks display in Special:Version is now disabled by default, use 
   $wgSpecialVersionShowHooks = true; to enable it.
-* $wgActiveUserEditcount sets the number of edits that must be performed over
-  a certain number of days to be considered active
-* $wgActiveUserDays is that number of days
 
 === New features in 1.13 ===
 
@@ -138,9 +135,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 14263) Show a diff of the revert on rollback notification page.
 * (bug 13434) Show a warning when hash identical files exist
 * Sidebar is now cached for all languages
-* The User class now contains a public function called isActiveUser. Figures
-  out if a user is active based on at least $wgActiveUserEditcount number of
-  edits in the last $wgActiveUserDays days.
 
 === Bug fixes in 1.13 ===
 
index bb4b5a5..26ec50b 100644 (file)
@@ -1280,14 +1280,6 @@ $wgAvailableRights = array();
  */
 $wgDeleteRevisionsLimit = 0;
 
-/**
- * Used to figure out if a user is "active" or not. User::isActiveUser()
- * sees if a user has made at least $wgActiveUserEditcount number of edits
- * within the last $wgActiveUserDays days.
- */
-$wgActiveUserEditcount = 30;
-$wgActiveUserDays = 30;
-
 # Proxy scanner settings
 #
 
index 4aff7ab..5a36eea 100644 (file)
@@ -2445,29 +2445,6 @@ class User {
        function isNewbie() {
                return !$this->isAllowed( 'autoconfirmed' );
        }
-       
-       /**
-        * Is the user active? We check to see if they've made at least
-        * X number of edits in the last Y days.
-        * 
-        * @return bool true if the user is active, false if not
-        */
-       public function isActiveUser() {
-               global $wgActiveUserEditcount, $wgActiveUserDays;
-               $dbr = wfGetDB( DB_SLAVE );
-               
-               // Stolen without shame from RC
-               $cutoff_unixtime = time() - ( $wgActiveUserDays * 86400 );
-               $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
-               $oldTime = $dbr->timestamp( $cutoff_unixtime );
-               
-               $res = $dbr->select( 'revision', '1',
-                               array( 'rev_user_text' => $this->getName(), "rev_timestamp > $oldTime"),
-                               __METHOD__,
-                               array('LIMIT' => $wgActiveUserEditcount ) );
-                               
-               return $dbr->numRows($res) == $wgActiveUserEditcount ? true : false;
-       }
 
        /**
         * Check to see if the given clear-text password is one of the accepted passwords