r42233 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42232‎ | r42233 | r42234 >
Date:23:22, 19 October 2008
Author:brion
Status:old
Tags:
Comment:
Cleanup r42130 and later revs:
* rename user linking functions to something clear
* fix totally broken user link cache thingy to at least not cause a fatal error
Modified paths:
  • /trunk/extensions/CodeReview/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevisionAuthorLink.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevisionAuthorLink.php
@@ -62,12 +62,11 @@
6363 if ( strlen($this->mTarget) && $wgRequest->getCheck( 'newname' ) ) {
6464 $user = User::newFromName( $this->mTarget, false );
6565 if( !$user || !$user->getId() ) {
66 - $wgOut->addWikiMsg( 'nosuchusershort', $name );
 66+ $wgOut->addWikiMsg( 'nosuchusershort', $this->mTarget );
6767 return;
6868 }
69 - $this->mRepo->linkTo( $this->mAuthor, $user );
 69+ $this->mRepo->linkUser( $this->mAuthor, $user );
7070 $userlink = $this->mSkin->userLink( $user->getId(), $user->getName() );
71 - parent::$userLinks[$this->mAuthor] = $user;
7271 $wgOut->addHtml(
7372 '<div class="successbox">' .
7473 wfMsgHtml( 'code-author-success', $this->authorLink( $this->mAuthor ), $userlink) .
@@ -79,8 +78,7 @@
8079 $wgOut->addHtml( wfMsg( 'code-author-orphan' ) );
8180 return;
8281 }
83 - $this->mRepo->unlink( $this->mAuthor );
84 - parent::$userLinks[$this->mAuthor] = false;
 82+ $this->mRepo->unlinkUser( $this->mAuthor );
8583 $wgOut->addHtml(
8684 '<div class="successbox">' .
8785 wfMsgHtml( 'code-author-unlinksuccess', $this->authorLink( $this->mAuthor ) ) .
Index: trunk/extensions/CodeReview/CodeRepository.php
@@ -223,7 +223,7 @@
224224 * @param User $user
225225 * @return bool success
226226 */
227 - public function linkTo( $author, User $user ) {
 227+ public function linkUser( $author, User $user ) {
228228 // We must link to an existing user
229229 if( !$user->getId() ) {
230230 return false;
@@ -252,15 +252,16 @@
253253 __METHOD__
254254 );
255255 }
 256+ self::$userLinks[$author] = $user;
256257 return ( $dbw->affectedRows() > 0 );
257258 }
258259
259260 /*
260 - * Link the $author to the wikiuser $user
 261+ * Remove local user links for $author
261262 * @param string $author
262263 * @return bool success
263264 */
264 - public function unlink( $author ) {
 265+ public function unlinkUser( $author ) {
265266 $dbw = wfGetDB( DB_MASTER );
266267 $dbw->delete(
267268 'code_authors',
@@ -270,13 +271,14 @@
271272 ),
272273 __METHOD__
273274 );
 275+ self::$userLinks[$author] = false;
274276 return ( $dbw->affectedRows() > 0 );
275277 }
276278
277279 /*
278 - * returns a User object if $author has a wikiuser associated,
279 - * of false
280 - */
 280+ * returns a User object if $author has a wikiuser associated,
 281+ * or false
 282+ */
281283 public function authorWikiUser( $author ) {
282284 if( isset( self::$userLinks[$author] ) )
283285 return self::$userLinks[$author];

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r42130Clean up author link codeaaron02:11, 16 October 2008

Status & tagging log