(bug 8345) Don't autosummarize where a redirect was left unchanged
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 8 Nov 2008 20:36:21 +0000 (20:36 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 8 Nov 2008 20:36:21 +0000 (20:36 +0000)
RELEASE-NOTES
includes/Article.php

index ba64820..0ed6095 100644 (file)
@@ -325,6 +325,7 @@ The following extensions are migrated into MediaWiki 1.14:
   revision when passing oldid parameter in the url
 * (bug 16265) When caching thumbs with the ForeignApiRepo, we now use the same filename
   as the remote site.
+* (bug 8345) Don't autosummarize where a redirect was left unchanged
 
 === API changes in 1.14 ===
 
index 60d98cf..23435ce 100644 (file)
@@ -3432,8 +3432,9 @@ class Article {
                # Decide what kind of autosummary is needed.
 
                # Redirect autosummaries
+               $ot = Title::newFromRedirect( $oldtext );
                $rt = Title::newFromRedirect( $newtext );
-               if( is_object( $rt ) ) {
+               if( is_object( $rt ) && ( !is_object( $ot ) || ( !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) ) {
                        return wfMsgForContent( 'autoredircomment', $rt->getFullText() );
                }
 
@@ -3443,14 +3444,14 @@ class Article {
                        global $wgContLang;
                        $truncatedtext = $wgContLang->truncate(
                                str_replace("\n", ' ', $newtext),
-                               max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new') ) ),
+                               max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ),
                                '...' );
                        return wfMsgForContent( 'autosumm-new', $truncatedtext );
                }
 
                # Blanking autosummaries
                if( $oldtext != '' && $newtext == '' ) {
-                       return wfMsgForContent('autosumm-blank');
+                       return wfMsgForContent( 'autosumm-blank' );
                } elseif( strlen( $oldtext ) > 10 * strlen( $newtext ) && strlen( $newtext ) < 500) {
                        # Removing more than 90% of the article
                        global $wgContLang;