r38763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38762‎ | r38763 | r38764 >
Date:10:39, 7 August 2008
Author:tstarling
Status:old
Tags:
Comment:
Changes for NewUserMessage:
* Add UserGetReservedNames hook to allow extensions to define reserved names without loading messages at setup
* Don't try to notify nonexistent, non-IP users by inserting a username into the user_newtalk.user_ip field. It doesn't work.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -540,8 +540,14 @@
541541 return false;
542542 }
543543
 544+ static $reservedUsernames = false;
 545+ if ( !$reservedUsernames ) {
 546+ $reservedUsernames = $wgReservedUsernames;
 547+ wfRunHooks( 'UserGetReservedNames', array( &$reservedUsernames ) );
 548+ }
 549+
544550 // Certain names may be reserved for batch processes.
545 - foreach ( $wgReservedUsernames as $reserved ) {
 551+ foreach ( $reservedUsernames as $reserved ) {
546552 if ( substr( $reserved, 0, 4 ) == 'msg:' ) {
547553 $reserved = wfMsgForContent( substr( $reserved, 4 ) );
548554 }
Index: trunk/phase3/includes/Article.php
@@ -2767,13 +2767,13 @@
27682768 && !($minoredit && $wgUser->isAllowed('nominornewtalk') ) ) {
27692769 if (wfRunHooks('ArticleEditUpdateNewTalk', array(&$this)) ) {
27702770 $other = User::newFromName( $shortTitle );
2771 - if( is_null( $other ) && User::isIP( $shortTitle ) ) {
 2771+ if( User::isIP( $shortTitle ) ) {
27722772 // An anonymous user
2773 - $other = new User();
2774 - $other->setName( $shortTitle );
2775 - }
2776 - if( $other ) {
27772773 $other->setNewtalk( true );
 2774+ } elseif( $other->isLoggedIn() ) {
 2775+ $other->setNewtalk( true );
 2776+ } else {
 2777+ wfDebug( __METHOD__. ": don't need to notify a nonexistent user\n" );
27782778 }
27792779 }
27802780 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r38765* Create the notifying user if it doesn't exist, don't just use some random r...tstarling10:44, 7 August 2008
r38823Fix on r38763 for "PHP Fatal error: Call to a member function isLoggedIn() o...siebrand00:01, 8 August 2008

Status & tagging log