]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/pingee.pm
Merge branch 'master' into next
[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                 },
19 }
21 sub cgi ($) {
22         my $cgi=shift;
24         if (defined $cgi->param('do') && $cgi->param("do") eq "ping") {
25                 $|=1;
26                 print "Content-Type: text/plain\n\n";
27                 $config{cgi}=0;
28                 $config{verbose}=1;
29                 $config{syslog}=0;
30                 print gettext("Ping received.")."\n\n";
32                 IkiWiki::lockwiki();
33                 IkiWiki::loadindex();
34                 require IkiWiki::Render;
35                 IkiWiki::rcs_update();
36                 IkiWiki::refresh();
37                 IkiWiki::saveindex();
38                 exit 0;
39         }
40 }
42 1