]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
use same error string as template.pm does
[ikiwiki.git] / IkiWiki / Render.pm
index b3afabf32fad0c6362227776f201b3aeefd955f9..7cf19645e17c07fa0b0833e161bb12a88ac3e4bc 100644 (file)
@@ -74,7 +74,9 @@ sub genpage ($$) {
                        $templatefile=$file;
                }
        });
-       my $template=template(defined $templatefile ? $templatefile : 'page.tmpl', blind_cache => 1);
+       my $template=template_depends(
+               defined $templatefile ? $templatefile : 'page.tmpl', $page,
+               blind_cache => 1);
        my $actions=0;
 
        if (length $config{cgiurl}) {
@@ -517,7 +519,7 @@ sub link_types_changed ($$) {
        my $old = shift;
 
        return 0 if !defined $new && !defined $old;
-       return 1 if !defined $new || !defined $old;
+       return 1 if (!defined $new && %$old) || (!defined $old && %$new);
 
        while (my ($type, $links) = each %$new) {
                foreach my $link (keys %$links) {
@@ -682,20 +684,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 +717,6 @@ sub gen_autofile ($$$) {
        }
 
        $autofiles{$autofile}{generator}->();
-       $wikistate{$autofiles{$autofile}{plugin}}{autofile}{$autofile}=1;
        $pages->{$page}=1;
        return 1;
 }