Package: ikiwiki
Version: 2.70
Tags: patch

The ikiwiki aggregate plugin was unable to update some feeds due to a
network misconfiguration; after fixing the network, I tried to re-run
the aggregation, but ikiwiki treated all feeds as up to date (as it had
set each lastupdate timestamp before attempting to fetch the data).

This patch changes the plugin so it only sets lastupdate once a response
is received from the server.

- Michael


-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages ikiwiki depends on:
ii  libhtml-parser-perl          3.59-1      A collection of modules that parse
ii  libhtml-scrubber-perl        0.08-4      Perl extension for scrubbing/sanit
ii  libhtml-template-perl        2.9-1       HTML::Template : A module for usin
ii  liburi-perl                  1.37+dfsg-1 Manipulates and accesses URI strin
ii  markdown                     1.0.1-7     Text-to-HTML conversion tool
ii  perl                         5.10.0-18   Larry Wall's Practical Extraction 

Versions of packages ikiwiki recommends:
ii  bzr                         1.5-1.1      easy to use distributed version co
ii  gcc [c-compiler]            4:4.3.2-2    The GNU C compiler
ii  gcc-4.1 [c-compiler]        4.1.2-24     The GNU C compiler
ii  gcc-4.2 [c-compiler]        4.2.4-4      The GNU C compiler
ii  gcc-4.3 [c-compiler]        4.3.2-1      The GNU C compiler
ii  git-core                    1:1.5.6.5-1  fast, scalable, distributed revisi
ii  libauthen-passphrase-perl   0.005-3      Perl module encapsulating hashed p
ii  libc6-dev [libc-dev]        2.7-16       GNU C Library: Development Librari
ii  libcgi-formbuilder-perl     3.05.01-6    Easily generate and process statef
ii  libcgi-session-perl         4.38-1       persistent session data in CGI app
ii  liblwpx-paranoidagent-perl  1.03-1.1     a "paranoid" subclass of LWP::User
ii  libmail-sendmail-perl       0.79.16-1    Send email from a perl script
ii  libnet-openid-consumer-perl 0.14-4       library for consumers of OpenID id
ii  libtimedate-perl            1.1600-9     Time and date functions for Perl
ii  libxml-simple-perl          2.18-1       Perl module for reading and writin
ii  subversion                  1.5.1dfsg1-1 Advanced version control system

Versions of packages ikiwiki suggests:
pn  dvipng                 <none>            (no description available)
ii  graphviz               2.20.2-3          rich set of graph drawing tools
ii  libcrypt-ssleay-perl   0.57-1+b1         Support for https protocol in LWP
ii  libdigest-sha1-perl    2.11-2+b1         NIST SHA-1 message digest algorith
ii  libfile-mimeinfo-perl  0.15-1            Perl module to determine file type
ii  liblocale-gettext-perl 1.05-4            Using libc functions for internati
ii  libmailtools-perl      2.04-1            Manipulate email in perl programs
pn  libnet-amazon-s3-perl  <none>            (no description available)
pn  librpc-xml-perl        <none>            (no description available)
pn  libsearch-xapian-perl  <none>            (no description available)
pn  libtext-csv-perl       <none>            (no description available)
ii  libtext-typography-per 0.01-2            markup ASCII text with correct typ
ii  libtext-wikiformat-per 0.78-1            translates Wiki formatted text int
ii  libxml-feed-perl       0.40-1            Syndication feed parser and auto-d
ii  perlmagick             7:6.3.7.9.dfsg1-3 Perl interface to the libMagick gr
pn  polygen                <none>            (no description available)
ii  python                 2.5.2-3           An interactive high-level object-o
pn  python-docutils        <none>            (no description available)
pn  sparkline-php          <none>            (no description available)
pn  texlive                <none>            (no description available)
ii  tidy                   20080116cvs-2     HTML syntax checker and reformatte
pn  viewvc | gitweb | view <none>            (no description available)
pn  xapian-omega           <none>            (no description available)

-- no debconf information
diff -ur IkiWiki-orig/Plugin/aggregate.pm IkiWiki/Plugin/aggregate.pm
--- IkiWiki-orig/Plugin/aggregate.pm	2008-11-12 17:45:24.000000000 -0500
+++ IkiWiki/Plugin/aggregate.pm	2008-12-13 02:11:17.047759924 -0500
@@ -245,6 +245,7 @@
 	$feed->{template}=$params{template} . ".tmpl";
 	delete $feed->{unseen};
 	$feed->{lastupdate}=0 unless defined $feed->{lastupdate};
+	$feed->{lasttry}=$feed->{lastupdate} unless defined $feed->{lasttry};
 	$feed->{numposts}=0 unless defined $feed->{numposts};
 	$feed->{newposts}=0 unless defined $feed->{newposts};
 	$feed->{message}=gettext("new feed") unless defined $feed->{message};
@@ -390,8 +391,8 @@
 	# fields.
 	foreach my $name (keys %myfeeds) {
 		if (exists $feeds{$name}) {
-			foreach my $field (qw{message lastupdate numposts
-			                      newposts error}) {
+			foreach my $field (qw{message lastupdate lasttry
+			                      numposts newposts error}) {
 				$feeds{$name}->{$field}=$myfeeds{$name}->{$field};
 			}
 		}
@@ -458,10 +459,10 @@
 	error($@) if $@;
 
 	foreach my $feed (@_) {
-		$feed->{lastupdate}=time;
+		$feed->{lasttry}=time;
 		$feed->{newposts}=0;
 		$feed->{message}=sprintf(gettext("last checked %s"),
-			displaytime($feed->{lastupdate}));
+			displaytime($feed->{lasttry}));
 		$feed->{error}=0;
 
 		debug(sprintf(gettext("checking feed %s ..."), $feed->{name}));
@@ -483,6 +484,10 @@
 			debug($feed->{message});
 			next;
 		}
+
+		# lastupdate is only set if we were able to contact the server
+		$feed->{lastupdate}=$feed->{lasttry};
+
 		if ($res->status == URI::Fetch::URI_GONE()) {
 			$feed->{message}=gettext("feed not found");
 			$feed->{error}=1;

Attachment: signature.asc
Description: Digital signature

Reply via email to