]> i-scream Git - www.i-scream.org.git/commitdiff
Extracts a copy of the website (from a tar file) onto the webserver.
authorTim Bishop <tim@bishnet.net>
Thu, 26 Oct 2000 00:16:37 +0000 (00:16 +0000)
committerTim Bishop <tim@bishnet.net>
Thu, 26 Oct 2000 00:16:37 +0000 (00:16 +0000)
cgi-bin/cvswww-extract.cgi [new file with mode: 0755]

diff --git a/cgi-bin/cvswww-extract.cgi b/cgi-bin/cvswww-extract.cgi
new file mode 100755 (executable)
index 0000000..6383c06
--- /dev/null
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+
+#---------------------------------------------------------
+# cvswww-extract.cgi
+#
+# Script to extract webpages onto webserver
+# Written by Tim Bishop [tdb1@ukc.ac.uk] 20/10/2000
+#
+# Copyright i-Scream, 2000
+# http://www.i-scream.org.uk
+#---------------------------------------------------------
+
+#grab some info
+use CGI;
+$query=new CGI;
+$site=$query->param('site');
+
+# Settings
+if(-e "/usr/local/proj/co600_10" && -d "/usr/local/proj/co600_10"){
+    # Assuming on Raptor
+    my ($left) = "../webpages/left.inc";
+    my ($title) = "../webpages/title.inc";
+    my ($bottom) = "../webpages/bottom.inc";
+}
+elsif (-e "/home/sites/www.i-scream.org.uk" && -d "/home/sites/www.i-scream.org.uk"){
+    # Assuming on Main Site
+    my ($left) = "../left.inc";
+    my ($title) = "../title.inc";
+    my ($bottom) = "../bottom.inc";
+}
+
+print "Content-type: text/html\n\n";
+
+print << "EOF";
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<!--
+    cvswww-extract.cgi
+    Script to extract webpages onto webserver
+    Created by tdb1 20/10/2000
+    Last modified 20/10/2000
+-->
+
+<html>
+
+<head>
+  <title>The i-Scream Project CVS Website Extracter!</title>
+</head>
+
+<body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
+
+<table border="0" cellpadding="2" cellspacing="2">
+  <tr>
+    <td valign="top">
+EOF
+
+&print_file($left);
+
+print << "EOF";
+
+    </td>
+    <td valign="top">
+EOF
+
+&print_file($title);
+
+print "<pre>\n";
+
+#decide which site we're running on
+if($site eq "raptor" && -e "/usr/local/proj/co600_10" && -d "/usr/local/proj/co600_10"){
+
+print "<b>Debugging output from run on Raptor:</b>\n";
+print `/usr/local/proj/co600_10/scripts/cvswww-extract-cmd`;
+
+print "\n<b>Debugging output from cleanup:</b>\n";
+print `/usr/local/proj/co600_10/scripts/cvswww-clean`;
+
+}
+elsif($site eq "main" && -e "/home/sites/www.i-scream.org.uk" && -d "/home/sites/www.i-scream.org.uk"){
+
+print "<b>Debugging output from extract:</b>\n";
+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`;
+
+}
+else{
+    print "whoops, forget to say which site... or you lied :)\n";
+}
+
+print "</pre>\n";
+
+&print_file($bottom);
+
+print << "EOF";
+
+    </td>
+  </tr>
+</table>
+
+</body>
+
+</html>
+EOF
+
+exit 0;
+
+sub print_file ($) {
+    my ($filename) = @_;
+    print `cat $filename`;
+}
+
+sub print_file_old ($) {
+    my ($filename) = @_;
+    open(FILE, $filename) or die "Cannot open $filename: $!\n";
+    while (my ($line) = <FILE>) {
+        print $line;
+    }
+}