Revert the effects of find_del_files() for (re)autoadded files.

This also means that if autoadded files are deleted they will just be
recreated.
master
David Riebenbauer 2010-02-02 11:01:24 +01:00
parent a8d313aba1
commit f58f3e1bec
2 changed files with 11 additions and 1 deletions

View File

@ -14,7 +14,8 @@ use open qw{:utf8 :std};
use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%pagestate %wikistate %renderedfiles %oldrenderedfiles %pagestate %wikistate %renderedfiles %oldrenderedfiles
%pagesources %destsources %depends %depends_simple %hooks %pagesources %destsources %depends %depends_simple %hooks
%forcerebuild %loaded_plugins @autofiles}; %forcerebuild %loaded_plugins @autofiles %dellinks
%delrenderedfiles};
use Exporter q{import}; use Exporter q{import};
our @EXPORT = qw(hook debug error template htmlpage deptype our @EXPORT = qw(hook debug error template htmlpage deptype

View File

@ -392,7 +392,9 @@ sub find_del_files ($) {
else { else {
push @del, $pagesources{$page}; push @del, $pagesources{$page};
} }
$dellinks{$page}= $links{$page};
$links{$page}=[]; $links{$page}=[];
$delrenderedfiles{$page}= $renderedfiles{$page};
$renderedfiles{$page}=[]; $renderedfiles{$page}=[];
$pagemtime{$page}=0; $pagemtime{$page}=0;
} }
@ -642,8 +644,14 @@ sub refresh () {
scan($file); scan($file);
} }
my %del_hash = map {$_, 1} @$del;
while (my $autofile = shift (@autofiles)) { while (my $autofile = shift (@autofiles)) {
my $page=pagename($autofile); my $page=pagename($autofile);
if (exists $del_hash{$page}) {
$links{$page}= $dellinks{$page};
$renderedfiles{$page}= $delrenderedfiles{$page};
delete $del_hash{$page};
}
if ($pages->{$page}) { if ($pages->{$page}) {
debug(sprintf(gettext("%s has multiple possible source pages"), $page)); debug(sprintf(gettext("%s has multiple possible source pages"), $page));
} }
@ -655,6 +663,7 @@ sub refresh () {
scan($autofile); scan($autofile);
} }
$del = [keys %del_hash];
calculate_links(); calculate_links();