# HG changeset patch # User devi # Date 1132697916 -7200 # Node ID fcd63bc2bfa0341321454368f4bdfc9f4ed7353d # Parent f13cd5b4f2d055b834e24a7890e15c8ce0d8da7e Печать индекса в файл при установленной переменной l3_to_file diff -r f13cd5b4f2d0 -r fcd63bc2bfa0 l3-cgi --- a/l3-cgi Tue Nov 22 23:54:49 2005 +0200 +++ b/l3-cgi Wed Nov 23 00:18:36 2005 +0200 @@ -22,6 +22,14 @@ my %Machines; my $print = ""; +my $is_not_cgi=""; +$is_not_cgi = "1" if defined($ENV{l3_to_file}); +# Пока что мы считаем, что вызов выполняется через CGI, +# если не установлена переменная l3_to_file +# Это неверно, но как временное решение - пойдёт + +$l3config::Config{frontend_css} =~ s@^/@@ if $is_not_cgi; + sub load_training { my $classfile = @@ -38,9 +46,6 @@ return $XMLTraining; } -$print .= header( - -charset => "utf-8", - ); if ($ENV{PATH_INFO} eq "/index") { @@ -106,6 +111,10 @@ my $prefix = "/cgi-bin/l3/current/"; my $suffix = ""; + if ($is_not_cgi) { + $prefix = ""; + $suffix = ".html"; + } $print .= "\n"; my $h = $t->{host}->{$host}; @@ -168,5 +177,19 @@ close(FRONTEND); } -binmode STDOUT, ":utf8"; -print $print; +# Если задана переменная окружения l3_to_file, +# печатаем в файл с соответствующим именем, +# в противном случае -- выводим на стандартный поток вывода +if (not defined $ENV{l3_to_file}) { + binmode STDOUT, ":utf8"; + print header(-charset => "utf-8"); + print $print; +} +else { + open(FILE, ">:utf8", $ENV{l3_to_file}) + or die "Can't open $ENV{l3_to_file} for writing"; + print FILE $print; + close(FILE); +} + + diff -r f13cd5b4f2d0 -r fcd63bc2bfa0 l3scripts --- a/l3scripts Tue Nov 22 23:54:49 2005 +0200 +++ b/l3scripts Wed Nov 23 00:18:36 2005 +0200 @@ -62,8 +62,10 @@ ###PRE-send-logs rm -rf /tmp/lilalo-$course-$date 2> /dev/null -mkdir /tmp/lilalo-$course-$date -cp -R /var/www/l3 /tmp/lilalo-$course-$date +mkdir -p /tmp/lilalo-$course-$date/l3 +cp /var/www/l3/* /tmp/lilalo-$course-$date/l3 +export l3_to_file=/tmp/lilalo-$course-$date/index.html +./l3-cgi cd /tmp rm -rf lilalo-$course-$date.zip 2> /dev/null zip -r lilalo-$course-$date.zip lilalo-$course-$date