diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-10-30 03:37:10 +0100 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-10-30 03:37:10 +0100 |
commit | 84de34fb8113f8db6c02af8be37f55716841629d (patch) | |
tree | b01c85c651b90cdd5dd1ab439306de9a64573fec | |
parent | d5e164107b7de0113cdc7275d21275df9959f6bf (diff) | |
download | rpg-84de34fb8113f8db6c02af8be37f55716841629d.tar.gz rpg-84de34fb8113f8db6c02af8be37f55716841629d.tar.bz2 |
make importoldchangelog plugin more user friendly
The plugin places all the changelog lines into the recent changes cache.
Truncating this cache is left to the code that normally trims the recent
changes cache. $conf['recent_days'] defines the maximum age of changes to
be considered "recent". If no changes are "recent" the changelog cache
trimmer will leave some stale changes in the cache to avoid emptying it
completely.
darcs-hash:20061030023710-05dcb-6a870d8597aeb22769de00dfb977d394881b9de8.gz
-rw-r--r-- | lib/plugins/importoldchangelog/action.php | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/plugins/importoldchangelog/action.php b/lib/plugins/importoldchangelog/action.php index 37f3eb87d..0c2601e16 100644 --- a/lib/plugins/importoldchangelog/action.php +++ b/lib/plugins/importoldchangelog/action.php @@ -11,10 +11,10 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin { return array( 'author' => 'Ben Coburn', 'email' => 'btcoburn@silicodon.net', - 'date' => '2006-08-30', + 'date' => '2006-10-29', 'name' => 'Import Old Changelog', 'desc' => 'Imports and converts the single file changelog '. - 'from the 2006-03-09b release to the new format. '. + 'from the 2006-03-09 release to the new format. '. 'Also reconstructs missing changelog data from '. 'old revisions kept in the attic.', 'url' => 'http://wiki.splitbrain.org/wiki:changelog' @@ -53,7 +53,7 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin { if ($sum===$lang['deleted']) { $type = 'D'; } // build new log line $tmp = array(); - $tmp['date'] = $oldline[0]; + $tmp['date'] = (int)$oldline[0]; $tmp['ip'] = $oldline[1]; $tmp['type'] = $type; $tmp['id'] = $oldline[2]; @@ -86,7 +86,7 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin { if (!isset($logs[$id])) { $logs[$id] = array(); } if (!isset($logs[$id][$date])) { $tmp = array(); - $tmp['date'] = $date; + $tmp['date'] = (int)$date; $tmp['ip'] = '127.0.0.1'; // original ip lost $tmp['type'] = 'E'; $tmp['id'] = $id; @@ -107,17 +107,13 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin { } - function savePerPageChanges($id, &$changes, &$recent, $trim_time) { - $out_lines = array(); + function savePerPageChanges($id, &$changes, &$recent) { ksort($changes); // ensure correct order of changes from attic - foreach ($changes as $tmp) { - $line = implode("\t", $tmp)."\n"; - array_push($out_lines, $line); - if ($tmp['date']>$trim_time) { - $recent[$tmp['date']] = $line; - } + foreach ($changes as $date => $tmp) { + $changes[$date] = implode("\t", $tmp)."\n"; + $recent[$date] = &$changes[$date]; } - io_saveFile(metaFN($id, '.changes'), implode('', $out_lines)); + io_saveFile(metaFN($id, '.changes'), implode('', $changes)); } function resetTimer() { @@ -147,9 +143,8 @@ class action_plugin_importoldchangelog extends DokuWiki_Action_Plugin { // save per-page changelogs $this->resetTimer(); $recent = array(); - $trim_time = time() - $conf['recent_days']*86400; foreach ($log as $id => $page) { - $this->savePerPageChanges($id, $page, $recent, $trim_time); + $this->savePerPageChanges($id, $page, $recent); } // save recent changes cache $this->resetTimer(); |