--- loncom/metadata_database/searchcat.pl 2003/08/21 00:19:05 1.38 +++ loncom/metadata_database/searchcat.pl 2003/10/08 14:15:03 1.42 @@ -2,7 +2,7 @@ # The LearningOnline Network # searchcat.pl "Search Catalog" batch script # -# $Id: searchcat.pl,v 1.38 2003/08/21 00:19:05 www Exp $ +# $Id: searchcat.pl,v 1.42 2003/10/08 14:15:03 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,6 +138,8 @@ sub dynamicmeta { my %cnt=(); my %listitems=('count' => 'add', 'course' => 'add', + 'goto' => 'add', + 'comefrom' => 'add', 'avetries' => 'avg', 'stdno' => 'add', 'difficulty' => 'avg', @@ -152,8 +154,8 @@ sub dynamicmeta { my $regexp=$url; $regexp=~s/(\W)/\\$1/g; $regexp='___'.$regexp.'___([a-z]+)$'; - foreach (keys %evaldata) { - my $key=&unescape($_); + while (my ($key,$value)=each %evaldata) { + $key=&unescape($key); if ($key=~/$regexp/) { my $ctype=$1; if (defined($cnt{$ctype})) { @@ -163,21 +165,21 @@ sub dynamicmeta { } unless ($listitems{$ctype} eq 'app') { if (defined($sum{$ctype})) { - $sum{$ctype}+=$evaldata{$_}; + $sum{$ctype}+=$value; } else { - $sum{$ctype}=$evaldata{$_}; + $sum{$ctype}=$value; } } else { if (defined($sum{$ctype})) { - if ($evaldata{$_}) { - $sum{$ctype}.='
'.$evaldata{$_}; + if ($value) { + $sum{$ctype}.='
'.$value; } } else { - $sum{$ctype}=''.$evaldata{$_}; + $sum{$ctype}=''.$value; } } if ($ctype ne 'count') { - $newevaldata{$_}=$evaldata{$_}; + $newevaldata{$_}=$value; } } } @@ -310,6 +312,8 @@ foreach my $user (@homeusers) { my $m2='/res/'.&declutter($m); $m2=~s/\.meta$//; &dynamicmeta($m2); + if ($ref->{'obsolete'}) { print LOG "obsolete\n"; next; } + if ($ref->{'copyright'} eq 'private') { print LOG "private\n"; next; } &count($m2); $delete_sth->execute($m2); $insert_sth->execute($ref->{'title'}, @@ -338,27 +342,10 @@ foreach my $user (@homeusers) { # ------------------------------------------- Copy over the new db-files # - # Check the size of nohist_new_resevaldata.db compared to - # nohist_resevaldata.db - my @stat_result = stat($prodir.'/nohist_new_resevaldata.db'); - my $new_size = $stat_result[7]; - @stat_result = stat($prodir.'/nohist_resevaldata.db'); - my $old_size = $stat_result[7]; - if ($old_size) { - if ($new_size/$old_size > 0.15 ) { + system('mv '.$prodir.'/nohist_new_resevaldata.db '. $prodir.'/nohist_resevaldata.db'); - } else { - print LOG "Size of '$user' old nohist_reseval: $old_size ". - "Size of new: $new_size. Not overwriting.\n"; - my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; - my $subj="LON: $perlvar{'lonHostID'} searchcat.pl $user reseval ". - "modification error."; - system("echo ". - "'See /home/httpd/perl/logs/searchcat.txt for information.' ". - "| mailto $emailto -s '$subj' > /dev/null"); - } - } + } # --------------------------------------------------- Close database connection $dbh->disconnect;