]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
autoindex: Switch to using %wikistate instead of abusing $pagestate{index}.
[ikiwiki.git] / IkiWiki / Render.pm
index 5810fc974b4be7fa6dd450bde0f3c927c787b8e2..a6b0f0617256db4aff42a38c92da43d0c3085b72 100644 (file)
@@ -352,6 +352,8 @@ sub find_new_files ($) {
        my @new;
        my @internal_new;
 
+       my $times_noted;
+
        foreach my $file (@$files) {
                my $page=pagename($file);
                if (exists $pagesources{$page} && $pagesources{$page} ne $file) {
@@ -363,16 +365,33 @@ sub find_new_files ($) {
                        if (isinternal($page)) {
                                push @internal_new, $file;
                        }
-                       else {
+                       elsif ($config{rcs}) {
+                               if (! $times_noted) {
+                                       debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs}));
+                                       $times_noted=1;
+                               }
+
                                push @new, $file;
-                               if ($config{getctime} && -e "$config{srcdir}/$file") {
+                               if ($config{gettime} && -e "$config{srcdir}/$file") {
                                        eval {
-                                               my $time=rcs_getctime("$config{srcdir}/$file");
-                                               $pagectime{$page}=$time;
+                                               my $ctime=rcs_getctime("$config{srcdir}/$file");
+                                               if ($ctime > 0) {
+                                                       $pagectime{$page}=$ctime;
+                                               }
                                        };
                                        if ($@) {
                                                print STDERR $@;
                                        }
+                                       my $mtime;
+                                       eval {
+                                               $mtime=rcs_getmtime("$config{srcdir}/$file");
+                                       };
+                                       if ($@) {
+                                               print STDERR $@;
+                                       }
+                                       elsif ($mtime > 0) {
+                                               utime($mtime, $mtime, "$config{srcdir}/$file");
+                                       }
                                }
                        }
                        $pagecase{lc $page}=$page;
@@ -511,13 +530,13 @@ sub link_types_changed ($$) {
 
        while (my ($type, $links) = each %$new) {
                foreach my $link (keys %$links) {
-                       return 1 unless exists $old{$type}{$link};
+                       return 1 unless exists $old->{$type}{$link};
                }
        }
 
        while (my ($type, $links) = each %$old) {
                foreach my $link (keys %$links) {
-                       return 1 unless exists $new{$type}{$link};
+                       return 1 unless exists $new->{$type}{$link};
                }
        }
 
@@ -554,7 +573,7 @@ sub calculate_changed_links ($$$) {
                # we currently assume that changing the type of a link doesn't
                # change backlinks
                if (!exists $linkchangers{lc($page)}) {
-                       if (link_types_changed($typedlinks{$page}, $oldlinktypes{$page})) {
+                       if (link_types_changed($typedlinks{$page}, $oldtypedlinks{$page})) {
                                $linkchangers{lc($page)}=1;
                        }
                }