Index: trunk/phase3/includes/User.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * \type{\int} Serialized record version. |
16 | 16 | * @ingroup Constants |
17 | 17 | */ |
18 | | -define( 'MW_USER_VERSION', 6 ); |
| 18 | +define( 'MW_USER_VERSION', 7 ); |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * \type{\string} Some punctuation to prevent editing from broken text-mangling proxies. |
— | — | @@ -3245,7 +3245,7 @@ |
3246 | 3246 | // Restrictions-related block |
3247 | 3247 | |
3248 | 3248 | public function loadRestrictions() { |
3249 | | - if( !$this->mRestrictions ) |
| 3249 | + if( is_null( $this->mRestrictions ) ) |
3250 | 3250 | $this->mRestrictions = UserRestriction::fetchForUser( $this->isLoggedIn() ? |
3251 | 3251 | intval( $this->getId() ) : $this->getName() ); |
3252 | 3252 | } |
Index: trunk/phase3/includes/specials/SpecialRestrictUser.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | if ( $error ) |
108 | 108 | $wgOut->wrapWikiMsg( '<strong class="error">$1</strong>', $error ); |
109 | 109 | if ( $success ) |
110 | | - $wgOut->wrapWikiMsg( '<strong class="success">$1/strong>', $success ); |
| 110 | + $wgOut->wrapWikiMsg( '<strong class="success">$1</strong>', $success ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | public static function doPageRestriction( $uid, $user ) { |
— | — | @@ -126,6 +126,7 @@ |
127 | 127 | $l = new LogPage( 'restrict' ); |
128 | 128 | $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(), |
129 | 129 | array( $r->getType(), $r->getPage()->getFullText(), $logExpiry) ); |
| 130 | + self::invalidateCache( $user ); |
130 | 131 | } |
131 | 132 | |
132 | 133 | public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) { |
— | — | @@ -136,13 +137,13 @@ |
137 | 138 | $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) { |
138 | 139 | $ns = $wgRequest->getVal( 'namespace' ); |
139 | 140 | if( $wgContLang->getNsText( $ns ) === false ) |
140 | | - $error = wfMsgExt( 'restrictuser-badnamespace', 'parseinline' ); |
| 141 | + $error = array( 'restrictuser-badnamespace' ); |
141 | 142 | elseif( UserRestriction::convertExpiry( $wgRequest->getVal( 'expiry' ) ) === false ) |
142 | | - $error = wfMsgExt( 'restrictuser-badexpiry', 'parseinline', $wgRequest->getVal( 'expiry' ) ); |
| 143 | + $error = array( 'restrictuser-badexpiry', $wgRequest->getVal( 'expiry' ) ); |
143 | 144 | else |
144 | 145 | foreach( $oldRestrictions as $r ) |
145 | 146 | if( $r->isNamespace() && $r->getNamespace() == $ns ) |
146 | | - $error = wfMsgExt( 'restrictuser-dupnamespace', 'parse' ); |
| 147 | + $error = array( 'restrictuser-dupnamespace' ); |
147 | 148 | if( !$error ) { |
148 | 149 | self::doNamespaceRestriction( $uid, $user ); |
149 | 150 | $success = array('restrictuser-success', $user); |
— | — | @@ -185,5 +186,11 @@ |
186 | 187 | $l = new LogPage( 'restrict' ); |
187 | 188 | $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(), |
188 | 189 | array( $r->getType(), $r->getNamespace(), $logExpiry ) ); |
| 190 | + self::invalidateCache( $user ); |
189 | 191 | } |
| 192 | + |
| 193 | + private static function invalidateCache( $user ) { |
| 194 | + $userObj = User::newFromName( $user, false ); |
| 195 | + $userObj->invalidateCache(); |
| 196 | + } |
190 | 197 | } |
Index: trunk/phase3/includes/specials/SpecialRemoveRestrictions.php |
— | — | @@ -56,5 +56,7 @@ |
57 | 57 | if( $r->isNamespace() ) |
58 | 58 | $params[] = $r->getNamespace(); |
59 | 59 | $log->addEntry( 'remove', Title::makeTitle( NS_USER, $r->getSubjectText() ), $reason, $params ); |
| 60 | + $userObj = User::newFromName( $r->getSubjectText(), false ); |
| 61 | + $userObj->invalidateCache(); |
60 | 62 | return $result; |
61 | 63 | } |