From: Aaron Schulz Date: Sun, 25 Nov 2007 10:27:33 +0000 (+0000) Subject: *Cleanup log and timestamps for merge stuff X-Git-Tag: 1.31.0-rc.0~50726 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=5bae4e447222ee14c04aa8619b38aba0fb03f666;p=lhc%2Fweb%2Fwiklou.git *Cleanup log and timestamps for merge stuff --- diff --git a/includes/SpecialMergeHistory.php b/includes/SpecialMergeHistory.php index 41ba8edd5a..5a2233d205 100644 --- a/includes/SpecialMergeHistory.php +++ b/includes/SpecialMergeHistory.php @@ -265,6 +265,9 @@ class MergehistoryForm { # Verify that this timestamp is valid # Must be older than the destination page $dbw = wfGetDB( DB_MASTER ); + # Get timestamp into DB format + $this->mTimestamp = $this->mTimestamp ? $dbw->timestamp($this->mTimestamp) : ''; + $maxtimestamp = $dbw->selectField( 'revision', 'MIN(rev_timestamp)', array('rev_page' => $this->mDestID ), __METHOD__ ); @@ -280,32 +283,34 @@ class MergehistoryForm { __METHOD__ ); # Take the most restrictive of the twain $maxtimestamp = ($lasttime < $maxtimestamp) ? $lasttime : $maxtimestamp; + // $this->mTimestamp must be less than $maxtimestamp if( $this->mTimestamp >= $maxtimestamp ) { $wgOut->addHtml( wfMsg('mergehistory-fail') ); return false; } # Update the revisions - if( $this->mTimestamp ) + if( $this->mTimestamp ) { $timewhere = "rev_timestamp <= {$this->mTimestamp}"; - else - $timewhere = '1 = 1'; + $TimestampLimit = wfTimestamp(TS_MW,$this->mTimestamp); + } else { + $timewhere = "rev_timestamp < {$maxtimestamp}"; + $TimestampLimit = wfTimestamp(TS_MW,$maxtimestamp); + } $dbw->update( 'revision', array( 'rev_page' => $this->mDestID ), - array( 'rev_page' => $this->mTargetID, - "rev_timestamp < {$maxtimestamp}", + array( 'rev_page' => $this->mTargetID, $timewhere ), __METHOD__ ); # Check if this did anything - $count = $dbw->affectedRows(); - if( !$count ) { + if( !$count = $dbw->affectedRows() ) { $wgOut->addHtml( wfMsg('mergehistory-fail') ); return false; } # Update our logs $log = new LogPage( 'merge' ); $log->addEntry( 'merge', $targetTitle, $this->mComment, - array($destTitle->getPrefixedText(),$this->mTimestamp) ); + array($destTitle->getPrefixedText(),$TimestampLimit) ); $wgOut->addHtml( wfMsgExt( 'mergehistory-success', array('parseinline'), $targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 8d07451db0..74eb01e847 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1199,11 +1199,11 @@ navigation links will reset this column.', 'mergehistory-go' => 'Show mergeable edits', 'mergehistory-submit' => 'Merge revisions', 'mergehistory-empty' => 'No revisions can be merged', -'mergehistory-success' => '$3 revisions of [[:$1]] successfully merged into [[:$2]].', +'mergehistory-success' => '$3 revisions of [[:$1|$1]] successfully merged into [[:$2|$2]].', 'mergehistory-fail' => 'Unable to perform history merge, please recheck the page and time parameters.', 'mergelog' => 'Merge log', -'pagemerge-logentry' => 'merged [[:$1]] into [[:$2]] (revisions up to $3)', +'pagemerge-logentry' => 'merged [[$1]] into [[$2]] (revisions up to $3)', 'revertmerge' => 'Unmerge', 'mergelogpagetext' => 'Below is a list of the most recent merges of one page history into another.',