Fixed pollution of a backend function with UI-only features. Autosummaries off by...
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 8 Nov 2006 08:06:51 +0000 (08:06 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 8 Nov 2006 08:06:51 +0000 (08:06 +0000)
includes/Article.php
includes/Defines.php

index b2c3b7e..73f0585 100644 (file)
@@ -1154,7 +1154,7 @@ class Article {
         * @deprecated use Article::doEdit()
         */
        function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC=false, $comment=false ) {
-               $flags = EDIT_NEW | EDIT_DEFER_UPDATES |
+               $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
                        ( $isminor ? EDIT_MINOR : 0 ) |
                        ( $suppressRC ? EDIT_SUPPRESS_RC : 0 );
 
@@ -1186,7 +1186,7 @@ class Article {
         * @deprecated use Article::doEdit()
         */
        function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
-               $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES |
+               $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
                        ( $minor ? EDIT_MINOR : 0 ) |
                        ( $forceBot ? EDIT_FORCE_BOT : 0 );
 
@@ -1235,6 +1235,8 @@ class Article {
         *          Mark the edit a "bot" edit regardless of user rights
         *      EDIT_DEFER_UPDATES
         *          Defer some of the updates until the end of index.php
+        *      EDIT_AUTOSUMMARY
+        *          Fill in blank summaries with generated text where possible
         * 
         * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected. 
         * If EDIT_UPDATE is specified and the article doesn't exist, the function will return false. If 
@@ -1274,7 +1276,7 @@ class Article {
 
                # 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 == '' ) {
+               if ( $flags & EDIT_AUTOSUMMARY && $summary == '' ) {
                        $rt = Title::newFromRedirect( $text );
                        if( is_object( $rt ) )
                                $summary = wfMsgForContent( 'autoredircomment', $rt->getPrefixedText() );
index 4072748..84bc449 100644 (file)
@@ -193,6 +193,7 @@ define( 'EDIT_MINOR', 4 );
 define( 'EDIT_SUPPRESS_RC', 8 );
 define( 'EDIT_FORCE_BOT', 16 );
 define( 'EDIT_DEFER_UPDATES', 32 );
+define( 'EDIT_AUTOSUMMARY', 64 );
 /**#@-*/
 
 /**