summaryrefslogtreecommitdiff
path: root/inc/changelog.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-09-29 18:29:20 +0200
committerAndreas Gohr <andi@splitbrain.org>2014-09-29 18:29:20 +0200
commit17553fca1944b80c25826f2f71620bbf64e1a49b (patch)
tree45716d17564d0ea39cda4b0f6961b757e382c068 /inc/changelog.php
parent2f981761b3f5b7c8dcc53b8026d9fd3c499a7e1e (diff)
parent80d9f3ddb3a602960d23f1849c1ad6287c4f9d92 (diff)
downloadrpg-17553fca1944b80c25826f2f71620bbf64e1a49b.tar.gz
rpg-17553fca1944b80c25826f2f71620bbf64e1a49b.tar.bz2
Merge pull request #624 from lisps/revisions
date_at support
Diffstat (limited to 'inc/changelog.php')
-rw-r--r--inc/changelog.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/inc/changelog.php b/inc/changelog.php
index 8c14f21b0..6af336fc2 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -845,6 +845,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;
+ }
+ }
/**
* Returns the next lines of the changelog of the chunck before head or after tail
@@ -1072,3 +1091,4 @@ function getRevisions($id, $first, $num, $chunk_size = 8192, $media = false) {
}
return $changelog->getRevisions($first, $num);
}
+