summaryrefslogtreecommitdiff
path: root/inc/changelog.php
diff options
context:
space:
mode:
authorlisps <stummp@loewen.de>2013-11-22 10:51:16 +0100
committerlisps <stummp@loewen.de>2013-11-22 10:51:16 +0100
commit78b874e68a5f2a45f71a91efb168761c283e3a91 (patch)
treeb2b0e877713ac1d798ea0d120a79ac5c4cf42514 /inc/changelog.php
parentac6dc646a5823005fd7f9747f2c333bd6379baee (diff)
downloadrpg-78b874e68a5f2a45f71a91efb168761c283e3a91.tar.gz
rpg-78b874e68a5f2a45f71a91efb168761c283e3a91.tar.bz2
fix function name media_isexternal()
remove empty rev from ml() rename getProperRevision() to getLastRevisionAt() make getLastRevisionAt() a method of ChangeLog
Diffstat (limited to 'inc/changelog.php')
-rw-r--r--inc/changelog.php41
1 files changed, 19 insertions, 22 deletions
diff --git a/inc/changelog.php b/inc/changelog.php
index 75fe29e5b..ccb5f7a3e 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -771,6 +771,25 @@ abstract class ChangeLog {
public function isCurrentRevision($rev) {
return $rev == @filemtime($this->getFilename());
}
+
+ /**
+ * Return an existing revision for a specific date which is
+ * the current one or younger or equal then the date
+ *
+ * @param string $id
+ * @param number $date_at timestamp
+ * @return string revision ('' for current)
+ */
+ function getLastRevisionAt($date_at){
+ //requested date_at(timestamp) younger or equal then modified_time($this->id) => load current
+ if($date_at >= @filemtime($this->getFilename())) {
+ return '';
+ } else if ($rev = $this->getRelativeRevision($date_at+1, -1)) { //+1 to get also the requested date revision
+ return $rev;
+ } else {
+ return false;
+ }
+ }
}
class PageChangelog extends ChangeLog {
@@ -870,25 +889,3 @@ function getRevisions($id, $first, $num, $chunk_size=8192, $media=false) {
return $changelog->getRevisions($first, $num);
}
-/**
-* 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){
- $modified_time = @filemtime($media?mediaFN($id):wikiFN($id));
- if(((int)$date_at) >= $modified_time) { //requestet REV younger or equal 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;
- }
- }
-}