hook(type => "getopt", id => "aggregate", call => \&getopt);
hook(type => "getsetup", id => "aggregate", call => \&getsetup);
hook(type => "checkconfig", id => "aggregate", call => \&checkconfig);
hook(type => "getopt", id => "aggregate", call => \&getopt);
hook(type => "getsetup", id => "aggregate", call => \&getsetup);
hook(type => "checkconfig", id => "aggregate", call => \&checkconfig);
if (exists $config{aggregate_webtrigger} && $config{aggregate_webtrigger}) {
hook(type => "cgi", id => "aggregate", call => \&cgi);
}
if (exists $config{aggregate_webtrigger} && $config{aggregate_webtrigger}) {
hook(type => "cgi", id => "aggregate", call => \&cgi);
}
"aggregate" => \$config{aggregate},
"aggregateinternal!" => \$config{aggregateinternal},
);
"aggregate" => \$config{aggregate},
"aggregateinternal!" => \$config{aggregateinternal},
);
description => "enable aggregation to internal pages?",
safe => 0, # enabling needs manual transition
rebuild => 0,
description => "enable aggregation to internal pages?",
safe => 0, # enabling needs manual transition
rebuild => 0,
$feed->{template}=$params{template} . ".tmpl";
delete $feed->{unseen};
$feed->{lastupdate}=0 unless defined $feed->{lastupdate};
$feed->{template}=$params{template} . ".tmpl";
delete $feed->{unseen};
$feed->{lastupdate}=0 unless defined $feed->{lastupdate};
$feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts};
$feed->{message}=gettext("new feed") unless defined $feed->{message};
$feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts};
$feed->{message}=gettext("new feed") unless defined $feed->{message};
close OUT || error("save $newfile: $!", $cleanup);
rename($newfile, "$config{wikistatedir}/aggregate") ||
error("rename $newfile: $!", $cleanup);
close OUT || error("save $newfile: $!", $cleanup);
rename($newfile, "$config{wikistatedir}/aggregate") ||
error("rename $newfile: $!", $cleanup);
foreach my $name (keys %feeds) {
# remove any feeds that were not seen while building the pages
# that used to contain them
foreach my $name (keys %feeds) {
# remove any feeds that were not seen while building the pages
# that used to contain them
# Load the current state in from disk, and merge into it
# values from the state in memory that might have changed
# during aggregation.
# Load the current state in from disk, and merge into it
# values from the state in memory that might have changed
# during aggregation.
# It's also possible that guids were removed from the on-disk state
# while the aggregation was in process. That would only happen if
# their feed was also removed, so any removed guids added back here
# It's also possible that guids were removed from the on-disk state
# while the aggregation was in process. That would only happen if
# their feed was also removed, so any removed guids added back here
return values %feeds if $config{rebuild};
return grep { time - $_->{lastupdate} >= $_->{updateinterval} } values %feeds;
return values %feeds if $config{rebuild};
return grep { time - $_->{lastupdate} >= $_->{updateinterval} } values %feeds;
+ # XML::Feed doesn't work around XML::Atom's bizarre
+ # API, so we will. Real unicode strings? Yes please.
+ # See [[bugs/Aggregated_Atom_feeds_are_double-encoded]]
+ local $XML::Atom::ForceUnicode = 1;
+
my $c=$entry->content;
# atom feeds may have no content, only a summary
if (! defined $c && ref $entry->summary) {
my $c=$entry->content;
# atom feeds may have no content, only a summary
if (! defined $c && ref $entry->summary) {
# creation time on record for the new page.
utime $mtime, $mtime, "$config{srcdir}/".htmlfn($guid->{page});
# Store it in pagectime for expiry code to use also.
# creation time on record for the new page.
utime $mtime, $mtime, "$config{srcdir}/".htmlfn($guid->{page});
# Store it in pagectime for expiry code to use also.
# escape accidental wikilinks and preprocessor stuff
return encode_entities(shift, '\[\]');
# escape accidental wikilinks and preprocessor stuff
return encode_entities(shift, '\[\]');
# Convert links in html from relative to absolute.
# Note that this is a heuristic, which is not specified by the rss
# spec and may not be right for all feeds. Also, see Debian
# Convert links in html from relative to absolute.
# Note that this is a heuristic, which is not specified by the rss
# spec and may not be right for all feeds. Also, see Debian
# Take an exclusive lock to prevent multiple concurrent aggregators.
# Returns true if the lock was aquired.
if (! -d $config{wikistatedir}) {
# Take an exclusive lock to prevent multiple concurrent aggregators.
# Returns true if the lock was aquired.
if (! -d $config{wikistatedir}) {