sub checkconfig () { #{{{
if ($config{aggregate} && ! ($config{post_commit} &&
IkiWiki::commit_hook_enabled())) {
- # don't wait for the lock
- IkiWiki::lockwiki(0) || exit 1;
+ if (! IkiWiki::lockwiki(0)) {
+ debug("wiki is locked by another process, not aggregating");
+ exit 1;
+ }
loadstate();
IkiWiki::loadindex();
aggregate();
expire();
savestate();
+ clearstate();
IkiWiki::unlockwiki();
}
sub loadstate () { #{{{
return if $state_loaded;
if (-e "$config{wikistatedir}/aggregate") {
- open (IN, "$config{wikistatedir}/aggregate" ||
- die "$config{wikistatedir}/aggregate: $!");
+ open(IN, "$config{wikistatedir}/aggregate") ||
+ die "$config{wikistatedir}/aggregate: $!";
while (<IN>) {
$_=IkiWiki::possibly_foolish_untaint($_);
chomp;
error("rename $newfile: $!", $cleanup);
} #}}}
+sub clearstate () { #{{{
+ %feeds=();
+ %guids=();
+ $state_loaded=0;
+} #}}}
+
sub expire () { #{{{
foreach my $feed (values %feeds) {
next unless $feed->{expireage} || $feed->{expirecount};
} #}}}
sub htmlfn ($) { #{{{
- return shift().".html";
+ return shift().".".$config{htmlext};
} #}}}
1