function DifferenceEngine( $old, $new, $rcid = 0 )
{
- $this->mOldid = $old;
- $this->mNewid = $new;
+ global $wgTitle;
+ if ( 'prev' == $new ) {
+ $this->mNewid = intval($old);
+ $dbr =& wfGetDB( DB_SLAVE );
+ $this->mOldid = $dbr->selectField( 'old', 'old_id',
+ "old_title='" . $wgTitle->getDBkey() . "'" .
+ ' AND old_namespace=' . $wgTitle->getNamespace() .
+ " AND old_id<{$this->mNewid} order by old_id desc" );
+
+ } else {
+ $this->mOldid = intval($old);
+ $this->mNewid = intval($new);
+ }
$this->mRcidMarkPatrolled = intval($rcid); # force it to be an integer
}
"ORDER BY inverse_timestamp LIMIT {$querylimit}";
$res1 = $dbr->query( $sql, $fname );
- $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text FROM $old " .
+ $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " .
"WHERE old_user_text='" . $dbr->strencode( $nt->getText() ) . "' {$omq} " .
"ORDER BY inverse_timestamp LIMIT {$querylimit}";
$res2 = $dbr->query( $sql, $fname );
"WHERE cur_user {$userCond} {$cmq} ORDER BY inverse_timestamp LIMIT {$querylimit}";
$res1 = $dbr->query( $sql, $fname );
- $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text FROM $old " .
+ $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old " .
"WHERE old_user {$userCond} {$omq} ORDER BY inverse_timestamp LIMIT {$querylimit}";
$res2 = $dbr->query( $sql, $fname );
}
$obj1 = $dbr->fetchObject( $res1 );
$topmark = true;
+ $oldid = false;
--$nCur;
} else {
$ns = $obj2->old_namespace;
$comment =$obj2->old_comment;
$me = $obj2->old_minor_edit;
$usertext = $obj2->old_user_text;
+ $oldid = $obj2->old_id;
$obj2 = $dbr->fetchObject( $res2 );
$topmark = false;
--$nOld;
}
if( $n >= $offset )
- ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, ( $me > 0), $isnew, $usertext );
+ ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, ( $me > 0), $isnew, $usertext, $oldid );
}
$wgOut->addHTML( "</ul>\n" );
TODO: This would probably look a lot nicer in a table.
*/
-function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew, $target )
+function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew, $target, $oldid )
{
global $wgLang, $wgOut, $wgUser, $wgRequest;
$page = Title::makeName( $ns, $t );
}
}
+ if ( $oldid ) {
+ $oldtext= $sk->makeKnownLink( $page, '('.wfMsg('diff').')', 'diff=prev&oldid='.$oldid );
+ } else { $oldtext=''; }
$histlink="(".$sk->makeKnownLink($page,wfMsg("hist"),"action=history").")";
if($comment) {
$mflag = "";
}
- $wgOut->addHTML( "<li>{$d} {$histlink} {$mflag} {$link} {$comment}{$topmarktext}</li>\n" );
+ $wgOut->addHTML( "<li>{$d} {$histlink} {$mflag} {$link} {$comment}{$topmarktext}{$oldtext}</li>\n" );
}
function ucCountLink( $lim, $d )