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