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 );
* @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__ );
$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.
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 );
# 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' );
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;
* @return string
*/
function getPreviewText() {
- global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache;
+ global $wgOut, $wgUser, $wgParser, $wgMessageCache;
wfProfileIn( __METHOD__ );
*
* @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' ) );
$wgOut->addHTML( '<div id="spamprotected">' );
$wgOut->addWikiMsg( 'spamprotectiontext' );
- if ( $match )
+ if ( $match ) {
$wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
+ }
$wgOut->addHTML( '</div>' );
$wgOut->returnToMain( false, $wgTitle );
);
$checkboxes['minor'] =
Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
- " <label for='wpMinoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
+ " <label for='wpMinoredit' id='mw-editpage-minoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
}
$watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) );
);
$checkboxes['watch'] =
Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
- " <label for='wpWatchthis'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
+ " <label for='wpWatchthis' id='mw-editpage-watch'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
}
wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
return $checkboxes;
return false;
case self::AS_SPAM_ERROR:
- $this->spamPage( $resultDetails['spam'] );
+ self::spamPage( $resultDetails['spam'] );
return false;
case self::AS_BLOCKED_PAGE_FOR_USER: