lilalo

diff l3-agent @ 29:b3f5f5560802

l3-cgi: Найти курс по PATH_INFO
HISTORY: Описаны изменения в версии v_0_2_4
l3-frontend: В секции "О программе" убрал разрыв строки
author devi
date Mon Nov 07 13:28:15 2005 +0200 (2005-11-07)
parents 098664cf339c
children f5f07049bd4f
line diff
     1.1 --- a/l3-agent	Mon Nov 07 11:24:49 2005 +0200
     1.2 +++ b/l3-agent	Mon Nov 07 13:28:15 2005 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4  
     1.5  our @Command_Lines;
     1.6  our @Command_Lines_Index;
     1.7 -our @Diffs;
     1.8 +our %Diffs;
     1.9  our %Sessions;
    1.10  
    1.11  our %Commands_Stat;		# Statistics about commands usage
    1.12 @@ -57,6 +57,9 @@
    1.13  		my @files = <$path/$template>;
    1.14  		my $i=0;
    1.15  		for my $file (@files) {
    1.16 +
    1.17 +			next if defined($Diffs{$file});
    1.18 +			
    1.19  			my %diff;
    1.20  			
    1.21  			$diff{"path"}=$path;
    1.22 @@ -98,7 +101,8 @@
    1.23  			$diff{"text"}=$text;
    1.24  			#print "$file loaded ($diff{day})\n";
    1.25  
    1.26 -			push @Diffs, \%diff;
    1.27 +			#push @Diffs, \%diff;
    1.28 +			$Diffs{$file} = \%diff;
    1.29  			$i++;
    1.30  		}
    1.31  	}	
    1.32 @@ -121,7 +125,8 @@
    1.33  
    1.34  	my $min_dt = 10000;
    1.35  
    1.36 -	for my $diff (@Diffs) {
    1.37 +	for my $diff_key (keys %Diffs) {
    1.38 +			my $diff = $Diffs{$diff_key};
    1.39  			# Check here date, time and user
    1.40  			next if ($diff->{"day"} && $cl->{"day"} && ($cl->{"day"} ne $diff->{"day"}));
    1.41  			#next if (!$diff->{"uid"} && $cl->{"euid"} != $diff->{"uid"});
    1.42 @@ -135,7 +140,8 @@
    1.43  				$diff->{"time_range"}=$dt;
    1.44  				$diff->{"bind_to"}=$cl;
    1.45  
    1.46 -				$cl->{"diff"} = $diff->{"index"};
    1.47 +				#$cl->{"diff"} = $diff->{"index"};
    1.48 +				$cl->{"diff"} = $diff_key;
    1.49  				$min_dt = $dt;	
    1.50  			}
    1.51  		
    1.52 @@ -262,7 +268,7 @@
    1.53  						$session{$1} = $2;
    1.54  					}
    1.55  					$local_session_id = $session{"local_session_id"} if $session{"local_session_id"};
    1.56 -					$Sessions{$session_id}=\%session;
    1.57 +					$Sessions{$local_session_id}=\%session;
    1.58  				}
    1.59  
    1.60  				#Загруженную информацию сразу же отправляем в поток
    1.61 @@ -816,7 +822,7 @@
    1.62  		print OUT "</output>\n";
    1.63  		if ($cl->{"diff"}) {
    1.64  			print OUT "<diff>";
    1.65 -				printq(\*OUT,${$Diffs[$cl->{"diff"}]}{"text"});
    1.66 +				printq(\*OUT,${$Diffs{$cl->{"diff"}}}{"text"});
    1.67  			print OUT "</diff>\n";
    1.68  		}
    1.69  		print OUT "</command>\n";
    1.70 @@ -846,9 +852,6 @@
    1.71  
    1.72  sub send_cache
    1.73  {
    1.74 -	`logger "step 0"`;
    1.75 -	`logger "step 1"`;
    1.76 -
    1.77  	# Если в кэше что-то накопилось, 
    1.78  	# попытаемся отправить это на сервер
    1.79  	#
    1.80 @@ -913,9 +916,6 @@
    1.81  	init_variables();
    1.82  	init_config();
    1.83  
    1.84 -	for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
    1.85 -		load_diff_files($lab_log);
    1.86 -	}
    1.87  
    1.88  	if ($Config{"mode"} ne "daemon") {
    1.89  
    1.90 @@ -925,6 +925,9 @@
    1.91  	результат выполнения в результриующий файл.
    1.92  	После этого завершить работу.
    1.93  =cut
    1.94 +		for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
    1.95 +			load_diff_files($lab_log);
    1.96 +		}
    1.97  		load_command_lines($Config{"input"}, $Config{"input_mask"});
    1.98  		sort_command_lines;
    1.99  		process_command_lines;
   1.100 @@ -970,6 +973,9 @@
   1.101  		while (not $Killed) {
   1.102  			@Command_Lines = ();
   1.103  			@Command_Lines_Index = ();
   1.104 +			for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
   1.105 +				load_diff_files($lab_log);
   1.106 +			}
   1.107  			load_cache_stat();
   1.108  			load_command_lines($Config{"input"}, $Config{"input_mask"});
   1.109  			if (@Command_Lines) {