- if ( ( 0 != $userid ) && ( $this->mArticle->getUser() == $userid ) ) {
- wfDebug( "Suppressing edit conflict, same user.\n" );
- $isConflict = false;
- } else {
- # switch from section editing to normal editing in edit conflict
- if($isConflict) {
- # Attempt merge
- if( $this->mergeChangesInto( $text ) ){
- // Successful merge! Maybe we should tell the user the good news?
- $isConflict = false;
- wfDebug( "Suppressing edit conflict, successful merge.\n" );
- } else {
- $this->section = '';
- $this->textbox1 = $text;
- wfDebug( "Keeping edit conflict, failed merge.\n" );
- }
- }
- }
- if ( ! $isConflict ) {
- # All's well
- $sectionanchor = '';
- if( $this->section == 'new' ) {
- if( $this->summary != '' ) {
- $sectionanchor = $this->sectionAnchor( $this->summary );
- }
- } elseif( $this->section != '' ) {
- # Try to get a section anchor from the section source, redirect to edited section if header found
- # XXX: might be better to integrate this into Article::getTextOfLastEditWithSectionReplacedOrAdded
- # for duplicate heading checking and maybe parsing
- $hasmatch = preg_match( "/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches );
- # 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 and !preg_match( "/[\\['{<>]/", $matches[2])) {
- if($hasmatch and strlen($matches[2]) > 0) {
- $sectionanchor = $this->sectionAnchor( $matches[2] );
- }
- }
-
- // Save errors may fall down to the edit form, but we've now
- // merged the section into full text. Clear the section field
- // so that later submission of conflict forms won't try to
- // replace that into a duplicated mess.
- $this->textbox1 = $text;
- $this->section = '';
-
- if (wfRunHooks('ArticleSave', array(&$this->mArticle, &$wgUser, &$text,
- &$this->summary, &$this->minoredit,
- &$this->watchthis, &$sectionanchor)))
- {
- # update the article here
- if($this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
- $this->watchthis, '', $sectionanchor ))
- {
- wfRunHooks('ArticleSaveComplete',
- array(&$this->mArticle, &$wgUser, $text,
- $this->summary, $this->minoredit,
- $this->watchthis, $sectionanchor));
- return;
- } else {
- $isConflict = true;
- }
+ # Suppress edit conflict with self
+ if ( ( 0 != $userid ) && ( $this->mArticle->getUser() == $userid ) ) {
+ wfDebug( "Suppressing edit conflict, same user.\n" );
+ $this->isConflict = false;
+ } else {
+ # switch from section editing to normal editing in edit conflict
+ if($this->isConflict) {
+ # Attempt merge
+ if( $this->mergeChangesInto( $text ) ){
+ // Successful merge! Maybe we should tell the user the good news?
+ $this->isConflict = false;
+ wfDebug( "Suppressing edit conflict, successful merge.\n" );
+ } else {
+ $this->section = '';
+ $this->textbox1 = $text;
+ wfDebug( "Keeping edit conflict, failed merge.\n" );