From 29ebda487aa2d866ef63e882830681a5513fa60b Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sun, 8 Jun 2014 01:58:27 +0200 Subject: [PATCH] Extract the changesets of a dokuwikipage and put it into DokuWikiPage::ChangeLog. --- .../dokuwiki/objectrepresentation/DokuWikiPage.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php b/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php index f4691a4..fdffa68 100755 --- a/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php +++ b/lib/enko/dokuwiki/objectrepresentation/DokuWikiPage.php @@ -11,6 +11,8 @@ namespace enko\dokuwiki\objectrepresentation; class DokuWikiPage extends DokuWikiNode { + public $ChangeLog; + /** * @param $filename * @param null $parent @@ -26,6 +28,17 @@ class DokuWikiPage extends DokuWikiNode foreach ($metadata as $key => $value) { $this->setMetaData($key, $value); } + // extract changelog + $this->ChangeLog = new \ArrayObject(); + $file = metaFN($this->getFullID(), '.changes'); + if (file_exists($file)) { + $changelog_entries = explode("\n", file_get_contents($file)); + foreach ($changelog_entries as $raw_entry) { + $entry = parseChangelogLine($raw_entry); + $changelog = new DokuWikiChangeset($entry['date'], $entry['extra'], $entry['id'], $entry['ip'], $entry['sum'], $entry['type'], $entry['user']); + $this->ChangeLog->append($changelog); + } + } } } \ No newline at end of file