ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/cvswww-extract.cgi
Revision: 1.1
Committed: Thu Oct 26 00:16:37 2000 UTC (24 years, 2 months ago) by tdb
Branch: MAIN
Log Message:
Extracts a copy of the website (from a tar file) onto the webserver.

File Contents

# User Rev Content
1 tdb 1.1 #!/usr/bin/perl
2    
3     #---------------------------------------------------------
4     # cvswww-extract.cgi
5     #
6     # Script to extract webpages onto webserver
7     # Written by Tim Bishop [tdb1@ukc.ac.uk] 20/10/2000
8     #
9     # Copyright i-Scream, 2000
10     # http://www.i-scream.org.uk
11     #---------------------------------------------------------
12    
13     #grab some info
14     use CGI;
15     $query=new CGI;
16     $site=$query->param('site');
17    
18     # Settings
19     if(-e "/usr/local/proj/co600_10" && -d "/usr/local/proj/co600_10"){
20     # Assuming on Raptor
21     my ($left) = "../webpages/left.inc";
22     my ($title) = "../webpages/title.inc";
23     my ($bottom) = "../webpages/bottom.inc";
24     }
25     elsif (-e "/home/sites/www.i-scream.org.uk" && -d "/home/sites/www.i-scream.org.uk"){
26     # Assuming on Main Site
27     my ($left) = "../left.inc";
28     my ($title) = "../title.inc";
29     my ($bottom) = "../bottom.inc";
30     }
31    
32     print "Content-type: text/html\n\n";
33    
34     print << "EOF";
35     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
36    
37     <!--
38     cvswww-extract.cgi
39     Script to extract webpages onto webserver
40     Created by tdb1 20/10/2000
41     Last modified 20/10/2000
42     -->
43    
44     <html>
45    
46     <head>
47     <title>The i-Scream Project CVS Website Extracter!</title>
48     </head>
49    
50     <body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
51    
52     <table border="0" cellpadding="2" cellspacing="2">
53     <tr>
54     <td valign="top">
55     EOF
56    
57     &print_file($left);
58    
59     print << "EOF";
60    
61     </td>
62     <td valign="top">
63     EOF
64    
65     &print_file($title);
66    
67     print "<pre>\n";
68    
69     #decide which site we're running on
70     if($site eq "raptor" && -e "/usr/local/proj/co600_10" && -d "/usr/local/proj/co600_10"){
71    
72     print "<b>Debugging output from run on Raptor:</b>\n";
73     print `/usr/local/proj/co600_10/scripts/cvswww-extract-cmd`;
74    
75     print "\n<b>Debugging output from cleanup:</b>\n";
76     print `/usr/local/proj/co600_10/scripts/cvswww-clean`;
77    
78     }
79     elsif($site eq "main" && -e "/home/sites/www.i-scream.org.uk" && -d "/home/sites/www.i-scream.org.uk"){
80    
81     print "<b>Debugging output from extract:</b>\n";
82     print `cd /home/sites/www.i-scream.org.uk/web && gunzip cvswww-extract.tar.gz && tar -xvf cvswww-extract.tar && rm -f cvswww-extract.tar`;
83    
84     }
85     else{
86     print "whoops, forget to say which site... or you lied :)\n";
87     }
88    
89     print "</pre>\n";
90    
91     &print_file($bottom);
92    
93     print << "EOF";
94    
95     </td>
96     </tr>
97     </table>
98    
99     </body>
100    
101     </html>
102     EOF
103    
104     exit 0;
105    
106     sub print_file ($) {
107     my ($filename) = @_;
108     print `cat $filename`;
109     }
110    
111     sub print_file_old ($) {
112     my ($filename) = @_;
113     open(FILE, $filename) or die "Cannot open $filename: $!\n";
114     while (my ($line) = <FILE>) {
115     print $line;
116     }
117     }