Skip to content
Snippets Groups Projects
Commit 14f6540f authored by Simon Coffey spc03@doc.ic.ac.uk's avatar Simon Coffey spc03@doc.ic.ac.uk
Browse files

Importoldchangelog: Added metadata support

Added function savePerPageMetadata() to populate creator and contributor fields
of metadata array from old-style changes.log.

darcs-hash:20080213145734-31360-226e84e11c5a95d2bcafd8d29abca24f76b25482.gz
parent d86d5af0
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,30 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin {
io_saveFile(metaFN($id, '.changes'), implode('', $changes));
}
function savePerPageMetadata($id, &$changes) {
global $auth;
ksort($changes); // order by date
$meta = array();
// Run through history and populate the metadata array
foreach ($changes as $date => $tmp) {
$user = $tmp['user'];
if ($tmp['type'] === DOKU_CHANGE_TYPE_CREATE) {
$meta['date']['created'] = $tmp['date'];
if ($user) {
$userinfo = $auth->getUserData($user);
$meta['creator'] = $userinfo['name'];
}
} else if ($tmp['type'] === DOKU_CHANGE_TYPE_EDIT) {
$meta['date']['modified'] = $tmp['date'];
if ($user) {
$userinfo = $auth->getUserData($user);
$meta['contributor'][$user] = $userinfo['name'];
}
}
}
p_set_metadata($id, $meta, true);
}
function resetTimer() {
// Add 5 minutes to the script execution timer...
// This should be much more than needed.
......@@ -144,6 +168,7 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin {
$this->resetTimer();
$recent = array();
foreach ($log as $id => $page) {
$this->savePerPageMetadata($id, $page);
$this->savePerPageChanges($id, $page, $recent);
}
// save recent changes cache
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment