Oops, forgot to change this in r71426
[lhc/web/wiklou.git] / includes / EditPage.php
index 2cc94d5..a362dd7 100644 (file)
@@ -143,7 +143,6 @@ class EditPage {
                        if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                                # If this is a system message, get the default text.
                                list( $message, $lang ) = $wgMessageCache->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
-                               $wgMessageCache->loadAllMessages( $lang );
                                $text = wfMsgGetKey( $message, false, $lang, false );
                                if( wfEmptyMsg( $message, $text ) )
                                        $text = $this->getPreloadedText( $preload );
@@ -765,7 +764,7 @@ class EditPage {
         * @return one of the constants describing the result
         */
        function internalAttemptSave( &$result, $bot = false ) {
-               global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
+               global $wgFilterCallback, $wgUser, $wgParser;
                global $wgMaxArticleSize;
 
                wfProfileIn( __METHOD__  );
@@ -905,20 +904,11 @@ class EditPage {
 
                        $isComment = ( $this->section == 'new' );
 
-                       $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
-                               ( $this->minoredit ? EDIT_MINOR : 0 ) |
-                               ( $bot ? EDIT_FORCE_BOT : 0 );
-                       $status = $this->mArticle->doEdit( $this->textbox1, $this->summary, $flags,
-                               false, null, $this->watchthis, $isComment, '', true );
+                       $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
+                               $this->minoredit, $this->watchthis, false, $isComment, $bot );
 
-                       if ( $status->isOK() ) {
-                               wfProfileOut( __METHOD__ );
-                               return self::AS_SUCCESS_NEW_ARTICLE;
-                       } else {
-                               $result = $status->getErrorsArray();
-                       }
                        wfProfileOut( __METHOD__ );
-                       return self::AS_END;
+                       return self::AS_SUCCESS_NEW_ARTICLE;
                }
 
                # Article exists. Check for edit conflict.
@@ -1026,7 +1016,7 @@ class EditPage {
                                return self::AS_TEXTBOX_EMPTY;
                        }
                        if ( $this->summary != '' ) {
-                               $sectionanchor = $wgParser->guessSectionNameFromWikiText( $this->summary );
+                               $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
                                # This is a new section, so create a link to the new section
                                # in the revision summary.
                                $cleanSummary = $wgParser->stripSectionName( $this->summary );
@@ -1040,7 +1030,7 @@ class EditPage {
                        # we can't deal with anchors, includes, html etc in the header for now,
                        # headline would need to be parsed to improve this
                        if ( $hasmatch and strlen( $matches[2] ) > 0 ) {
-                               $sectionanchor = $wgParser->guessSectionNameFromWikiText( $matches[2] );
+                               $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $matches[2] );
                        }
                }
                wfProfileOut( __METHOD__ . '-sectionanchor' );
@@ -1060,20 +1050,14 @@ class EditPage {
                        return self::AS_MAX_ARTICLE_SIZE_EXCEEDED;
                }
 
-               // Update the article here
-               $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
-                       ( $this->minoredit ? EDIT_MINOR : 0 ) |
-                       ( $bot ? EDIT_FORCE_BOT : 0 );
-               $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
-                       false, null, $this->watchthis, false, $sectionanchor, true );
-
-               if ( $status->isOK() )
+               # update the article here
+               if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
+                       $this->watchthis, $bot, $sectionanchor ) )
                {
                        wfProfileOut( __METHOD__ );
                        return self::AS_SUCCESS_UPDATE;
                } else {
                        $this->isConflict = true;
-                       $result = $status->getErrorsArray();
                }
                wfProfileOut( __METHOD__ );
                return self::AS_END;
@@ -1848,7 +1832,7 @@ INPUTS
         * @return string
         */
        function getPreviewText() {
-               global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache;
+               global $wgOut, $wgUser, $wgParser, $wgMessageCache;
 
                wfProfileIn( __METHOD__ );
 
@@ -2022,7 +2006,7 @@ INPUTS
         *
         * @param $match Text which triggered one or more filters
         */
-       function spamPage( $match = false ) {
+       static function spamPage( $match = false ) {
                global $wgOut, $wgTitle;
 
                $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
@@ -2031,8 +2015,9 @@ INPUTS
 
                $wgOut->addHTML( '<div id="spamprotected">' );
                $wgOut->addWikiMsg( 'spamprotectiontext' );
-               if ( $match )
+               if ( $match ) {
                        $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
+               }
                $wgOut->addHTML( '</div>' );
 
                $wgOut->returnToMain( false, $wgTitle );
@@ -2294,7 +2279,7 @@ INPUTS
                        );
                        $checkboxes['minor'] =
                                Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
-                               "&#160;<label for='wpMinoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
+                               "&#160;<label for='wpMinoredit' id='mw-editpage-minoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
                }
 
                $watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) );
@@ -2307,7 +2292,7 @@ INPUTS
                        );
                        $checkboxes['watch'] =
                                Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
-                               "&#160;<label for='wpWatchthis'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
+                               "&#160;<label for='wpWatchthis' id='mw-editpage-watch'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
                }
                wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
                return $checkboxes;
@@ -2603,7 +2588,7 @@ INPUTS
                                return false;
 
                        case self::AS_SPAM_ERROR:
-                               $this->spamPage( $resultDetails['spam'] );
+                               self::spamPage( $resultDetails['spam'] );
                                return false;
 
                        case self::AS_BLOCKED_PAGE_FOR_USER: