[LON-CAPA-cvs] cvs: loncom / lond lonsql
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 10 Feb 2006 09:47:37 -0000
albertel Fri Feb 10 04:47:37 2006 EDT
Modified files:
/loncom lond lonsql
Log:
- eval the new photo routines so lond/sql don't die in the middle of them
Index: loncom/lond
diff -u loncom/lond:1.319 loncom/lond:1.320
--- loncom/lond:1.319 Wed Feb 8 12:11:46 2006
+++ loncom/lond Fri Feb 10 04:47:36 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.319 2006/02/08 17:11:46 www Exp $
+# $Id: lond,v 1.320 2006/02/10 09:47:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@
my $lastlog='';
my $lond_max_wait_time = 13;
-my $VERSION='$Revision: 1.319 $'; #' stupid emacs
+my $VERSION='$Revision: 1.320 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -4348,10 +4348,19 @@
my $userinput = "$cmd:$tail";
my $cdom = $tail;
my ($perm_reqd,$conditions);
- my $outcome = &localenroll::photo_permission($cdom,\$perm_reqd,
- \$conditions);
- &Reply($client, &escape($outcome.':'.$perm_reqd.':'. $conditions)."\n",
- $userinput);
+ my $outcome;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $outcome = &localenroll::photo_permission($cdom,\$perm_reqd,
+ \$conditions);
+ };
+ if (!$@) {
+ &Reply($client, &escape($outcome.':'.$perm_reqd.':'. $conditions)."\n",
+ $userinput);
+ } else {
+ &Failure($client,"unknown_cmd\n",$userinput);
+ }
+ return 1;
}
®ister_handler("autophotopermission",\&photo_permission_handler,0,1,0);
@@ -4376,6 +4385,7 @@
my $result = &localstudentphoto::fetch($udom,$uname,$pid,\$response);
$result .= ':'.$response;
&Reply($client, &escape($result)."\n",$userinput);
+ return 1;
}
®ister_handler("autophotocheck",\&photo_check_handler,0,1,0);
@@ -4389,8 +4399,17 @@
my ($cmd, $tail, $client) = @_;
my $userinput = "$cmd:$tail";
my $cdom = &unescape($tail);
- my ($update,$comment) = &localenroll::manager_photo_update($cdom);
- &Reply($client,&escape($update).':'.&escape($comment)."\n",$userinput);
+ my ($update,$comment);
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ ($update,$comment) = &localenroll::manager_photo_update($cdom);
+ };
+ if (!$@) {
+ &Reply($client,&escape($update).':'.&escape($comment)."\n",$userinput);
+ } else {
+ &Failure($client,"unknown_cmd\n",$userinput);
+ }
+ return 1;
}
®ister_handler("autophotochoice",\&photo_choice_handler,0,1,0);
@@ -4423,7 +4442,10 @@
&mkpath($path);
my $file;
if ($type eq 'thumbnail') {
- $file=&localstudentphoto::fetch_thumbnail($domain,$uname);
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $file=&localstudentphoto::fetch_thumbnail($domain,$uname);
+ };
} else {
$file=&localstudentphoto::fetch($domain,$uname);
}
Index: loncom/lonsql
diff -u loncom/lonsql:1.74 loncom/lonsql:1.75
--- loncom/lonsql:1.74 Wed Feb 8 16:17:53 2006
+++ loncom/lonsql Fri Feb 10 04:47:36 2006
@@ -3,7 +3,7 @@
# The LearningOnline Network
# lonsql - LON TCP-MySQL-Server Daemon for handling database requests.
#
-# $Id: lonsql,v 1.74 2006/02/08 21:17:53 www Exp $
+# $Id: lonsql,v 1.75 2006/02/10 09:47:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -444,7 +444,13 @@
$locresult = &localenroll::fetch_enrollment($dom,\%affiliates,\%replies);
} elsif ($query eq 'institutionalphotos') {
my $crs = &unescape($arg2);
- $locresult = &localenroll::institutional_photos($dom,$crs,\%affiliates,\%replies,'update');
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $locresult = &localenroll::institutional_photos($dom,$crs,\%affiliates,\%replies,'update');
+ };
+ if ($@) {
+ $locresult = 'error';
+ }
}
$result = &escape($locresult.':');
if ($locresult) {
@@ -541,6 +547,7 @@
#
if ($query) {
#prepare and execute the query
+ &logthis($query);
my $sth = $dbh->prepare($query);
unless ($sth->execute()) {
&logthis('<font color="blue">'.