From: Erik Moeller Date: Tue, 29 Jul 2003 15:26:53 +0000 (+0000) Subject: fixed weird section editing bug (would save section instead of merged X-Git-Tag: 1.1.0~372 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=854c2df9ea1331fb62b1898ae6c9f666b32ce247;p=lhc%2Fweb%2Fwiklou.git fixed weird section editing bug (would save section instead of merged article during edit conflict with self) --- diff --git a/includes/Article.php b/includes/Article.php index c6dd43a87a..7cbc9a59b2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -385,7 +385,7 @@ class Article { global $oldid, $redirect, $section; global $wgLang; - if(isset($wpSection)) { $section=$wpSection; } + if(isset($wpSection)) { $section=$wpSection; } else { $wpSection=$section; } $sk = $wgUser->getSkin(); $isConflict = false; @@ -429,16 +429,23 @@ class Article { } # Article exists. Check for edit conflict. # Don't check for conflict when appending a comment - this should always work - # switch from section editing to normal editing in edit conflict $this->clear(); # Force reload of dates, etc. - if ( $section!="new" && ( $this->getTimestamp() != $wpEdittime ) ) { $isConflict = true;$section="";$wpSection=""; } + if ( $section!="new" && ( $this->getTimestamp() != $wpEdittime ) ) { + $isConflict = true; + } $u = $wgUser->getID(); # Supress edit conflict with self if ( ( 0 != $u ) && ( $this->getUser() == $u ) ) { $isConflict = false; + } else { + # switch from section editing to normal editing in edit conflict + if($isConflict) { + $section="";$wpSection=""; + } + } if ( ! $isConflict ) { # All's well: update the article here @@ -672,14 +679,13 @@ $wgLang->recodeForEdit( $wpTextbox1 ) . global $wgOut, $wgUser, $wgTitle, $wgLinkCache; global $wgDBtransactions; $fname = "Article::updateArticle"; - // insert updated section into old text if we have only edited part - // of the article + // of the article if ($section != "") { $oldtext=$this->getContent(); if($section=="new") { - if($summary) $summary="== {$summary} ==\n\n"; - $text=$oldtext."\n\n".$summary.$text; + if($summary) $subject="== {$summary} ==\n\n"; + $text=$oldtext."\n\n".$subject.$text; } else { $secs=preg_split("/(^=+.*?=+|^.*?<\/h[1-6].*?>)/mi", $oldtext,-1,PREG_SPLIT_DELIM_CAPTURE);