*Cleanup log and timestamps for merge stuff
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 25 Nov 2007 10:27:33 +0000 (10:27 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 25 Nov 2007 10:27:33 +0000 (10:27 +0000)
includes/SpecialMergeHistory.php
languages/messages/MessagesEn.php

index 41ba8ed..5a2233d 100644 (file)
@@ -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 ) );
index 8d07451..74eb01e 100644 (file)
@@ -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.',