]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/pagestats_plugin_broken.mdwn
ahh
[ikiwiki.git] / doc / bugs / pagestats_plugin_broken.mdwn
1 Since at least version 2.0 (and certainly a few version before), it seems that the pagestats plugin is broken : each matched page has a count of 2.
2 This is also (of course) producing flat tag cloud.
3
4 My perl knowledge is very limited, but the call :
5
6     my @bl = IkiWiki::backlinks($page);
7     $counts{$page} = scalar(@bl);
8
9 return allways 2, which seems to me "obvious", because the backlinks() function is returning two array of links...
10
11 Patch is :
12
13     --- /usr/share/perl5/IkiWiki/Plugin/pagestats.pm        2007-04-27 04:33:43.000000000 +0200
14     +++ ./pagestats.pm      2007-05-12 16:47:14.000000000 +0200
15     @@ -36,7 +36,7 @@
16                     if (pagespec_match($page, $params{pages}, location => $params{page})) {
17                             use IkiWiki::Render;
18                             my @bl = IkiWiki::backlinks($page);
19     -                       $counts{$page} = scalar(@bl);
20     +                       $counts{$page} = scalar(@{$bl[0]})+scalar(@{$bl[1]});
21                             $max = $counts{$page} if $counts{$page} > $max;
22                     }
23             }
24
25
26
27 --[[users/hb]]
28
29 thanks, [[done]] --[[Joey]]