chiark / gitweb /
Send webstump CGI logs to "errs" too to capture all of the decisions
[modbot-mtm.git] / webstump / scripts / create-newsgroup.pl
1 #!/usr/bin/perl
2 #
3 # This script creates a new newsgroup.
4 #
5
6 if( !($0 =~ /\/scripts\/create-newsgroup\.pl$/) ) {
7   die "This script can only be called with full path name!!!";
8 }
9
10 $webstump_home = $0;
11 $webstump_home =~ s/\/scripts\/create-newsgroup\.pl$//;
12
13 require "$webstump_home/config/webstump.cfg";
14 require "$webstump_home/scripts/webstump.lib.pl";
15
16 &init_webstump;
17
18 $newsgroup = @ARGV[0];
19 $address = @ARGV[1];
20 $password = @ARGV[2];
21
22 print "Creating newsgroup:
23 Name: $newsgroup
24 Approval Address: $address
25 Admin password: $password
26 Press ENTER to continue, ^C to interrupt:\n";
27
28 <STDIN>;
29
30 print "Adding $newsgroup to $webstump_home/config/newsgroups.lst...";
31 &append_to_file( "$webstump_home/config/newsgroups.lst", 
32                 "$newsgroup  $address\n" );
33 mkdir "$webstump_home/queues/$newsgroup", 0755;
34 print "\b\b\b done.\n";
35
36 $dir = "$webstump_home/config/newsgroups/$newsgroup";
37
38 print "Creating $dir...";
39 mkdir $dir, 0755;
40 print "\b\b\b done.\n";
41
42 print "Creating files in $dir...";
43
44 &append_to_file( "$dir/moderators", "ADMIN \U$password\n" );
45 &append_to_file( "$dir/rejection-reasons", 
46 "offtopic::a blatantly offtopic article, spam
47 harassing::message of harassing content
48 charter::message poorly formatted
49 " );
50 print "\b\b\b done.\n";