From 6b6fcb99ad1becafb5ccf209e1e9536a3600d313 Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Wed, 11 Apr 2012 15:45:55 +0200 Subject: [PATCH] attempt to fix issues due to incorrect merge conflict resolving, might have missed some, and solutions might introduce new issues on their own Change-Id: I020803b6a7e8b427182ad4c3ddeff99537b99f90 --- includes/EditPage.php | 80 +++---------------------------------------- includes/WikiPage.php | 9 ++--- 2 files changed, 7 insertions(+), 82 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index afe282117e..c61ef9a975 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1299,7 +1299,6 @@ class EditPage { return $status; } -<<<<<<< HEAD // Run post-section-merge edit filter if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError, $this->summary ) ) ) { # Error messages etc. could be handled within the hook... @@ -1326,35 +1325,6 @@ class EditPage { wfProfileOut( __METHOD__ ); return $status; } -======= - $text = $this->textbox1; - $result['sectionanchor'] = ''; - if ( $this->section == 'new' ) { - if ( $this->sectiontitle !== '' ) { - // Insert the section title above the content. - $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->sectiontitle ) . "\n\n" . $text; - - // Jump to the new section - $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle ); - - // If no edit summary was specified, create one automatically from the section - // title and have it link to the new section. Otherwise, respect the summary as - // passed. - if ( $this->summary === '' ) { - $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSectionTitle ); - } - } elseif ( $this->summary !== '' ) { - // Insert the section title above the content. - $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text; - - // Jump to the new section - $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); - - // Create a link to the new section from the edit summary. - $cleanSummary = $wgParser->stripSectionName( $this->summary ); - $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSummary ); ->>>>>>> master } $result['sectionanchor'] = ''; @@ -1415,49 +1385,10 @@ class EditPage { # Suppress edit conflict with self, except for section edits where merging is required. wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" ); $this->isConflict = false; -<<<<<<< HEAD -======= - wfDebug( __METHOD__ . ": conflict suppressed; new section\n" ); ->>>>>>> master - } - } -<<<<<<< HEAD - - // If sectiontitle is set, use it, otherwise use the summary as the section title (for - // backwards compatibility with old forms/bots). - if ( $this->sectiontitle !== '' ) { - $sectionTitle = $this->sectiontitle; -======= - } - // If sectiontitle is set, use it, otherwise use the summary as the section title (for - // backwards compatibility with old forms/bots). - if ( $this->sectiontitle !== '' ) { - $sectionTitle = $this->sectiontitle; - } else { - $sectionTitle = $this->summary; - } + wfDebug( __METHOD__ . ": conflict suppressed; new section\n" ); - if ( $this->isConflict ) { - wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '{$timestamp}')\n" ); - $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $sectionTitle, $this->edittime ); - } else { - wfDebug( __METHOD__ . ": getting section '$this->section'\n" ); - $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $sectionTitle ); - } - if ( is_null( $text ) ) { - wfDebug( __METHOD__ . ": activating conflict; section replace failed.\n" ); - $this->isConflict = true; - $text = $this->textbox1; // do not try to merge here! - } elseif ( $this->isConflict ) { - # Attempt merge - if ( $this->mergeChangesInto( $text ) ) { - // Successful merge! Maybe we should tell the user the good news? - $this->isConflict = false; - wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" ); ->>>>>>> master - } else { - $sectionTitle = $this->summary; + } } $textbox_content = ContentHandler::makeContent( $this->textbox1, $this->getTitle(), $this->content_model, $this->content_format ); @@ -2471,7 +2402,7 @@ HTML protected function showTextbox( $text, $name, $customAttribs = array() ) { global $wgOut, $wgUser; - $wikitext = $this->safeUnicodeOutput( $content ); + $wikitext = $this->safeUnicodeOutput( $text ); if ( strval( $wikitext ) !== '' ) { // Ensure there's a newline at the end, otherwise adding lines // is awkward. @@ -2586,8 +2517,6 @@ HTML $newContent = $newContent->preSaveTransform( $this->mTitle, $wgUser, $popts ); if ( ( $oldContent && !$oldContent->isEmpty() ) || ( $newContent && !$newContent->isEmpty() ) ) { - $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) ); - if ( $oldtext !== false || $newtext != '' ) { $oldtitle = wfMsgExt( $oldtitlemsg, array( 'parseinline' ) ); $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); @@ -3568,8 +3497,6 @@ HTML // but should help keep the breakage down if the editor // breaks one of the entities whilst editing. if ( ( substr( $invalue, $i, 1 ) == ";" ) and ( strlen( $hexstring ) <= 6 ) ) { - $codepoint = hexdec( $hexstring ); - if ( (substr($invalue,$i,1)==";") and (strlen($hexstring) <= 6) ) { $codepoint = hexdec($hexstring); $result .= codepointToUtf8( $codepoint ); } else { @@ -3582,4 +3509,5 @@ HTML // reverse the transform that we made for reversability reasons. return strtr( $result, array( "�" => "&#x" ) ); } + } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 5ea5d75353..b44db8dbf4 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1176,7 +1176,8 @@ class WikiPage extends Page { * @deprected since 1.20, use replaceSectionContent() instead */ public function replaceSection( $section, $text, $sectionTitle = '', $edittime = null ) { #FIXME: use replaceSectionContent() instead! - wfDeprecated( __METHOD__, '1.20' ); + // TODO FIXME + //wfDeprecated( __METHOD__, '1.20' ); $sectionContent = ContentHandler::makeContent( $text, $this->getTitle() ); #XXX: could make section title, but that's not required. @@ -3074,12 +3075,8 @@ class PoolWorkArticleView extends PoolCounterWork { $content = $rev->getContent(); #XXX: why use PUBLIC audience here (default), and RAW above? } - $time = - wfTime(); - $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions ); - $time += wfTime(); $time = - microtime( true ); - $this->parserOutput = $wgParser->parse( $text, $this->page->getTitle(), - $this->parserOptions, true, true, $this->revid ); + $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions ); $time += microtime( true ); # Timing hack -- 2.20.1