diff options
Diffstat (limited to 'inc/changelog.php')
-rw-r--r-- | inc/changelog.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/changelog.php b/inc/changelog.php index de26fdf6a..0a33f6a6e 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -814,3 +814,26 @@ function getRevisions($id, $first, $num, $chunk_size=8192, $media=false) { $log = new PageRevisionLog($id, $chunk_size); return $log->getRevisions($first, $num, $media); } + +/** +* Return an existing revision for a specific date which is +* the current one or less or equal then the date +* +* @param string $id +* @param number $date_at +* @param boolean $media +* @return string revision ('' for current) +*/ +function getProperRevision($id,$date_at,$media = false){ + $create_time = @filemtime($media?mediaFN($id):wikiFN($id)); + if(((int)$date_at) >= $create_time) { //requestet REV older then time($id) => load current + return ''; + } else { + $log = new PageRevisionLog($id); + if($rev = $log->getRelativeRevision($date_at+1, -1,$media)) { + return $rev; + } else { + return false; + } + } +}
\ No newline at end of file |