From 743f69c675de6bdf240a2980e0924ed9d3bb782b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:31:51 -0400 Subject: add dependency type parameters to add_depends Dependency types are represented by bits in the values of the %depends and %depends_simple hashes. Change the dependslist array saved to the index to a depends hash. depends_simple is also converted from an array to a hash. Note that the depends field used to be a string, and we still have compat code to handle upgrades from that, as well as from the arrays. I didn't use ikiwiki-transition because I don't want ikiwiki to break if users forget to run it; also we're going to recommend a full rebuild on upgrade to this version to get the improved dependency handling. So this compat code can be removed or moved to ikiwiki-transition later. --- IkiWiki.pm | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 2637f6017..67149bc8b 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -28,6 +28,10 @@ our $VERSION = 3.00; # plugin interface version, next is ikiwiki version our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE our $installdir='/usr'; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE +# Page dependency types. +our $DEPEND_EXISTS=1; +our $DEPEND_CONTENT=2; + # Optimisation. use Memoize; memoize("abs2rel"); @@ -1524,18 +1528,28 @@ sub loadindex () { $links{$page}=$d->{links}; $oldlinks{$page}=[@{$d->{links}}]; } - if (exists $d->{depends_simple}) { + if (ref $d->{depends_simple} eq 'ARRAY') { + # old format $depends_simple{$page}={ map { $_ => 1 } @{$d->{depends_simple}} }; } + elsif (exists $d->{depends_simple}) { + $depends{$page}=$d->{depends_simple}; + } if (exists $d->{dependslist}) { + # old format $depends{$page}={ - map { $_ => 1 } @{$d->{dependslist}} + map { $_ => $DEPEND_CONTENT | $DEPEND_EXISTS } + @{$d->{dependslist}} }; } + elsif (exists $d->{depends} && ! ref $d->{depends}) { + # old format + $depends{$page}={$d->{depends} => $DEPEND_CONTENT | $DEPEND_EXISTS}; + } elsif (exists $d->{depends}) { - $depends{$page}={$d->{depends} => 1}; + $depends{$page}=$d->{depends}; } if (exists $d->{state}) { $pagestate{$page}=$d->{state}; @@ -1581,11 +1595,11 @@ sub saveindex () { }; if (exists $depends{$page}) { - $index{page}{$src}{dependslist} = [ keys %{$depends{$page}} ]; + $index{page}{$src}{depends} = $depends{$page}; } if (exists $depends_simple{$page}) { - $index{page}{$src}{depends_simple} = [ keys %{$depends_simple{$page}} ]; + $index{page}{$src}{depends_simple} = $depends_simple{$page}; } if (exists $pagestate{$page}) { @@ -1753,20 +1767,28 @@ sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); } -sub add_depends ($$) { +sub add_depends ($$;@) { my $page=shift; my $pagespec=shift; + my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS; + if (@_) { + my %params=@_; + if (defined $params{content} && $params{content} == 0) { + $deptype=$deptype & ~$DEPEND_CONTENT; + } + } + if ($pagespec =~ /$config{wiki_file_regexp}/ && $pagespec !~ /[\s*?()!]/) { # a simple dependency, which can be matched by string eq - $depends_simple{$page}{lc $pagespec} = 1; + $depends_simple{$page}{lc $pagespec} |= $deptype; return 1; } return unless pagespec_valid($pagespec); - $depends{$page}{$pagespec} = 1; + $depends{$page}{$pagespec} |= $deptype; return 1; } -- cgit v1.2.3 From dc4e44adf13bc20c0a801f2b176370f330841098 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:36:23 -0400 Subject: pagecount: Use contentless dependency This will avoid lots of unnecessary updates of pages using the pagecount directive. Yay! --- IkiWiki/Plugin/pagecount.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 5a2301af4..17eda0618 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -23,8 +23,8 @@ sub preprocess (@) { $params{pages}="*" unless defined $params{pages}; # Needs to update count whenever a page is added or removed, so - # register a dependency. - add_depends($params{page}, $params{pages}); + # register a contentless dependency. + add_depends($params{page}, $params{pages}, content => 0); my @pages; if ($params{pages} eq "*") { -- cgit v1.2.3 From 5c9f65a67294e3e7b2759306c182b7eedc93093d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:37:15 -0400 Subject: set dependency hash value properly for new dependency types Just "1" won't cut it anymore; we need to list all the dependency types. --- ikiwiki-transition | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ikiwiki-transition b/ikiwiki-transition index 8a20cf655..c50a748e8 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -299,7 +299,7 @@ sub oldloadindex { $pagemtime{$page}=$items{mtime}[0]; $oldlinks{$page}=[@{$items{link}}]; $links{$page}=[@{$items{link}}]; - $depends{$page}={ $items{depends}[0] => 1 } if exists $items{depends}; + $depends{$page}={ $items{depends}[0] => $IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_EXISTS } if exists $items{depends}; $destsources{$_}=$page foreach @{$items{dest}}; $renderedfiles{$page}=[@{$items{dest}}]; $pagecase{lc $page}=$page; -- cgit v1.2.3 From fd9d9680242c0d1c835fc56f969f8e2a2618a5de Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:37:57 -0400 Subject: document add_depends dependency type interface --- doc/plugins/write.mdwn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 668f8d8b6..c244c1f2f 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -609,10 +609,17 @@ page created from it. (Ie, it appends ".html".) Use this when constructing the filename of a html file. Use `urlto` when generating a link to a page. -#### `add_depends($$)` +#### `add_depends($$;@)` Makes the specified page depend on the specified [[ikiwiki/PageSpec]]. +Additional named parameters can be passed, to indicate what type of +dependency this is. + +Currently, only a "content" parameter is specified. If set to 0, the +dependency does not involve the content of pages matching the PageSpec, but +only their existence. + #### `pagespec_match($$;@)` Passed a page name, and [[ikiwiki/PageSpec]], returns true if the -- cgit v1.2.3 From 49b71d0615f3ec995e8958ede6baaae8524d1986 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:38:18 -0400 Subject: update --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index ca5409af7..bec1a61d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,12 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low * mirrorlist: Display nothing if list is empty. * Fix a bug that could lead to duplicate links being recorded for tags. + * Added support framework for multiple types of dependencies. + * Allow declaring that a dependency does not encompass the content of a + page. (By passing content => 0 to add_depends.) + * pagecount: Use a contentless dependency, which makes this + directive much less expensive to use, since page edits will + no longer trigger an unnecessary update of the page count. -- Joey Hess Sun, 27 Sep 2009 17:40:03 -0400 -- cgit v1.2.3 From 26dbc09bd88ba6c33c18995c2b028726c370012f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:46:53 -0400 Subject: implement support for DEPEND_EXISTS Preliminary support, anyway. If a dependency only includes DEPEND_EXISTS, then only changes that involved adding or deleting a page can trigger it. This is complicated by internal pages, since the code did not previously differentiate between add, delete, and change of internal pages. Now it tracks change separately from add+delete, so DEPEND_EXISTS pagespecs that actually match internal pages (which will probably be quite rare in practice) should work. --- IkiWiki/Render.pm | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 246c2260d..9e00428c2 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -342,7 +342,7 @@ sub refresh () { run_hooks(refresh => sub { shift->() }); my ($files, $exists)=find_src_files(); - my (%rendered, @add, @del, @internal); + my (%rendered, @add, @del, @internal, @internal_change); # check for added or removed pages foreach my $file (@$files) { my $page=pagename($file); @@ -407,7 +407,7 @@ sub refresh () { $forcerebuild{$page}) { $pagemtime{$page}=$stat[9]; if (isinternal($page)) { - push @internal, $file; + push @internal_change, $file; # Preprocess internal page in scan-only mode. preprocess($page, $page, readfile($srcfile), 1); } @@ -429,7 +429,7 @@ sub refresh () { render($file); $rendered{$file}=1; } - foreach my $file (@internal) { + foreach my $file (@internal, @internal_change) { # internal pages are not rendered my $page=pagename($file); delete $depends{$page}; @@ -454,10 +454,12 @@ sub refresh () { } } - if (%rendered || @del || @internal) { + if (%rendered || @del || @internal || @internal_change) { my @changed=(keys %rendered, @del); + my @exists_changed=(@add, @del); - my %lcchanged = map { lc(pagename($_)) => 1 } @changed; + my %lc_changed = map { lc(pagename($_)) => 1 } @changed; + my %lc_exists_changed = map { lc(pagename($_)) => 1 } @exists_changed; # rebuild dependant pages foreach my $f (@$files) { @@ -467,7 +469,13 @@ sub refresh () { if (exists $depends_simple{$p}) { foreach my $d (keys %{$depends_simple{$p}}) { - if (exists $lcchanged{$d}) { + if ($depends_simple{$p}{$d} == $IkiWiki::DEPEND_EXISTS) { + if (exists $lc_exists_changed{$d}) { + $reason = $d; + last; + } + } + elsif (exists $lc_changed{$d}) { $reason = $d; last; } @@ -479,10 +487,26 @@ sub refresh () { my $sub=pagespec_translate($d); next if $@ || ! defined $sub; + my @candidates; + if ($depends{$p}{$d} == $IkiWiki::DEPEND_EXISTS) { + @candidates=@exists_changed; + } + else { + @candidates=@changed; + } # only consider internal files # if the page explicitly depends # on such files - foreach my $file (@changed, $d =~ /internal\(/ ? @internal : ()) { + if ($d =~ /internal\(/) { + if ($depends{$p}{$d} == $IkiWiki::DEPEND_EXISTS) { + push @candidates, @internal; + } + else { + push @candidates, @internal, @internal_change; + } + } + + foreach my $file (@candidates) { next if $file eq $f; my $page=pagename($file); if ($sub->($page, location => $p)) { -- cgit v1.2.3 From 6eaf9e40154050936ad9184d64295664da2cc83c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 15:55:11 -0400 Subject: orphans and brokenlinks cannot use contentless dependency Tried a contentless dep and it does not work; changes to links in pages are not noticed. Drat. --- IkiWiki/Plugin/brokenlinks.pm | 4 ++-- IkiWiki/Plugin/orphans.pm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index eb698b0be..b8ed2b8de 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm @@ -23,8 +23,8 @@ sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; - # Needs to update whenever a page is added or removed, so - # register a dependency. + # Needs to update whenever a page is changed, + # added or removed, in order to see the link changes. add_depends($params{page}, $params{pages}); my @broken; diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 711226772..d981670e7 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -23,8 +23,8 @@ sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; - # Needs to update whenever a page is added or removed, so - # register a dependency. + # Needs to update whenever a page is changed, added, or removed, + # in order to see the link changes. add_depends($params{page}, $params{pages}); my @orphans; -- cgit v1.2.3 From 5fd230f9688bf7400f5ef962073bac8bc031e738 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 15:34:42 -0400 Subject: detect pagespecs that require content dependencies When adding a contentless dependency, the pagespec also needs to be one that does not look at any page content information. As a first approximation of that, only allow glob-based pagespecs in contentless dependencies. While there are probably a few other types of pagespecs that can match contentless, this will work for most of them. --- IkiWiki.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 67149bc8b..56e2d4e71 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1774,7 +1774,8 @@ sub add_depends ($$;@) { my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS; if (@_) { my %params=@_; - if (defined $params{content} && $params{content} == 0) { + if (defined $params{content} && $params{content} == 0 && + pagespec_contentless($pagespec)) { $deptype=$deptype & ~$DEPEND_CONTENT; } } @@ -1974,6 +1975,20 @@ sub pagespec_valid ($) { return ! $@; } +sub pagespec_contentless ($) { + my $spec=shift; + + while ($spec=~m{ + (\w+)\([^\)]*\) # only match pagespec functions + }igx) { + # only glob and internal can be matched contentless + # (first approximation) + return 0 if $1 ne "glob" && $1 ne "internal"; + } + + return 1; +} + sub glob2re ($) { my $re=quotemeta(shift); $re=~s/\\\*/.*/g; -- cgit v1.2.3 From daafdf1acb426e0abae218a04c8b22e8b9885354 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 15:43:38 -0400 Subject: optimise add_depends for simple pagespecs We don't need to check if the pagespec is contentless; all simple ones are. --- IkiWiki.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 56e2d4e71..c059a9b9f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1771,18 +1771,19 @@ sub add_depends ($$;@) { my $page=shift; my $pagespec=shift; + my $simple=$pagespec =~ /$config{wiki_file_regexp}/ && + $pagespec !~ /[\s*?()!]/; + my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS; if (@_) { my %params=@_; if (defined $params{content} && $params{content} == 0 && - pagespec_contentless($pagespec)) { + ($simple || pagespec_contentless($pagespec))) { $deptype=$deptype & ~$DEPEND_CONTENT; } } - if ($pagespec =~ /$config{wiki_file_regexp}/ && - $pagespec !~ /[\s*?()!]/) { - # a simple dependency, which can be matched by string eq + if ($simple) { $depends_simple{$page}{lc $pagespec} |= $deptype; return 1; } -- cgit v1.2.3 From 2fbfcd16e6d5717fea7b23d7fa82961222a6e32f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 15:46:23 -0400 Subject: map: Use a contentless dependency unless show= is specified. This makes simple maps efficient enough that they can be used on sidebars! --- IkiWiki/Plugin/map.pm | 8 ++++---- debian/changelog | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 54146dc46..682960777 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -68,13 +68,13 @@ sub preprocess (@) { } # Needs to update whenever a page is added or removed (or in some - # cases, when its content changes, if show=title), so register a - # dependency. - add_depends($params{page}, $params{pages}); + # cases, when its content changes, if show= is specified), so + # register a dependency. + add_depends($params{page}, $params{pages}, content => exists $params{show}); # Explicitly add all currently shown pages, to detect when pages # are removed. foreach my $item (keys %mapitems) { - add_depends($params{page}, $item); + add_depends($params{page}, $item, content => exists $params{show}); } # Create the map. diff --git a/debian/changelog b/debian/changelog index bec1a61d3..ae39d4847 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low * pagecount: Use a contentless dependency, which makes this directive much less expensive to use, since page edits will no longer trigger an unnecessary update of the page count. + * map: Use a contentless dependency unless show= is specified. + This makes simple maps efficient enough that they can be used on sidebars! -- Joey Hess Sun, 27 Sep 2009 17:40:03 -0400 -- cgit v1.2.3 From da5c12e9ebb6bad5e73b0b709d0bcc82657ac8e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:01:56 -0400 Subject: expand the set of things that can be matched contentless --- IkiWiki.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index c059a9b9f..5e5dc739d 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1982,9 +1982,7 @@ sub pagespec_contentless ($) { while ($spec=~m{ (\w+)\([^\)]*\) # only match pagespec functions }igx) { - # only glob and internal can be matched contentless - # (first approximation) - return 0 if $1 ne "glob" && $1 ne "internal"; + return 0 unless $1=~/^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after)$/; } return 1; -- cgit v1.2.3 From e529c561f548fa2d277b8cb7c123c3a46a0427a4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:03:01 -0400 Subject: inline: Use a contentless dependency in quick mode. --- IkiWiki/Plugin/inline.pm | 7 +++---- debian/changelog | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index ccfadfd69..5133c4ba6 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -197,7 +197,7 @@ sub preprocess_inline (@) { split ' ', $params{pagenames}; } else { - add_depends($params{page}, $params{pages}); + add_depends($params{page}, $params{pages}, content => ! $quick); @list = pagespec_match_list( [ grep { $_ ne $params{page} } keys %pagesources ], @@ -248,10 +248,9 @@ sub preprocess_inline (@) { } # Explicitly add all currently displayed pages as dependencies, so - # that if they are removed or otherwise changed, the inline will be - # sure to be updated. + # that if they are removed, the inline will be sure to be updated. foreach my $p ($#list >= $#feedlist ? @list : @feedlist) { - add_depends($params{page}, $p); + add_depends($params{page}, $p, content => ! $quick); } if ($feeds && exists $params{feedpages}) { diff --git a/debian/changelog b/debian/changelog index ae39d4847..9d03ae990 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low no longer trigger an unnecessary update of the page count. * map: Use a contentless dependency unless show= is specified. This makes simple maps efficient enough that they can be used on sidebars! + * inline: Use a contentless dependency in quick mode. -- Joey Hess Sun, 27 Sep 2009 17:40:03 -0400 -- cgit v1.2.3 From a6689f9c7a1ecad02b51962c0858df47352c4648 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:05:41 -0400 Subject: calendar: all dependencies are contentless --- IkiWiki/Plugin/calendar.pm | 21 ++++++++++++--------- debian/changelog | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 5d16dff75..a5cc20882 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -104,19 +104,22 @@ sub format_month (@) { "$archivebase/$year/".sprintf("%02d", $month), linktext => " $monthname "); } - add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month)); + add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month), + content => 0); if (exists $cache{$pagespec}{"$pyear/$pmonth"}) { $purl = htmllink($params{page}, $params{destpage}, "$archivebase/$pyear/" . sprintf("%02d", $pmonth), linktext => " $pmonthname "); } - add_depends($params{page}, "$archivebase/$pyear/".sprintf("%02d", $pmonth)); + add_depends($params{page}, "$archivebase/$pyear/".sprintf("%02d", $pmonth), + content => 0); if (exists $cache{$pagespec}{"$nyear/$nmonth"}) { $nurl = htmllink($params{page}, $params{destpage}, "$archivebase/$nyear/" . sprintf("%02d", $nmonth), linktext => " $nmonthname "); } - add_depends($params{page}, "$archivebase/$nyear/".sprintf("%02d", $nmonth)); + add_depends($params{page}, "$archivebase/$nyear/".sprintf("%02d", $nmonth), + content => 0); # Start producing the month calendar $calendar=< 0); # Explicitly add all currently linked pages as dependencies, so # that if they are removed, the calendar will be sure to be updated. foreach my $p (@list) { - add_depends($params{page}, $p); + add_depends($params{page}, $p, content => 0); } return $calendar; @@ -246,19 +249,19 @@ sub format_year (@) { "$archivebase/$year", linktext => "$year"); } - add_depends($params{page}, "$archivebase/$year"); + add_depends($params{page}, "$archivebase/$year", content => 0); if (exists $cache{$pagespec}{"$pyear"}) { $purl = htmllink($params{page}, $params{destpage}, "$archivebase/$pyear", linktext => "\←"); } - add_depends($params{page}, "$archivebase/$pyear"); + add_depends($params{page}, "$archivebase/$pyear", content => 0); if (exists $cache{$pagespec}{"$nyear"}) { $nurl = htmllink($params{page}, $params{destpage}, "$archivebase/$nyear", linktext => "\→"); } - add_depends($params{page}, "$archivebase/$nyear"); + add_depends($params{page}, "$archivebase/$nyear", content => 0); # Start producing the year calendar $calendar=<$monthabbr\n}; } - add_depends($params{page}, "$archivebase/$year/$mtag"); + add_depends($params{page}, "$archivebase/$year/$mtag", content => 0); $calendar.=qq{\t\n} if ($month % $params{months_per_row} == 0); } diff --git a/debian/changelog b/debian/changelog index 9d03ae990..1a76303b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,9 +13,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low * Added support framework for multiple types of dependencies. * Allow declaring that a dependency does not encompass the content of a page. (By passing content => 0 to add_depends.) - * pagecount: Use a contentless dependency, which makes this - directive much less expensive to use, since page edits will - no longer trigger an unnecessary update of the page count. + * pagecount, calendar: Use a contentless dependency, which makes these + directives much less expensive to use, since page edits will + no longer trigger an unnecessary update. * map: Use a contentless dependency unless show= is specified. This makes simple maps efficient enough that they can be used on sidebars! * inline: Use a contentless dependency in quick mode. -- cgit v1.2.3 From ce78b699278be0797316518079474bc776d657ed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:07:02 -0400 Subject: edittemplate: contentless dependency This one is unlikely to matter much, but yeah, it's contentless. --- IkiWiki/Plugin/edittemplate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 0bafc95d0..89d450725 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -58,7 +58,7 @@ sub preprocess (@) { $pagestate{$params{page}}{edittemplate}{$params{match}}=$link; return "" if ($params{silent} && IkiWiki::yesno($params{silent})); - add_depends($params{page}, $link); + add_depends($params{page}, $link, content => 0); return sprintf(gettext("edittemplate %s registered for %s"), htmllink($params{page}, $params{destpage}, $link), $params{match}); -- cgit v1.2.3 From de6eba6ddde9f6d4577b49b204dcdd9f1a203ed4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:10:34 -0400 Subject: not a contentless dependency needs link info --- IkiWiki/Plugin/linkmap.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 941ed5f36..d0671ae0e 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -28,8 +28,8 @@ sub preprocess (@) { $params{pages}="*" unless defined $params{pages}; - # Needs to update whenever a page is added or removed, so - # register a dependency. + # Needs to update whenever a page is added, removed, or + # its links change, so register a dependency. add_depends($params{page}, $params{pages}); # Can't just return the linkmap here, since the htmlscrubber -- cgit v1.2.3 From 2af988b86fca6d2ca9476ae698cf1e840969af78 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:11:10 -0400 Subject: listdirectives: contentless dependency Another one that probably doesn't matter, but for completness. --- IkiWiki/Plugin/listdirectives.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index bd73f1a04..96150f986 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -84,7 +84,7 @@ sub preprocess (@) { foreach my $plugin (@pluginlist) { $result .= '
  • '; my $link=linkpage($config{directive_description_dir}."/".$plugin); - add_depends($params{page}, $link); + add_depends($params{page}, $link, content => 0); $result .= htmllink($params{page}, $params{destpage}, $link); $result .= '
  • '; } -- cgit v1.2.3 From 66852de77553a6131569436d4531c69a4515a4d3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:12:05 -0400 Subject: meta redir dependency is contentless --- IkiWiki/Plugin/meta.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 514b09369..eef3013a0 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -195,7 +195,7 @@ sub preprocess (@) { if (! length $link) { error gettext("redir page not found") } - add_depends($page, $link); + add_depends($page, $link, content => 0); $value=urlto($link, $page); $value.='#'.$redir_anchor if defined $redir_anchor; -- cgit v1.2.3 From 7982c3c1773feef0d7f248ff3efe09dd2cd94ad8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:16:50 -0400 Subject: postsparkline and progress: also contentless dependencies --- IkiWiki/Plugin/postsparkline.pm | 2 +- IkiWiki/Plugin/progress.pm | 4 ++-- debian/changelog | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index d2e5c2378..694d39575 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -48,7 +48,7 @@ sub preprocess (@) { error gettext("unknown formula"); } - add_depends($params{page}, $params{pages}); + add_depends($params{page}, $params{pages}, content => 0); my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} } pagespec_match_list( diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm index 76d994acc..3b664f4cb 100644 --- a/IkiWiki/Plugin/progress.pm +++ b/IkiWiki/Plugin/progress.pm @@ -36,8 +36,8 @@ sub preprocess (@) { $fill.="%"; } elsif (defined $params{totalpages} and defined $params{donepages}) { - add_depends($params{page}, $params{totalpages}); - add_depends($params{page}, $params{donepages}); + add_depends($params{page}, $params{totalpages}, content => 0); + add_depends($params{page}, $params{donepages}, content => 0); my @pages=keys %pagesources; my $totalcount=0; diff --git a/debian/changelog b/debian/changelog index 1a76303b1..0e9bf512b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,9 +13,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low * Added support framework for multiple types of dependencies. * Allow declaring that a dependency does not encompass the content of a page. (By passing content => 0 to add_depends.) - * pagecount, calendar: Use a contentless dependency, which makes these - directives much less expensive to use, since page edits will - no longer trigger an unnecessary update. + * pagecount, calendar, postsparkline, progress: Use a contentless dependency, + which makes these directives much less expensive to use, since page + edits will no longer trigger an unnecessary update. * map: Use a contentless dependency unless show= is specified. This makes simple maps efficient enough that they can be used on sidebars! * inline: Use a contentless dependency in quick mode. -- cgit v1.2.3 From a8af271e5aed1c4aef3f66cee0847d609aedc705 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 16:28:14 -0400 Subject: document effect of contentless dependencies on sidebar efficiency --- doc/plugins/sidebar.mdwn | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/plugins/sidebar.mdwn b/doc/plugins/sidebar.mdwn index 36982eff3..4e356d65a 100644 --- a/doc/plugins/sidebar.mdwn +++ b/doc/plugins/sidebar.mdwn @@ -16,6 +16,10 @@ will turn off the sidebar altogether. Warning: Any change to the sidebar will cause a rebuild of the whole wiki, since every page includes a copy that has to be updated. This can -especially be a problem if the sidebar includes [[inline]] or [[map]] -directives, since any changes to pages inlined or mapped onto the sidebar +especially be a problem if the sidebar includes an [[ikiwiki/directive/inline]] +directive, since any changes to pages inlined into the sidebar will change the sidebar and cause a full wiki rebuild. + +Instead, if you include a [[ikiwiki/directive/map]] directive on the sidebar, +and it does not use the `show` parameter, only adding or removing pages +included in the map will cause a full rebuild. Modifying pages will not. -- cgit v1.2.3