[dokuwiki] Re: Recent changes
- From: Ben Coburn <btcoburn@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sun, 24 Sep 2006 07:56:56 -0700
On Sep 24, 2006, at 3:27 AM, Chris Smith wrote:
(a) Trimming recent change cache
I think the trimming of the recent change cache to one page is too
short. If you have editors who in the course of changing one page,
end up making several edits, the number of pages showing in the list
can be reduced dramatically and possibly important information about
other changes is not seen.
I know $conf['recent'] can be increased, but it has the side effect of
increasing the number of changes shown on one page.
Does there need to be a number for this at all - ie. is trimming by
age ($conf['recent_days']) enough?
Chris,
I'm confused, or maybe you misunderstood how I intended the changelog
trimmer to work....
The original intent was for the recent changes to be trimmed to
everything newer than N days OR X lines (which ever was larger). Where
N=$conf['recent_days'] and X=$conf['recent']. In a fast moving wiki N
may equal one week or even one day, but a slower moving wiki could use
N of one month or more. In a slow moving wiki (if no one edited
anything over the holidays) it would be better to have the most recent
stale changes still visible, instead of no changes. This is why I added
the clause to keep at least X changes when trimming the recent changes
log.
I've just prepared a patch to update your update to the changelog
trimmer. I am appending it here in the hope that it may make what I'm
saying clearer.
hunk ./lib/exe/indexer.php 67
- if (count($lines)<$conf['recent']) {
+ $lines_count = count($lines);
+ if ($lines_count<$conf['recent']) {
hunk ./lib/exe/indexer.php 77
- $out_lines = array();
-
- for ($i=0; $i<count($lines); $i++) {
- $log = parseChangelogLine($lines[$i]);
- if ($log === false || $log['date'] < $trim_time)
continue; // discard old lines
- $out_lines[$log['date']] = $lines[$i];
// preserve the rest
- }
-
- ksort($out_lines);
// sort lines, just in case!
- if (count($out_lines) > $conf['recent']) {
- $out_lines = array_slice($out_lines,-$conf['recent']);
// trim list to one page
+ // check lines from newest to oldest, always keeping the
first "page" of changes
+ for ($i = $lines_count-($conf['recent']+1); $i>=0; $i--) {
+ $log = parseChangelogLine($lines[$i]);
+ if ($log===false || $log['date']<$trim_time) {
unset($lines[$i]); }
hunk ./lib/exe/indexer.php 84
- io_saveFile($conf['changelog'].'_tmp', implode('',
$out_lines));
+ io_saveFile($conf['changelog'].'_tmp', implode('',
$lines));
hunk ./lib/exe/indexer.php 89
- io_saveFile($conf['changelog'], implode('',
$out_lines));
+ io_saveFile($conf['changelog'], implode('', $lines));
}
Regards, Ben Coburn
-------------------
silicodon.net
-------------------
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: