diff options
author | Joey Hess <joey@kitenet.net> | 2010-04-21 16:41:36 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-04-21 16:41:36 -0400 |
commit | 167964b68661de57983993efd7261a75da661665 (patch) | |
tree | c1c22918e1a1e4f7519af032faf593029a2df1be /IkiWiki | |
parent | fd6fb4c5071d9317b4388a0db6b97037cc010477 (diff) |
remember autofiles that were tried and failed to be added
This way, if an autofile is registered for a file that already exists,
it is remembered that it was tried, and it doesn't get recreated when
removed.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Render.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index b3afabf32..c3e07baf6 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -682,20 +682,29 @@ sub gen_autofile ($$$) { my $pages=shift; my $del=shift; - if (srcfile($autofile, 1) || file_pruned($autofile)) { + if (file_pruned($autofile)) { return; } - + my ($file)="$config{srcdir}/$autofile" =~ /$config{wiki_file_regexp}/; # untaint - if (! defined $file || -l $file || -d _ || -e _) { + if (! defined $file) { + return; + } + + # Remember autofiles that were tried, and never try them again later. + if (exists $wikistate{$autofiles{$autofile}{plugin}}{autofile}{$autofile}) { return; } + $wikistate{$autofiles{$autofile}{plugin}}{autofile}{$autofile}=1; - if ((!defined $file) || - (exists $wikistate{$autofiles{$autofile}{plugin}}{autofile}{$autofile})) { + if (srcfile($autofile, 1) || file_pruned($autofile)) { return; } + if (-l $file || -d _ || -e _) { + return; + } + my $page = pagename($file); if ($pages->{$page}) { return; @@ -706,7 +715,6 @@ sub gen_autofile ($$$) { } $autofiles{$autofile}{generator}->(); - $wikistate{$autofiles{$autofile}{plugin}}{autofile}{$autofile}=1; $pages->{$page}=1; return 1; } |