From: Brion Vibber Date: Mon, 6 Nov 2006 17:59:02 +0000 (+0000) Subject: * (bug 7819) Move automatic redirect edit summary after pre-save transform to work... X-Git-Tag: 1.31.0-rc.0~55270 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=8b3ae113583a217706b7966795182dc57fc3bfb4;p=lhc%2Fweb%2Fwiklou.git * (bug 7819) Move automatic redirect edit summary after pre-save transform to work properly with subst: fun 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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 156bc5f0ae..b3c6d1ab56 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Article.php b/includes/Article.php index c3ef0fb74a..b2c3b7efd5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 96e8677368..5a3e67c20a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 ) {