[LON-CAPA-cvs] cvs: loncom / lond

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 14 Sep 2004 09:30:07 -0000


foxr		Tue Sep 14 05:30:07 2004 EDT

  Modified files:              
    /loncom	lond 
  Log:
  - Fix a stupid cut/paste omission in courseid put and
  - Add a few comments where I thought  it needed them
  
  
Index: loncom/lond
diff -u loncom/lond:1.252 loncom/lond:1.253
--- loncom/lond:1.252	Wed Sep  8 14:57:33 2004
+++ loncom/lond	Tue Sep 14 05:30:07 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.252 2004/09/08 18:57:33 albertel Exp $
+# $Id: lond,v 1.253 2004/09/14 09:30:07 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -57,7 +57,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.252 $'; #' stupid emacs
+my $VERSION='$Revision: 1.253 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -1994,12 +1994,19 @@
 	if (-e $udir) {
 	    my $file=$udir.'/userfiles/'.$ufile;
 	    if (-e $file) {
+		#
+		#   If the file is a regular file unlink is fine...
+		#   However it's possible the client wants a dir.
+		#   removed, in which case rmdir is more approprate:
+		#
 	        if (-f $file){
 		    unlink($file);
 		} elsif(-d $file) {
 		    rmdir($file);
 		}
 		if (-e $file) {
+		    #  File is still there after we deleted it ?!?
+
 		    &Failure($client, "failed\n", "$cmd:$tail");
 		} else {
 		    &Reply($client, "ok\n", "$cmd:$tail");
@@ -3124,21 +3131,22 @@
     my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT());
     if ($hashref) {
 	foreach my $pair (@pairs) {
-	    my ($key,$value)=split(/=/,$pair);
-	    $hashref->{$key}=$value.':'.$now;
+	    my ($key,$descr,$inst_code)=split(/=/,$pair);
+	    $hashref->{$key}=$descr.':'.$inst_code.':'.$now;
 	}
 	if (untie(%$hashref)) {
-	    &Reply($client, "ok\n", $userinput);
+	    &Reply( $client, "ok\n", $userinput);
 	} else {
-	    &Failure( $client, "error: ".($!+0)
+	    &Failure($client, "error: ".($!+0)
 		     ." untie(GDBM) Failed ".
 		     "while attempting courseidput\n", $userinput);
 	}
     } else {
-	&Failure( $client, "error: ".($!+0)
+	&Failure($client, "error: ".($!+0)
 		 ." tie(GDBM) Failed ".
 		 "while attempting courseidput\n", $userinput);
     }
+    
 
     return 1;
 }