[LON-CAPA-cvs] cvs: loncom(Refactoring) / lond

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 04 May 2004 10:09:38 -0000


foxr		Tue May  4 06:09:38 2004 EDT

  Modified files:              (Branch: Refactoring)
    /loncom	lond 
  Log:
  History files/entries were getting made for nohist_ databases becuase like
  an idiot I got the sense of the condition backwards.
  
  
  
Index: loncom/lond
diff -u loncom/lond:1.178.2.21 loncom/lond:1.178.2.22
--- loncom/lond:1.178.2.21	Thu Apr 29 06:35:07 2004
+++ loncom/lond	Tue May  4 06:09:38 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.178.2.21 2004/04/29 10:35:07 foxr Exp $
+# $Id: lond,v 1.178.2.22 2004/05/04 10:09:38 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.178.2.21 $'; #' stupid emacs
+my $VERSION='$Revision: 1.178.2.22 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -242,7 +242,9 @@
     # make the history log entry:
     
     
-    unless ($namespace =~/^nohist\_/ && (scalar @_ > 0)) {
+    if (($namespace =~/^nohist\_/) && (scalar @_ > 0)) {
+	my $args = scalar @_;
+	Debug(" Opening history: $namespace $args");
 	my $hfh = IO::File->new(">>$proname/$namespace.hist"); 
 	if($hfh) {
 	    my $now = time;
@@ -788,7 +790,7 @@
     #  npass - New password.
    
     my ($udom,$uname,$upass,$npass)=split(/:/,$tail);
-    chomp($npass);
+
     $upass=&unescape($upass);
     $npass=&unescape($npass);
     &Debug("Trying to change password for $uname");
@@ -1028,8 +1030,8 @@
    
     my $userinput = "$cmd:$tail";
    
-    my $fname=split(/:/,$tail);	# This allows interactive testing
-    chomp($fname);		# with telnet.
+    my $fname= $tail;		# This allows interactive testing
+
 
     my $ownership=ishome($fname);
     if ($ownership eq 'not_owner') {
@@ -1190,10 +1192,8 @@
     my $client   = shift;
     my $userinput= "$cmd:$tail";
     
-    my ($fname) = split(/:/,$tail); # This allows for interactive testing
-                                    # e.g. manual telnet and unsub:res:
-                                    # Otherwise the \r gets in the way. 
-    chomp($fname);
+    my ($fname) = $tail;
+
     Debug("Unsubscribing $fname");
     if (-e $fname) {
 	Debug("Exists");
@@ -1852,8 +1852,7 @@
 }
 RegisterHandler("dump", \&DumpWithRegexp, 0, 1, 0);
 
-#  Store an aitem in any resource meta data(?) or database with
-#  versioning?
+#  Store a set of key=value pairs associated with a versioned name.
 #
 #  Parameters:
 #    $cmd                - Request command keyword.
@@ -1919,7 +1918,9 @@
 }
 RegisterHandler("store", \&StoreHandler, 0, 1, 0);
 #
-#   Restore a prior version of a resource.
+#  Dump out all versions of a resource that has key=value pairs associated
+# with it for each version.  These resources are built up via the store
+# command.
 #
 #  Parameters:
 #     $cmd               - Command keyword.
@@ -1933,6 +1934,13 @@
 #      1  indicating the caller should not yet exit.
 # Side-effects:
 #   Writes a reply to the client.
+#   The reply is a string of the following shape:
+#   version=current&version:keys=k1:k2...&1:k1=v1&1:k2=v2...
+#    Where the 1 above represents version 1.
+#    this continues for all pairs of keys in all versions.
+#
+#
+#    
 #
 sub RestoreHandler {
     my $cmd     = shift;
@@ -2429,7 +2437,7 @@
     my $client    = shift;
     my $userinput = "$cmd:$id"; 
     
-    chomp($id);
+
     $id=~s/\W/\_/g;
     my $store;
     my $execdir=$perlvar{'lonDaemons'};
@@ -2697,6 +2705,7 @@
     my ($command, $tail) = split(/:/, $userinput, 2);
     chomp($command);
     chomp($tail);
+    $tail =~ s/(\r)//;		# This helps people debugging with e.g. telnet.
 
     Debug("Command received: $command, encoded = $wasenc");