version 1.90, 2008/03/11 01:45:47
|
version 1.92, 2013/09/01 22:39:44
|
Line 233 unless ($dbh = DBI->connect("DBI:mysql:l
|
Line 233 unless ($dbh = DBI->connect("DBI:mysql:l
|
system("echo 'Cannot connect to MySQL database!' |". |
system("echo 'Cannot connect to MySQL database!' |". |
" mailto $emailto -s '$subj' > /dev/null"); |
" mailto $emailto -s '$subj' > /dev/null"); |
|
|
open(SMP,'>/home/httpd/html/lon-status/mysql.txt'); |
open(SMP,">$perlvar{'lonDocRoot'}/lon-status/mysql.txt"); |
print SMP 'time='.time.'&mysql=defunct'."\n"; |
print SMP 'time='.time.'&mysql=defunct'."\n"; |
close(SMP); |
close(SMP); |
|
|
exit 1; |
exit 1; |
} else { |
} else { |
unlink('/home/httpd/html/lon-status/mysql.txt'); |
unlink("$perlvar{'lonDocRoot'}/lon-status/mysql.txt"); |
$dbh->disconnect; |
$dbh->disconnect; |
} |
} |
|
|
Line 489 sub make_new_child {
|
Line 489 sub make_new_child {
|
$result = &allusers_table_update($query,$uname,$udom,\%userdata); |
$result = &allusers_table_update($query,$uname,$udom,\%userdata); |
} else { |
} else { |
# Do an sql query |
# Do an sql query |
$result = &do_sql_query($query,$arg1,$arg2,$searchdomain); |
$result = &do_sql_query($query,$arg1,$arg2,$arg3,$searchdomain); |
} |
} |
# result does not need to be escaped because it has already been |
# result does not need to be escaped because it has already been |
# escaped. |
# escaped. |
Line 651 sub process_file {
|
Line 651 sub process_file {
|
} |
} |
|
|
sub do_sql_query { |
sub do_sql_query { |
my ($query,$custom,$customshow,$searchdomain) = @_; |
my ($query,$custom,$customshow,$domainstr,$searchdomain) = @_; |
|
|
# |
# |
# limit to searchdomain if given and table is metadata |
# limit to searchdomain if given and table is metadata |
# |
# |
if (($searchdomain) && ($query=~/FROM metadata/)) { |
if ($domainstr && ($query=~/FROM metadata/)) { |
|
my $havingstr; |
|
$domainstr = &unescape($domainstr); |
|
if ($domainstr =~ /,/) { |
|
foreach my $dom (split(/,/,$domainstr)) { |
|
if ($dom =~ /^$LONCAPA::domain_re$/) { |
|
$havingstr .= 'domain="'.$dom.'" OR '; |
|
} |
|
} |
|
$havingstr =~ s/ OR $//; |
|
} else { |
|
if ($domainstr =~ /^$LONCAPA::domain_re$/) { |
|
$havingstr = 'domain="'.$domainstr.'"'; |
|
} |
|
} |
|
if ($havingstr) { |
|
$query.=' HAVING ('.$havingstr.')'; |
|
} |
|
} elsif (($searchdomain) && ($query=~/FROM metadata/)) { |
$query.=' HAVING (domain="'.$searchdomain.'")'; |
$query.=' HAVING (domain="'.$searchdomain.'")'; |
} |
} |
# &logthis('doing query ('.$searchdomain.')'.$query); |
# &logthis('doing query ('.$searchdomain.')'.$query); |