Merge branch 'master' into next
[ikiwiki] / IkiWiki / Plugin / pingee.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::pingee;
3
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
7
8 sub import {
9         hook(type => "getsetup", id => "pingee", call => \&getsetup);
10         hook(type => "cgi", id => "pingee", call => \&cgi);
11 }
12
13 sub getsetup () {
14         return 
15                 plugin => {
16                         safe => 1,
17                         rebuild => undef,
18                 },
19 }
20
21 sub cgi ($) {
22         my $cgi=shift;
23
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";
31
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 }
41
42 1