Allow add_depends to take an arrayref

master
Simon McVittie 2009-08-24 23:16:15 +01:00
parent 7227c2debf
commit e4cd168ebe
4 changed files with 12 additions and 9 deletions

View File

@ -1730,6 +1730,15 @@ sub add_depends ($$) {
my $page=shift; my $page=shift;
my $pagespec=shift; my $pagespec=shift;
if (ref $pagespec eq 'ARRAY') {
foreach my $ps (@$pagespec) {
if (pagespec_valid($ps)) {
$depends{$page}{$ps} = 1;
}
}
return;
}
return unless pagespec_valid($pagespec); return unless pagespec_valid($pagespec);
$depends{$page}{$pagespec} = 1; $depends{$page}{$pagespec} = 1;

View File

@ -212,9 +212,7 @@ EOF
add_depends($params{page}, $params{pages}); add_depends($params{page}, $params{pages});
# Explicitly add all currently linked pages as dependencies, so # Explicitly add all currently linked pages as dependencies, so
# that if they are removed, the calendar will be sure to be updated. # that if they are removed, the calendar will be sure to be updated.
foreach my $p (@list) { add_depends($params{page}, \@list);
add_depends($params{page}, $p);
}
return $calendar; return $calendar;
} }

View File

@ -251,9 +251,7 @@ sub preprocess_inline (@) {
# Explicitly add all currently displayed pages as dependencies, so # Explicitly add all currently displayed pages as dependencies, so
# that if they are removed or otherwise changed, the inline will be # that if they are removed or otherwise changed, the inline will be
# sure to be updated. # sure to be updated.
foreach my $p ($#list >= $#feedlist ? @list : @feedlist) { add_depends($params{page}, $#list >= $#feedlist ? \@list : \@feedlist);
add_depends($params{page}, $p);
}
if ($feeds && exists $params{feedpages}) { if ($feeds && exists $params{feedpages}) {
@feedlist=pagespec_match_list(\@feedlist, $params{feedpages}, location => $params{page}); @feedlist=pagespec_match_list(\@feedlist, $params{feedpages}, location => $params{page});

View File

@ -73,9 +73,7 @@ sub preprocess (@) {
add_depends($params{page}, $params{pages}); add_depends($params{page}, $params{pages});
# Explicitly add all currently shown pages, to detect when pages # Explicitly add all currently shown pages, to detect when pages
# are removed. # are removed.
foreach my $item (keys %mapitems) { add_depends($params{page}, [keys %mapitems]);
add_depends($params{page}, $item);
}
# Create the map. # Create the map.
my $parent=""; my $parent="";