Also split off logging from Userrights class. This is the last of the modifications...
authorAndrew Garrett <werdna@users.mediawiki.org>
Thu, 24 Apr 2008 08:11:36 +0000 (08:11 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Thu, 24 Apr 2008 08:11:36 +0000 (08:11 +0000)
includes/SpecialUserrights.php

index 22418f3..c13a8ad 100644 (file)
@@ -123,7 +123,7 @@ class UserrightsPage extends SpecialPage {
                        return;
                }
 
-               $allgroups = User::getAllGroups();
+               $allgroups = $this->getAllGroups();
                $addgroup = array();
                $removegroup = array();
 
@@ -182,18 +182,25 @@ class UserrightsPage extends SpecialPage {
                }
 
                if( $newGroups != $oldGroups ) {
-                       $log = new LogPage( 'rights' );
-
-                       $log->addEntry( 'rights',
-                               $user->getUserPage(),
-                               $wgRequest->getText( 'user-reason' ),
-                               array(
-                                       $this->makeGroupNameList( $oldGroups ),
-                                       $this->makeGroupNameList( $newGroups )
-                               )
-                       );
+                       $this->addLogEntry( $user, $oldGroups, $newGroups );
                }
        }
+       
+       /**
+        * Add a rights log entry for an action.
+        */
+       function addLogEntry( $user, $oldGroups, $newGroups ) {
+               $log = new LogPage( 'rights' );
+
+               $log->addEntry( 'rights',
+                       $user->getUserPage(),
+                       $wgRequest->getText( 'user-reason' ),
+                       array(
+                               $this->makeGroupNameList( $oldGroups ),
+                               $this->makeGroupNameList( $newGroups )
+                       )
+               );
+       }
 
        /**
         * Edit user groups membership