- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
-
- my %linkedto;
- foreach my $p (keys %links) {
- map { $linkedto{bestlink($p, $_)}=1 if length $_ }
- @{$links{$p}};
- }
+ # Needs to update whenever a link changes, on any page
+ # since any page could link to one of the pages we're
+ # considering as orphans.
+ add_depends($params{page}, "*", links => 1);
+ # Also needs to update whenever potential orphans are added or
+ # removed.
+ add_depends($params{page}, $params{pages}, presence => 1);