+ # determine which links, on what pages, have changed
+ my %backlinkchanged;
+ my %linkchangers;
+ foreach my $file (@needsbuild, @del) {
+ my $page=pagename($file);
+ my %link_targets;
+ if (exists $links{$page}) {
+ foreach my $l (@{$links{$page}}) {
+ my $target=bestlink($page, $l);
+ if (! exists $oldlink_targets{$page}{$l} ||
+ $target ne $oldlink_targets{$page}{$l}) {
+ $backlinkchanged{$l}=1;
+ $linkchangers{lc($page)}=1;
+ }
+ delete $oldlink_targets{$page}{$l};
+ }
+ }
+ if (exists $oldlink_targets{$page} &&
+ %{$oldlink_targets{$page}}) {
+ foreach my $target (keys %{$oldlink_targets{$page}}) {
+ $backlinkchanged{$target}=1;
+ }
+ $linkchangers{lc($page)}=1;
+ }
+ }
+ %oldlink_targets=();
+
+ # rebuild dependant pages, recursively
+ my $deps=(@needsbuild || @del || @internal || @internal_change);
+ do {
+ $deps=0;
+ my @changed=(keys %rendered, @del);
+ my @exists_changed=(@add, @del);
+
+ my %lc_changed = map { lc(pagename($_)) => 1 } @changed;
+ my %lc_exists_changed = map { lc(pagename($_)) => 1 } @exists_changed;