]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Avoid unnecessary stat calls to get mtime when rendering pages, use
authorJoey Hess <joey@kitenet.net>
Wed, 12 Dec 2007 19:43:35 +0000 (14:43 -0500)
committerJoey Hess <joey@kitenet.net>
Wed, 12 Dec 2007 19:43:35 +0000 (14:43 -0500)
  cached value.
* Preserve input file modification times in output files.

IkiWiki/Render.pm
debian/changelog

index e4ff2b39b9fdfeb579f31cca750017ec4ad7cb41..047ab8212f16591bdcf3daf03d36c7436f4cb819 100644 (file)
@@ -64,10 +64,9 @@ sub parentlinks ($) { #{{{
        return @ret;
 } #}}}
 
-sub genpage ($$$) { #{{{
+sub genpage ($$) { #{{{
        my $page=shift;
        my $content=shift;
-       my $mtime=shift;
 
        my $templatefile;
        run_hooks(templatefile => sub {
@@ -129,7 +128,7 @@ sub genpage ($$$) { #{{{
                content => $content,
                backlinks => $backlinks,
                more_backlinks => $more_backlinks,
-               mtime => displaytime($mtime),
+               mtime => displaytime($pagemtime{$page}),
                baseurl => baseurl($page),
        );
 
@@ -204,8 +203,9 @@ sub render ($) { #{{{
                        filter($page, $page,
                        readfile($srcfile)))));
                
-               writefile(htmlpage($page), $config{destdir},
-                       genpage($page, $content, mtime($srcfile)));
+               my $output=htmlpage($page);
+               writefile($output, $config{destdir}, genpage($page, $content));
+               utime($pagemtime{$page}, $pagemtime{$page}, $config{destdir}."/".$output);
        }
        else {
                my $srcfd=readfile($srcfile, 1, 1);
@@ -231,6 +231,7 @@ sub render ($) { #{{{
                                }
                        }
                });
+               utime($pagemtime{$file}, $pagemtime{$file}, $config{destdir}."/".$file);
        }
 } #}}}
 
@@ -485,8 +486,9 @@ sub commandline_render () { #{{{
        $content=preprocess($page, $page, $content);
        $content=linkify($page, $page, $content);
        $content=htmlize($page, $type, $content);
+       $pagemtime{$page}=mtime($srcfile);
 
-       print genpage($page, $content, mtime($srcfile));
+       print genpage($page, $content);
        exit 0;
 } #}}}
 
index 5f05f7a0f424297c860d56594c43699850ad574f..af413c831709dc30270ef9742514b130b78f2bd0 100644 (file)
@@ -25,6 +25,9 @@ ikiwiki (2.16) UNRELEASED; urgency=low
     I believe this is a safe change, since only passwordauth uses this hook.
     (If some other plugin already used it, it would have broken passwordauth!)
   * Ensure that web edited pages always end in a newline.
+  * Avoid unnecessary stat calls to get mtime when rendering pages, use
+    cached value.
+  * Preserve input file modification times in output files.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 03 Dec 2007 14:47:36 -0500