* Support pinging services such as Technorati using XML-RPC to notify them

about changes to rss feeds.
master
joey 2006-06-27 01:13:03 +00:00
parent c0ce99f77c
commit b0e7e2e123
9 changed files with 61 additions and 9 deletions

View File

@ -36,6 +36,7 @@ sub defaultconfig () { #{{{
svnpath => "trunk",
srcdir => undef,
destdir => undef,
pingurl => [],
templatedir => "/usr/share/ikiwiki/templates",
underlaydir => "/usr/share/ikiwiki/basewiki",
setup => undef,

View File

@ -9,12 +9,19 @@ use IkiWiki;
sub import { #{{{
IkiWiki::hook(type => "preprocess", id => "inline",
call => \&IkiWiki::preprocess_inline);
# Hook to change to do pinging since it's called late.
# This ensures each page only pings once and prevents slow
# pings interrupting page builds.
IkiWiki::hook(type => "change", id => "inline",
call => \&IkiWiki::pingurl);
} # }}}
# Back to ikiwiki namespace for the rest, this code is very much
# internal to ikiwiki even though it's separated into a plugin.
package IkiWiki;
my %toping;
sub preprocess_inline (@) { #{{{
my %params=@_;
@ -72,6 +79,7 @@ sub preprocess_inline (@) { #{{{
if ($config{rss}) {
writefile(rsspage($params{page}), $config{destdir},
genrss($params{page}, @pages));
$toping{$params{page}}=1;
}
return $ret;
@ -160,4 +168,32 @@ sub genrss ($@) { #{{{
return $template->output;
} #}}}
sub pingurl (@) { #{{{
return unless $config{pingurl} && %toping;
eval q{require RPC::XML::Client};
if ($@) {
debug("RPC::XML::Client not found, not pinging");
}
foreach my $page (keys %toping) {
my $title=pagetitle(basename($page));
my $url="$config{url}/".htmlpage($page);
foreach my $pingurl (@{$config{pingurl}}) {
my $client = RPC::XML::Client->new($pingurl);
my $req = RPC::XML::request->new('weblogUpdates.ping',
$title, $url);
debug("Pinging $pingurl for $page");
my $res = $client->send_request($req);
if (! ref $res) {
debug("Did not receive response to ping");
}
my $r=$res->value;
if (! exists $r->{flerror} || $r->{flerror}) {
debug("Ping rejected: ".$r->{message});
}
}
}
} #}}}
1

4
debian/changelog vendored
View File

@ -2,8 +2,10 @@ ikiwiki (1.8) UNRELEASED; urgency=low
* Fix orphans plugin to not count a link to a nonexistant page as a reason
for a page not being an orphan.
* Support pinging services such as Technorati using XML-RPC to notify them
about changes to rss feeds.
-- Joey Hess <joeyh@debian.org> Sun, 25 Jun 2006 03:20:48 -0400
-- Joey Hess <joeyh@debian.org> Mon, 26 Jun 2006 20:41:45 -0400
ikiwiki (1.7) unstable; urgency=low

2
debian/control vendored
View File

@ -10,7 +10,7 @@ Package: ikiwiki
Architecture: all
Depends: ${perl:Depends}, markdown, libtimedate-perl, libhtml-template-perl, libhtml-scrubber-perl, libcgi-formbuilder-perl (>= 3.02.02), libtime-duration-perl, libcgi-session-perl, libmail-sendmail-perl, gcc | c-compiler, libc6-dev | libc-dev
Recommends: subversion | git-core, hyperestraier
Suggests: viewcvs
Suggests: viewcvs, librpc-xml-perl
Description: a wiki compiler
ikiwiki converts a directory full of wiki pages into html pages suitable
for publishing on a website. Unlike many wikis, ikiwiki does not have its

View File

@ -63,6 +63,8 @@ use IkiWiki::Setup::Standard {
#anonok => 1,
# Generate rss feeds for pages?
rss => 1,
# Urls to ping with XML-RPC when rss feeds are updated
#pingurl => [qw{http://rpc.technorati.com/rpc/ping}],
# Include discussion links on all pages?
discussion => 1,
# Time format (for strftime)

View File

@ -1,9 +1,9 @@
The easiest way to install ikiwiki is using the Debian package.
Ikiwiki requires [[MarkDown]] be installed, and also uses the following
perl modules: `CGI::Session` `CGI::FormBuilder` (version 3.02.02 or
newer) `HTML::Template` `Mail::SendMail` `Time::Duration` `Date::Parse`
(libtimedate-perl), `HTML::Scrubber`
perl modules if available: `CGI::Session` `CGI::FormBuilder` (version
3.02.02 or newer) `HTML::Template` `Mail::SendMail` `Time::Duration`
`Date::Parse` (libtimedate-perl), `HTML::Scrubber`, `RPC::XML`
If you want to install from the tarball, you should make sure that the required perl modules are installed, then run:
@ -11,4 +11,4 @@ If you want to install from the tarball, you should make sure that the required
make
make install
See [[download]] for where to get it.
See [[download]] for where to get it.

View File

@ -36,5 +36,4 @@ Suggestions of ideas for plugins:
All the kinds of plugins that blogging software has is also a possibility:
* Blog post calendar
* technocrati pinger
* Tag stuff?

View File

@ -128,7 +128,16 @@ These options configure the wiki.
If rss is set, ikiwiki will generate rss feeds for pages that inline
a [[blog]].
* --url http://url/
* --pingurl url
Set this to the url to an XML-RPC service to ping when an RSS feed is
updated. For example, to ping Technorati, use the url
http://rpc.technorati.com/rpc/ping
This parameter can be specified multiple times to specify more than one
url to ping.
* --url url
Specifies the url to the wiki. This is a required parameter in [[CGI]] mode.

View File

@ -59,6 +59,9 @@ sub getconfig () { #{{{
"disable-plugin=s@" => sub {
$config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}} ];
},
"pingurl" => sub {
push @{$config{pingurl}}, $_[1];
}
) || usage();
if (! $config{setup}) {