add section information
[ikiwiki.git] / 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                         section => "special-purpose",
19                 },
20 }
21
22 sub cgi ($) {
23         my $cgi=shift;
24
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";
32
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 }
42
43 1