X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/cad753baf9b25ddd8e4cb5454766fce1cdc4217a..60188d728080c3e558b647d7595ea376944f51d0:/IkiWiki/Render.pm diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 9e93534c6..9d6f636a2 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -154,7 +154,7 @@ sub genpage ($$) { sub scan ($) { my $file=shift; - return if $scanned{$file}; + return if $phase > PHASE_SCAN || $scanned{$file}; $scanned{$file}=1; debug(sprintf(gettext("scanning %s"), $file)); @@ -473,7 +473,8 @@ sub find_new_files ($) { } $pagecase{lc $page}=$page; if (! exists $pagectime{$page}) { - $pagectime{$page}=(srcfile_stat($file))[10]; + my $ctime=(srcfile_stat($file, 1))[10]; + $pagectime{$page}=$ctime if defined $ctime; } } } @@ -533,10 +534,11 @@ sub find_changed ($) { my @internal_changed; foreach my $file (@$files) { my $page=pagename($file); - my ($srcfile, @stat)=srcfile_stat($file); - if (! exists $pagemtime{$page} || - $stat[9] > $pagemtime{$page} || - $forcerebuild{$page}) { + my ($srcfile, @stat)=srcfile_stat($file, 1); + if (defined $srcfile && + (! exists $pagemtime{$page} || + $stat[9] > $pagemtime{$page} || + $forcerebuild{$page})) { $pagemtime{$page}=$stat[9]; if (isinternal($page)) { @@ -827,6 +829,8 @@ sub gen_autofile ($$$) { } sub refresh () { + $phase = PHASE_SCAN; + srcdir_check(); run_hooks(refresh => sub { shift->() }); my ($files, $pages, $new, $internal_new, $del, $internal_del, $changed, $internal_changed); @@ -878,7 +882,13 @@ sub refresh () { } calculate_links(); - + + # At this point it becomes OK to start matching pagespecs. + $phase = PHASE_RENDER; + # Save some memory: we no longer need to keep track of which pages + # we've scanned + %scanned = (); + remove_del(@$del, @$internal_del); foreach my $file (@$changed) { @@ -942,6 +952,10 @@ sub commandline_render () { loadindex(); unlockwiki(); + # This function behaves as though it's in the render phase; + # all other files are assumed to have been scanned last time. + $phase = PHASE_RENDER; + my $srcfile=possibly_foolish_untaint($config{render}); my $file=$srcfile; $file=~s/\Q$config{srcdir}\E\/?//;