* (bug 2825) Fix regression in newtalk notifications for anons w/ enotif off
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 12 Jul 2005 22:50:34 +0000 (22:50 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 12 Jul 2005 22:50:34 +0000 (22:50 +0000)
Fixes for invalid usernames now cause User::newFromName to return null for
IP addresses, so we have to stuff an anon's name in separately.
Todo: User::newFromIP() with IPv4 and IPv6 validity checks would be nice.

RELEASE-NOTES
includes/Article.php

index e9f6226..e123409 100644 (file)
@@ -563,6 +563,9 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * (bug 655) Provide empty search form when searching for nothing
 * (bug 2802) Display more than one character of the sort key
 * Nynorsk numeric format fix
+* (bug 2825) Fix regression in newtalk notifications for anons w/ enotif off
+
+
 === Caveats ===
 
 Some output, particularly involving user-supplied inline HTML, may not
index 6e5e453..378039d 100644 (file)
@@ -2020,11 +2020,14 @@ class Article {
                                        $u = new UserTalkUpdate( 1, $this->mTitle->getNamespace(), $shortTitle, $summary,
                                          $minoredit, $timestamp_of_pagechange);
                                } else {
-                                       $other = User::newFromName($shortTitle);
-                                       if ($other) {
-                                               $other->setNewtalk(1);
-                                               $other->saveNewtalk();
+                                       $other = User::newFromName( $shortTitle );
+                                       if( is_null( $other ) && User::isIP( $shortTitle ) ) {
+                                               // An anonymous user
+                                               $other = new User();
+                                               $other->setName( $shortTitle );
                                        }
+                                       $other->setNewtalk(1);
+                                       $other->saveNewtalk();
                                }
                        }