aggregate: Avoid uninitialized value warnings for pages with no recorded ctime.

I saw this in the wild, apparently a page was not present on disk, but was
in the aggregate db, and not marked as expired either. Not sure how that
happened, but such pages should get marked as expired since they have an
effectively zero ctime.
master
Joey Hess 2008-09-25 15:38:51 -04:00
parent 4c6d359b5f
commit 093e815440
2 changed files with 4 additions and 2 deletions

View File

@ -420,11 +420,11 @@ sub expire () { #{{{
next unless $feed->{expireage} || $feed->{expirecount};
my $count=0;
my %seen;
foreach my $item (sort { $IkiWiki::pagectime{$b->{page}} <=> $IkiWiki::pagectime{$a->{page}} }
foreach my $item (sort { ($IkiWiki::pagectime{$b->{page}} || 0) <=> ($IkiWiki::pagectime{$a->{page}} || 0) }
grep { exists $_->{page} && $_->{feed} eq $feed->{name} }
values %guids) {
if ($feed->{expireage}) {
my $days_old = (time - $IkiWiki::pagectime{$item->{page}}) / 60 / 60 / 24;
my $days_old = (time - ($IkiWiki::pagectime{$item->{page}} || 0) / 60 / 60 / 24;
if ($days_old > $feed->{expireage}) {
debug(sprintf(gettext("expiring %s (%s days old)"),
$item->{page}, int($days_old)));

2
debian/changelog vendored
View File

@ -1,6 +1,8 @@
ikiwiki (2.66) UNRELEASED; urgency=low
* recentchanges: Fix redirects to non-page files.
* aggregate: Avoid uninitialized value warnings for pages with no recorded
ctime.
-- Joey Hess <joeyh@debian.org> Thu, 25 Sep 2008 13:45:55 -0400