Merge "fix hardcoded quote in Special:DoubleRedirects/BrokenRedirects"
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 88f127e..53570a9 100644 (file)
@@ -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;