(bug 6423) Don't update newtalk flag if page content didn't change (null edits were...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 24 Jun 2006 13:08:48 +0000 (13:08 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 24 Jun 2006 13:08:48 +0000 (13:08 +0000)
RELEASE-NOTES
includes/Article.php

index b56d75d..848ca3e 100644 (file)
@@ -551,7 +551,8 @@ Some default configuration options have changed:
 * (bug 6131) Add type detection for DjVu files, allowing them to be uploaded
   with validity checking and size detection. No inline thumbnailing yet,
   but could be added in the future.
-
+* (bug 6423) Don't update newtalk flag if page content didn't change (null edits
+  were causing the newtalk flag to trigger inappropriately)
 
 == Compatibility ==
 
index 402bced..4969109 100644 (file)
@@ -1354,7 +1354,8 @@ class Article {
                                Article::onArticleEdit( $this->mTitle );
                                
                                # Update links tables, site stats, etc.
-                               $this->editUpdates( $text, $summary, $isminor, $now, $revisionId );
+                               $changed = ( strcmp( $oldtext, $text ) != 0 );
+                               $this->editUpdates( $text, $summary, $isminor, $now, $revisionId, $changed );
                        }
                } else {
                        # Create new article
@@ -1396,7 +1397,7 @@ class Article {
                        $dbw->commit();
 
                        # Update links, etc.
-                       $this->editUpdates( $text, $summary, $isminor, $now, $revisionId );
+                       $this->editUpdates( $text, $summary, $isminor, $now, $revisionId, true );
 
                        # Clear caches
                        Article::onArticleCreate( $this->mTitle );
@@ -2137,9 +2138,14 @@ class Article {
         * Every 1000th edit, prune the recent changes table.
         * 
         * @private
-        * @param string $text
-        */
-       function editUpdates( $text, $summary, $minoredit, $timestamp_of_pagechange, $newid) {
+        * @param $text New text of the article
+        * @param $summary Edit summary
+        * @param $minoredit Minor edit
+        * @param $timestamp_of_pagechange Timestamp associated with the page change
+        * @param $newid rev_id value of the new revision
+        * @param $changed Whether or not the content actually changed
+        */
+       function editUpdates( $text, $summary, $minoredit, $timestamp_of_pagechange, $newid, $changed = true ) {
                global $wgDeferredUpdateList, $wgMessageCache, $wgUser, $wgParser;
 
                wfProfileIn( __METHOD__ );
@@ -2186,8 +2192,9 @@ class Article {
                array_push( $wgDeferredUpdateList, $u );
 
                # If this is another user's talk page, update newtalk
-
-               if ($this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getName()) {
+               # Don't do this if $changed = false otherwise some idiot can null-edit a
+               # load of user talk pages and piss people off
+               if( $this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getName() && $changed ) {
                        if (wfRunHooks('ArticleEditUpdateNewTalk', array(&$this)) ) {
                                $other = User::newFromName( $shortTitle );
                                if( is_null( $other ) && User::isIP( $shortTitle ) ) {