Merge "Unroll array_map in ResourceLoaderFileModule::readStyleFiles"
[lhc/web/wiklou.git] / includes / specials / SpecialUserrights.php
index 26923f7..a6b3602 100644 (file)
@@ -152,6 +152,10 @@ class UserrightsPage extends SpecialPage {
                        }
 
                        $targetUser = $status->value;
+                       if ( $targetUser instanceof User ) { // UserRightsProxy doesn't have this method (bug 61252)
+                               $targetUser->clearInstanceCache(); // bug 38989
+                       }
+
 
                        if ( $request->getVal( 'conflictcheck-originalgroups' ) !== implode( ',', $targetUser->getGroups() ) ) {
                                $out->addWikiMsg( 'userrights-conflict' );
@@ -174,7 +178,7 @@ class UserrightsPage extends SpecialPage {
        }
 
        function getSuccessURL() {
-               return $this->getTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
+               return $this->getPageTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
        }
 
        /**
@@ -405,7 +409,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->getPageTitle()->getPrefixedText() ) .
                        Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) .
                        Xml::inputLabel( $this->msg( 'userrights-user-editname' )->text(), 'user', 'username', 30, str_replace( '_', ' ', $this->mTarget ), array( 'autofocus' => true ) ) . ' ' .
                        Xml::submitButton( $this->msg( 'editusergroup' )->text() ) .
@@ -490,7 +494,7 @@ class UserrightsPage extends SpecialPage {
                );
 
                $this->getOutput()->addHTML(
-                       Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) .
+                       Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) .
                        Html::hidden( 'user', $this->mTarget ) .
                        Html::hidden( 'wpEditToken', $this->getUser()->getEditToken( $this->mTarget ) ) .
                        Html::hidden( 'conflictcheck-originalgroups', implode( ',', $user->getGroups() ) ) . // Conflict detection
@@ -563,17 +567,17 @@ class UserrightsPage extends SpecialPage {
                $allgroups = $this->getAllGroups();
                $ret = '';
 
-               # Put all column info into an associative array so that extensions can
-               # more easily manage it.
+               // Put all column info into an associative array so that extensions can
+               // more easily manage it.
                $columns = array( 'unchangeable' => array(), 'changeable' => array() );
 
                foreach ( $allgroups as $group ) {
                        $set = in_array( $group, $usergroups );
-                       # Should the checkbox be disabled?
+                       // Should the checkbox be disabled?
                        $disabled = !(
                                ( $set && $this->canRemove( $group ) ) ||
                                ( !$set && $this->canAdd( $group ) ) );
-                       # Do we need to point out that this action is irreversible?
+                       // Do we need to point out that this action is irreversible?
                        $irreversible = !$disabled && (
                                ( $set && !$this->canAdd( $group ) ) ||
                                ( !$set && !$this->canRemove( $group ) ) );
@@ -591,14 +595,14 @@ class UserrightsPage extends SpecialPage {
                        }
                }
 
-               # Build the HTML table
+               // Build the HTML table
                $ret .= Xml::openElement( 'table', array( 'class' => 'mw-userrights-groups' ) ) .
                        "<tr>\n";
                foreach ( $columns as $name => $column ) {
                        if ( $column === array() ) {
                                continue;
                        }
-                       // Give grep a chance to find the usages: userrights-changeable-col, userrights-unchangeable-col
+                       // Messages: userrights-changeable-col, userrights-unchangeable-col
                        $ret .= Xml::element( 'th', null, $this->msg( 'userrights-' . $name . '-col', count( $column ) )->text() );
                }
                $ret .= "</tr>\n<tr>\n";
@@ -635,8 +639,7 @@ class UserrightsPage extends SpecialPage {
         * @return bool Can we remove the group?
         */
        private function canRemove( $group ) {
-               // $this->changeableGroups()['remove'] doesn't work, of course. Thanks,
-               // PHP.
+               // $this->changeableGroups()['remove'] doesn't work, of course. Thanks, PHP.
                $groups = $this->changeableGroups();
                return in_array( $group, $groups['remove'] ) || ( $this->isself && in_array( $group, $groups['remove-self'] ) );
        }