]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/pingee.pm
aafce9e70dd03ec2a051f4a69b8264e397b66ce3
[git.ikiwiki.info.git] / IkiWiki / Plugin / pingee.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::pingee;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9         hook(type => "getsetup", id => "pingee", call => \&getsetup);
10         hook(type => "cgi", id => "pingee", call => \&cgi);
11 }
13 sub getsetup () {
14         return 
15                 plugin => {
16                         safe => 1,
17                         rebuild => undef,
18                         section => "special-purpose",
19                 },
20 }
22 sub cgi ($) {
23         my $cgi=shift;
25         if (defined $cgi->param('do') && $cgi->param("do") eq "ping") {
26                 $|=1;
27                 print "Content-Type: text/plain\n\n";
28                 $config{cgi}=0;
29                 $config{verbose}=1;
30                 $config{syslog}=0;
31                 print gettext("Ping received.")."\n\n";
33                 IkiWiki::lockwiki();
34                 IkiWiki::loadindex();
35                 require IkiWiki::Render;
36                 IkiWiki::rcs_update();
37                 IkiWiki::refresh();
38                 IkiWiki::saveindex();
39                 exit 0;
40         }
41 }
43 1