r41362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41361‎ | r41362 | r41363 >
Date:19:34, 28 September 2008
Author:vasilievvv
Status:old (Comments)
Tags:
Comment:
* Fix caching
* Fix messages
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRemoveRestrictions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRestrictUser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -14,7 +14,7 @@
1515 * \type{\int} Serialized record version.
1616 * @ingroup Constants
1717 */
18 -define( 'MW_USER_VERSION', 6 );
 18+define( 'MW_USER_VERSION', 7 );
1919
2020 /**
2121 * \type{\string} Some punctuation to prevent editing from broken text-mangling proxies.
@@ -3245,7 +3245,7 @@
32463246 // Restrictions-related block
32473247
32483248 public function loadRestrictions() {
3249 - if( !$this->mRestrictions )
 3249+ if( is_null( $this->mRestrictions ) )
32503250 $this->mRestrictions = UserRestriction::fetchForUser( $this->isLoggedIn() ?
32513251 intval( $this->getId() ) : $this->getName() );
32523252 }
Index: trunk/phase3/includes/specials/SpecialRestrictUser.php
@@ -106,7 +106,7 @@
107107 if ( $error )
108108 $wgOut->wrapWikiMsg( '<strong class="error">$1</strong>', $error );
109109 if ( $success )
110 - $wgOut->wrapWikiMsg( '<strong class="success">$1/strong>', $success );
 110+ $wgOut->wrapWikiMsg( '<strong class="success">$1</strong>', $success );
111111 }
112112
113113 public static function doPageRestriction( $uid, $user ) {
@@ -126,6 +126,7 @@
127127 $l = new LogPage( 'restrict' );
128128 $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(),
129129 array( $r->getType(), $r->getPage()->getFullText(), $logExpiry) );
 130+ self::invalidateCache( $user );
130131 }
131132
132133 public static function namespaceRestrictionForm( $uid, $user, $oldRestrictions ) {
@@ -136,13 +137,13 @@
137138 $wgUser->matchEditToken( $wgRequest->getVal( 'edittoken' ) ) ) {
138139 $ns = $wgRequest->getVal( 'namespace' );
139140 if( $wgContLang->getNsText( $ns ) === false )
140 - $error = wfMsgExt( 'restrictuser-badnamespace', 'parseinline' );
 141+ $error = array( 'restrictuser-badnamespace' );
141142 elseif( UserRestriction::convertExpiry( $wgRequest->getVal( 'expiry' ) ) === false )
142 - $error = wfMsgExt( 'restrictuser-badexpiry', 'parseinline', $wgRequest->getVal( 'expiry' ) );
 143+ $error = array( 'restrictuser-badexpiry', $wgRequest->getVal( 'expiry' ) );
143144 else
144145 foreach( $oldRestrictions as $r )
145146 if( $r->isNamespace() && $r->getNamespace() == $ns )
146 - $error = wfMsgExt( 'restrictuser-dupnamespace', 'parse' );
 147+ $error = array( 'restrictuser-dupnamespace' );
147148 if( !$error ) {
148149 self::doNamespaceRestriction( $uid, $user );
149150 $success = array('restrictuser-success', $user);
@@ -185,5 +186,11 @@
186187 $l = new LogPage( 'restrict' );
187188 $l->addEntry( 'restrict', Title::makeTitle( NS_USER, $user ), $r->getReason(),
188189 array( $r->getType(), $r->getNamespace(), $logExpiry ) );
 190+ self::invalidateCache( $user );
189191 }
 192+
 193+ private static function invalidateCache( $user ) {
 194+ $userObj = User::newFromName( $user, false );
 195+ $userObj->invalidateCache();
 196+ }
190197 }
Index: trunk/phase3/includes/specials/SpecialRemoveRestrictions.php
@@ -56,5 +56,7 @@
5757 if( $r->isNamespace() )
5858 $params[] = $r->getNamespace();
5959 $log->addEntry( 'remove', Title::makeTitle( NS_USER, $r->getSubjectText() ), $reason, $params );
 60+ $userObj = User::newFromName( $r->getSubjectText(), false );
 61+ $userObj->invalidateCache();
6062 return $result;
6163 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r41405Revert r41352-41355, r41362-41363: unauthorized schema change breaks parser t...brion00:07, 30 September 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   20:41, 30 September 2008

Backed out in r41405: unauthorized schema changes break parser tests, etc

Status & tagging log