source: main/trunk/greenstone2/common-src/cgi-bin/build-server.pl@ 31960

Last change on this file since 31960 was 24872, checked in by ak19, 12 years ago

First set of changes to do with migration of cgi-bin into common-src, so that upon make install, common-src\cgi-bin will be installed in cgi-bin\GSDLOS(GSDLARCH). After this commit (to do with the contents of the files), cgi-bin itself will be moved.

File size: 1.5 KB
Line 
1#!/usr/bin/perl -w
2##!C:/Perl/bin/perl -w
3
4# If not explicitly associating .pl filename ending with Perl in the
5# web server's configuration file, then need to specify the full path of
6# Perl above
7
8use strict;
9
10BEGIN {
11 # Line to stop annoying child DOS CMD windows from appearing
12 Win32::SetChildShowWindow(0)
13 if defined &Win32::SetChildShowWindow;
14}
15
16# Set this to 1 to work around IIS 6 craziness
17my $iis6_mode = 0;
18
19
20# IIS 6: for some reason, IIS runs this script with the working
21# directory set to the Greenstone directory rather than the cgi-bin
22# directory, causing lots of stuff to fail
23if ($iis6_mode)
24{
25 # Change into cgi-bin\<OS> directory
26 chdir("cgi-bin");
27 if(defined $ENV{'GSDLARCH'}) {
28 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
29 } else {
30 chdir($ENV{'GSDLOS'});
31 }
32}
33
34
35# We use require and an eval here (instead of "use") to catch any
36# errors loading the module (for IIS)
37eval('require "./gsdlCGI.pm"');
38if ($@)
39{
40 print STDOUT "Content-type:text/plain\n\n";
41 print STDOUT "ERROR: $@\n";
42 exit 0;
43}
44
45sub main
46{
47 my $gsdl_cgi = new gsdlCGI();
48
49 # Load the Greenstone modules that we need to use
50 $gsdl_cgi->setup_gsdl();
51
52 my $gsdlhome = $ENV{'GSDLHOME'};
53 $gsdl_cgi->checked_chdir($gsdlhome);
54
55 require cgiactions::buildaction;
56
57 $gsdl_cgi->parse_cgi_args();
58
59 # We don't want the gsdlCGI module to return errors and warnings in XML
60 $gsdl_cgi->{'xml'} = 0;
61
62 my $action = new buildaction($gsdl_cgi,$iis6_mode);
63
64 $action->do_action();
65}
66
67&main();
Note: See TracBrowser for help on using the repository browser.