version 1.26, 2001/03/27 19:57:53
|
version 1.31, 2001/04/11 20:05:29
|
Line 23 sub wanted {
|
Line 23 sub wanted {
|
push(@metalist,"$dir/$_"); |
push(@metalist,"$dir/$_"); |
} |
} |
|
|
|
|
$childmaxattempts=10; |
$childmaxattempts=10; |
$run =0;#running counter to generate the query-id |
$run =0;#running counter to generate the query-id |
|
|
Line 39 while ($configline=<CONFIG>) {
|
Line 38 while ($configline=<CONFIG>) {
|
} |
} |
close(CONFIG); |
close(CONFIG); |
|
|
|
# ------------------------------------- Make sure that database can be accessed |
|
{ |
|
my $dbh; |
|
unless ( |
|
$dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0}) |
|
) { |
|
print "Cannot connect to database!\n"; |
|
exit; |
|
} |
|
else { |
|
$dbh->disconnect; |
|
} |
|
} |
|
|
# --------------------------------------------- Check if other instance running |
# --------------------------------------------- Check if other instance running |
|
|
my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid"; |
my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid"; |
Line 191 sub make_new_child {
|
Line 204 sub make_new_child {
|
#open database handle |
#open database handle |
# making dbh global to avoid garbage collector |
# making dbh global to avoid garbage collector |
unless ( |
unless ( |
$dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0}) |
$dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0}) |
) { |
) { |
my $st=120+int(rand(240)); |
sleep(10+int(rand(20))); |
&logthis("<font color=blue>WARNING: Couldn't connect to database ($st secs): $@</font>"); |
&logthis("<font color=blue>WARNING: Couldn't connect to database ($st secs): $@</font>"); |
print "database handle error\n"; |
print "database handle error\n"; |
sleep($st); |
|
exit; |
exit; |
|
|
}; |
}; |
Line 251 sub make_new_child {
|
Line 263 sub make_new_child {
|
} |
} |
} |
} |
# do custom metadata searching here and build into result |
# do custom metadata searching here and build into result |
if ($custom) { |
if ($custom or $customshow) { |
&logthis("am going to do custom query for $custom"); |
&logthis("am going to do custom query for $custom"); |
if ($query) { |
if ($query) { |
@metalist=map {$perlvar{'lonDocRoot'}.$_.'.meta'} @files; |
@metalist=map {$perlvar{'lonDocRoot'}.$_.'.meta'} @files; |
Line 284 sub make_new_child {
|
Line 296 sub make_new_child {
|
$m2=~s/\.meta$//; |
$m2=~s/\.meta$//; |
unless ($query) { |
unless ($query) { |
my $q2="select * from metadata where url like '$m2'"; |
my $q2="select * from metadata where url like '$m2'"; |
my $sth = $dbh->prepare($query); |
my $sth = $dbh->prepare($q2); |
$sth->execute(); |
$sth->execute(); |
my $r1=$sth->fetchall_arrayref; |
my $r1=$sth->fetchall_arrayref; |
map {my $a=$_; |
map {my $a=$_; |