Merge "[JobQueue] Added a JobQueueRedis class."
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 88f127e..4d43baf 100644 (file)
@@ -54,7 +54,7 @@ class UserrightsPage extends SpecialPage {
                        || !empty( $available['remove'] )
                        || ( ( $this->isself || !$checkIfSelf ) &&
                                ( !empty( $available['add-self'] )
-                                || !empty( $available['remove-self'] ) ) );
+                                       || !empty( $available['remove-self'] ) ) );
        }
 
        /**
@@ -245,16 +245,16 @@ class UserrightsPage extends SpecialPage {
         * Add a rights log entry for an action.
         */
        function addLogEntry( $user, $oldGroups, $newGroups, $reason ) {
-               $log = new LogPage( 'rights' );
-
-               $log->addEntry( 'rights',
-                       $user->getUserPage(),
-                       $reason,
-                       array(
-                               $this->makeGroupNameListForLog( $oldGroups ),
-                               $this->makeGroupNameListForLog( $newGroups )
-                       )
-               );
+               $logEntry = new ManualLogEntry( 'rights', 'rights' );
+               $logEntry->setPerformer( $this->getUser() );
+               $logEntry->setTarget( $user->getUserPage() );
+               $logEntry->setComment( $reason );
+               $logEntry->setParameters( array(
+                       '4::oldgroups' => $oldGroups,
+                       '5::newgroups' => $newGroups,
+               ) );
+               $logid = $logEntry->insert();
+               $logEntry->publish( $logid );
        }
 
        /**
@@ -355,7 +355,16 @@ class UserrightsPage extends SpecialPage {
                }
        }
 
+       /**
+        * Make a list of group names to be stored as parameter for log entries
+        *
+        * @deprecated in 1.21; use LogFormatter instead.
+        * @param $ids array
+        * @return string
+        */
        function makeGroupNameListForLog( $ids ) {
+               wfDeprecated( __METHOD__, '1.21' );
+
                if( empty( $ids ) ) {
                        return '';
                } else {
@@ -370,7 +379,7 @@ class UserrightsPage extends SpecialPage {
                global $wgScript;
                $this->getOutput()->addHTML(
                        Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ) ) .
-                       Html::hidden( 'title',  $this->getTitle()->getPrefixedText() ) .
+                       Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                        Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) .
                        Xml::inputLabel( $this->msg( 'userrights-user-editname' )->text(), 'user', 'username', 30, str_replace( '_', ' ', $this->mTarget ) ) . ' ' .
                        Xml::submitButton( $this->msg( 'editusergroup' )->text() ) .
@@ -563,7 +572,7 @@ class UserrightsPage extends SpecialPage {
                                continue;
                        $ret .= Xml::element( 'th', null, $this->msg( 'userrights-' . $name . '-col', count( $column ) )->text() );
                }
-               $ret.= "</tr>\n<tr>\n";
+               $ret .= "</tr>\n<tr>\n";
                foreach( $columns as $column ) {
                        if( $column === array() )
                                continue;
@@ -614,7 +623,7 @@ class UserrightsPage extends SpecialPage {
        /**
         * Returns $this->getUser()->changeableGroups()
         *
-        * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )
+        * @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ), 'add-self' => array( addablegroups to self ), 'remove-self' => array( removable groups from self ) )
         */
        function changeableGroups() {
                return $this->getUser()->changeableGroups();