creole: New plugin from Bernd Zeimetz. Closes: #486930
[ikiwiki] / IkiWiki / Plugin / pingee.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::pingee;
3
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
7
8 sub import { #{{{
9         hook(type => "cgi", id => "aggregate", call => \&cgi);
10 } # }}}
11
12 sub cgi ($) { #{{{
13         my $cgi=shift;
14
15         if (defined $cgi->param('do') && $cgi->param("do") eq "ping") {
16                 $|=1;
17                 print "Content-Type: text/plain\n\n";
18                 $config{cgi}=0;
19                 $config{verbose}=1;
20                 $config{syslog}=0;
21                 print gettext("Ping received.")."\n\n";
22
23                 IkiWiki::lockwiki();
24                 IkiWiki::loadindex();
25                 require IkiWiki::Render;
26                 IkiWiki::rcs_update();
27                 IkiWiki::refresh();
28                 IkiWiki::saveindex();
29                 exit 0;
30         }
31 } #}}}
32
33 1