[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn@source.lon-capa.org
Fri, 14 Aug 2009 17:35:08 -0000


raeburn		Fri Aug 14 17:35:08 2009 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Rename &store_coursereq() as &store_userdata() and make it a more generic routine for storing versioned data in a db file for a user. 
    - similar to &store() except there is no symb (the keys do not contain  a symb), and there are no calls to &devalidate etc., as this is intended for "user data" (not "course data").
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1014 loncom/lonnet/perl/lonnet.pm:1.1015
--- loncom/lonnet/perl/lonnet.pm:1.1014	Tue Aug 11 11:33:52 2009
+++ loncom/lonnet/perl/lonnet.pm	Fri Aug 14 17:35:08 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1014 2009/08/11 11:33:52 droeschl Exp $
+# $Id: lonnet.pm,v 1.1015 2009/08/14 17:35:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6529,12 +6529,11 @@
     return 0;
 }
 
-sub store_coursereq {
-    my ($requestkey,$storehash) = @_;
+sub store_userdata {
+    my ($storehash,$datakey,$namespace,$udom,$uname) = @_;
     my $result;
-    if ($requestkey =~ /^($match_domain)_($match_courseid)$/) {
+    if $datakey ne '') {
         if (ref($storehash) eq 'HASH') {
-            my $namespace = 'courserequests';
             my $uhome=&homeserver();
             if (($uhome eq '') || ($uhome eq 'no_host')) {
                 $result = 'error: no_host';
@@ -6548,7 +6547,7 @@
                 }
                 $namevalue=~s/\&$//;
                 $result =  &reply("store:$env{'user.domain'}:$env{'user.name'}:".
-                                  "$namespace:$requestkey:$namevalue",$uhome);
+                                  "$namespace:$datakey:$namevalue",$uhome);
             }
         } else {
             $result = 'error: data to store was not a hash reference';