From 093e8154408d9a7517a0df1768f44ad581c70be2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 25 Sep 2008 15:38:51 -0400 Subject: [PATCH] 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. --- IkiWiki/Plugin/aggregate.pm | 4 ++-- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 2b40625db..07c557bcd 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -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))); diff --git a/debian/changelog b/debian/changelog index f3f30dc21..ff119a314 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 25 Sep 2008 13:45:55 -0400 -- 2.39.5