X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/36f5e63d7310495f0997b95f8058c3c518a1341d..2fe003dac47259aabfc7603ce60ead5a4030c80c:/IkiWiki/Plugin/calendar.pm diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 3d10b1e2e..c03b89667 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -115,7 +115,7 @@ sub build_affected { $affected{calendarlink($ayear)} = sprintf(gettext("building calendar for %s, its previous or next year has changed"), $ayear) if ($valid); ($ayear, $valid) = previousyear($year, $config{archivebase}); $affected{calendarlink($ayear)} = sprintf(gettext("building calendar for %s, its previous or next year has changed"), $ayear) if ($valid); - foreach my $month (keys $changed{$year}) { + foreach my $month (keys %{$changed{$year}}) { ($ayear, $amonth, $valid) = nextmonth($year, $month, $config{archivebase}); $affected{calendarlink($ayear, sprintf("%02d", $amonth))} = sprintf(gettext("building calendar for %s/%s, its previous or next month has changed"), $amonth, $ayear) if ($valid); ($ayear, $amonth, $valid) = previousmonth($year, $month, $config{archivebase}); @@ -221,6 +221,10 @@ sub previousmonth($$$) { my $month = shift; my $archivebase = shift; + if (not exists $wikistate{calendar}{minyear}) { + $wikistate{calendar}{minyear} = $year; + } + my $pmonth = $month; my $pyear = $year; while ((not exists $pagesources{"$archivebase/$pyear/" . sprintf("%02d", $pmonth)}) or ($pmonth == $month and $pyear == $year)) { @@ -239,6 +243,10 @@ sub nextmonth($$$) { my $month = shift; my $archivebase = shift; + if (not exists $wikistate{calendar}{maxyear}) { + $wikistate{calendar}{maxyear} = $year; + } + my $nmonth = $month; my $nyear = $year; while ((not exists $pagesources{"$archivebase/$nyear/" . sprintf("%02d", $nmonth)}) or ($nmonth == $month and $nyear == $year)) {