/usr/share/perl5/IkiWiki/Plugin/missingsite.pm is in ikiwiki-hosting-common 0.20170622ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/perl
# Special purpose plugin that takes advantage of ikiwiki being configured
# as the 404 handler, and *always* displays missingsite.tmpl.
#
# One special-purpose site per web server can be configured to use this
# plugin, and set as apache's default site. This way, attempts to access
# sites that have been deleted or are not created yet will display a
# useful error message.
#
# Put this in the apache config template for the missingsite (eg, in
# /etc/ikiwiki-hosting/config/b-missingsite/apache.conf.tmpl):
# DirectoryIndex index.html ikiwiki.cgi
package IkiWiki::Plugin::missingsite;
use warnings;
use strict;
use IkiWiki 3.00;
use IkiWiki::Hosting;
sub import {
hook(type => "cgi", id => 'missingsite', call => \&cgi);
hook(type => "getsetup", id => 'missingsite', call => \&getsetup);
hook(type => "genwrapper", id => 'missingsite', call => \&genwrapper);
}
sub getsetup () {
return
plugin => {
safe => 0,
rebuild => 0,
}
}
sub cgi ($) {
my $cgi=shift;
print STDERR "missing site: $ENV{SERVER_NAME}\n";
my $template=IkiWiki::Hosting::ikisite_template("missingsite.tmpl");
$template->param(SERVER_NAME => $ENV{SERVER_NAME});
IkiWiki::cgi_custom_failure(
$cgi,
"404 Not Found",
$template->output,
);
}
sub genwrapper () {
# Pass SERVER_NAME through the wrapper.
return <<EOF;
if ((s=getenv("SERVER_NAME")))
addenv("SERVER_NAME", s);
EOF
}
1;
|