Extract the changesets of a dokuwikipage and put it into DokuWikiPage::ChangeLog.

This commit is contained in:
Tim Schumacher 2014-06-08 01:58:27 +02:00
parent e9576d0d58
commit 29ebda487a

View file

@ -11,6 +11,8 @@ namespace enko\dokuwiki\objectrepresentation;
class DokuWikiPage extends DokuWikiNode class DokuWikiPage extends DokuWikiNode
{ {
public $ChangeLog;
/** /**
* @param $filename * @param $filename
* @param null $parent * @param null $parent
@ -26,6 +28,17 @@ class DokuWikiPage extends DokuWikiNode
foreach ($metadata as $key => $value) { foreach ($metadata as $key => $value) {
$this->setMetaData($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);
}
}
} }
} }