From c21f9e70936566daaf06fff21349f4584ee42906 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Oct 2009 15:44:26 -0400 Subject: [PATCH] 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. --- IkiWiki/Plugin/pagestats.pm | 11 +++++++---- debian/changelog | 6 +++--- 2 files changed, 10 insertions(+), 7 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; diff --git a/debian/changelog b/debian/changelog index abbd87abc..000203405 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,9 +22,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low * inline: Use a presence dependency in quick mode. * brokenlinks: Use a link dependency. This makes it much more efficient, only updating when really necessary. - * orphans: Use a combination of precense and link dependencies. - This makes it more efficient. It also fixes a longstanding bug, - where if only a small set of pages were considered by orphans, + * orphans, pagestats: Use a combination of precense and link dependencies. + This makes them more efficient. It also fixes a longstanding bug, + where if only a small set of pages were considered by orphans/pagestats, changes to links on other pages failed to cause an update. * Transitive dependencies are now correctly supported. -- 2.44.0