From 4a7d4f39b589c9cfb211977a40c00c6d34ac3d5e Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 24 Jun 2006 13:08:48 +0000 Subject: [PATCH] (bug 6423) Don't update newtalk flag if page content didn't change (null edits were causing the newtalk flag to trigger inappropriately) --- RELEASE-NOTES | 3 ++- includes/Article.php | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b56d75d74d..848ca3e798 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Article.php b/includes/Article.php index 402bceddc4..4969109732 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ) ) { -- 2.20.1