wiki.pl: Port some fixes from upstream
[Orgmuse.git] / prevent-maintenance.pl
blobfbf03430c41237c772feb2fd0e570ebd8c4e5fa9
1 #! /usr/bin/perl -w
3 use CGI qw/:standard/;
4 use CGI::Carp qw(fatalsToBrowser);
5 print header() . start_html(), p;
6 print 'Stop maintenance: $Id: prevent-maintenance.pl,v 1.1 2003/11/16 21:35:51 as Exp $', "\n";
7 if (not param('dir')) {
8 print start_form, p,
9 '$DataDir: ', textfield('dir', '/tmp/oddmuse'),
10 p, submit('Ok'), "\n", end_form;
11 } elsif (param('dir') and not param('sure')) {
12 print start_form, hidden('sure', 'yes'), hidden('dir', param('dir')),
13 '$DataDir: ', param('dir'),
14 p, submit('Confirm'), "\n", end_form;
15 } else {
16 $time = (time) + 28 * 24 * 3600; # four weeks
17 $file = param('dir') . "/maintain";
18 open(F, ">$file") or die "Unable to create maintenance file";
19 print F "Preventing maintenance until " . gmtime($time);
20 close(F);
21 utime $time, $time, $file;
22 print pre(`ls -l $file`);
24 print end_html();