summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-05 15:44:26 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-05 15:44:26 -0400
commitc21f9e70936566daaf06fff21349f4584ee42906 (patch)
treeee754e859631b4ac19cb743a78fbcdd86c83a0a9 /IkiWiki/Plugin
parentc869398e2b5e202145ad3c14d96d520779a462e8 (diff)
pagestats: Use a combination of precense and link dependencies.
This makes it more efficient. It also fixes the same bug that I fixed in orphans recently, that only changes to the set of displayed pages were considered (or amoung), which missed changes to links on other pages to those. Probably this bug was never noticed because pagestats is most often put on a blog type page, which gets updated anyway when posts change, and thus the tag cloud was updated.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/pagestats.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index 874ead7e6..00b919325 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -35,10 +35,13 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
my $style = ($params{style} or 'cloud');
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
- add_depends($params{page}, $params{among}) if exists $params{among};
+ # Needs to update whenever a page is added or removed.
+ add_depends($params{page}, $params{pages}, exists => 1);
+ # Also needs to update when any page with links changes,
+ # in case the links point to our displayed pages.
+ # (Amoung limits this further.)
+ add_depends($params{page}, exists $params{among} ? $params{among} : "*",
+ links => 1);
my %counts;
my $max = 0;