* (bug 7819) Move automatic redirect edit summary after pre-save transform to work...
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 6 Nov 2006 17:59:02 +0000 (17:59 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 6 Nov 2006 17:59:02 +0000 (17:59 +0000)
Moved the check from EditPage::attemptSave() to Article::doEdit, merging two duplicate code fragments to one.
Should also work with future bot editing interface and other things that don't go through editing UI.

RELEASE-NOTES
includes/Article.php
includes/EditPage.php

index 156bc5f..b3c6d1a 100644 (file)
@@ -146,6 +146,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Allow case-sensitive URLs to be used for uploading from URLs.
 * (bug 1109) Correct fix for compressed 304 responses when additional output
   buffers have been installed within the compression handler
+* (bug 7819) Move automatic redirect edit summary after pre-save transform
+  to work properly with subst: fun
 
 
 == Languages updated ==
index c3ef0fb..b2c3b7e 100644 (file)
@@ -1272,6 +1272,14 @@ class Article {
                $isminor = ( $flags & EDIT_MINOR ) && $wgUser->isAllowed('minoredit');
                $bot = $wgUser->isAllowed( 'bot' ) || ( $flags & EDIT_FORCE_BOT );
 
+               # If no edit comment was given when creating a new page, and what's being
+               # created is a redirect, be smart and fill in a neat auto-comment
+               if( $summary == '' ) {
+                       $rt = Title::newFromRedirect( $text );
+                       if( is_object( $rt ) )
+                               $summary = wfMsgForContent( 'autoredircomment', $rt->getPrefixedText() );
+               }
+
                $text = $this->preSaveTransform( $text );
 
                $dbw =& wfGetDB( DB_MASTER );
index 96e8677..5a3e67c 100644 (file)
@@ -652,14 +652,6 @@ class EditPage {
                                        return false;
                        }
 
-                       # If no edit comment was given when creating a new page, and what's being
-                       # created is a redirect, be smart and fill in a neat auto-comment
-                       if( $this->summary == '' ) {
-                               $rt = Title::newFromRedirect( $this->textbox1 );
-                               if( is_object( $rt ) )
-                                       $this->summary = wfMsgForContent( 'autoredircomment', $rt->getPrefixedText() );
-                       }
-
                        $isComment=($this->section=='new');
                        $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
                                $this->minoredit, $this->watchthis, false, $isComment);
@@ -731,14 +723,6 @@ class EditPage {
                        return true;
                }
 
-               # If no edit comment was given when turning a page into a redirect, be smart
-               # and fill in a neat auto-comment
-               if( $this->summary == '' ) {
-                       $rt = Title::newFromRedirect( $this->textbox1 );
-                       if( is_object( $rt ) )
-                               $this->summary = wfMsgForContent( 'autoredircomment', $rt->getPrefixedText() );
-               }
-
                # Handle the user preference to force summaries here
                if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) {
                        if( md5( $this->summary ) == $this->autoSumm ) {