[LON-CAPA-cvs] cvs: loncom / lond /interface domainprefs.pm londocs.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sun Oct 6 16:33:52 EDT 2013


raeburn		Sun Oct  6 20:33:52 2013 EDT

  Modified files:              
    /loncom	lond 
    /loncom/interface	domainprefs.pm londocs.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Change to args expected by lonnet::remote_devalidate_cache() and
    change to corresponding &server_devalidatecache_handler() on lond side.
    - On the lonnet side remote_devalidate_cache() now expects an array of 
      escaped cache keys as the second argument.
    - On the lond side &server_devalidatecache_handler() calls 
      lonnet::devalidate_cache_new() on each of the cache keys passed to it.
  
  
Index: loncom/lond
diff -u loncom/lond:1.502 loncom/lond:1.503
--- loncom/lond:1.502	Sat Aug 10 01:27:31 2013
+++ loncom/lond	Sun Oct  6 20:33:38 2013
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.502 2013/08/10 01:27:31 raeburn Exp $
+# $Id: lond,v 1.503 2013/10/06 20:33:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.502 $'; #' stupid emacs
+my $VERSION='$Revision: 1.503 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -1685,8 +1685,14 @@
 sub server_devalidatecache_handler {
     my ($cmd,$tail,$client) = @_;
     my $userinput = "$cmd:$tail";
-    my ($name,$id) = map { &unescape($_); } split(/:/,$tail);
-    &Apache::lonnet::devalidate_cache_new($name,$id);
+    my $items = &unescape($tail);
+    my @cached = split(/\&/,$items);
+    foreach my $key (@cached) {
+        if ($key =~ /:/) {
+            my ($name,$id) = map { &unescape($_); } split(/:/,$key);
+            &Apache::lonnet::devalidate_cache_new($name,$id);
+        }
+    }
     my $result = 'ok';
     &Reply($client,\$result,$userinput);
     return 1;
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.210 loncom/interface/domainprefs.pm:1.211
--- loncom/interface/domainprefs.pm:1.210	Sun Sep 29 06:53:35 2013
+++ loncom/interface/domainprefs.pm	Sun Oct  6 20:33:45 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.210 2013/09/29 06:53:35 raeburn Exp $
+# $Id: domainprefs.pm,v 1.211 2013/10/06 20:33:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8412,7 +8412,8 @@
                                 foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) {
                                     $resulttext .= '<li><b>'.$lonhost.'</b> ';
                                     my $lonhostdom = &Apache::lonnet::host_domain($lonhost);
-                                    &Apache::lonnet::remote_devalidate_cache($lonhost,'spares',$lonhostdom);
+                                    my $cachekey = &escape('spares').':'.&escape($lonhostdom);
+                                    &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);
                                     if (ref($changes{$prefix}{$lonhost}) eq 'HASH') {
                                         foreach my $type (@{$types{$prefix}}) {
                                             if ($changes{$prefix}{$lonhost}{$type}) {
@@ -8599,7 +8600,8 @@
                 if (ref($changes{'delete'}) eq 'ARRAY') {
                     foreach my $balancer (sort(@{$changes{'delete'}})) {
                         $resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>';
-                        &Apache::lonnet::remote_devalidate_cache($balancer,'loadbalancing',$dom);
+                        my $cachekey = &escape('loadbalancing').':'.&escape($dom);
+                        &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
                     }
                 }
                 if (ref($changes{'add'}) eq 'ARRAY') {
@@ -8655,7 +8657,8 @@
                                 }
                             }
                         }
-                        &Apache::lonnet::remote_devalidate_cache($balancer,'loadbalancing',$dom);
+                        my $cachekey = &scape('loadbalancing').':'.&escape($dom);
+                        &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
                     }
                 }
                 if ($resulttext ne '') {
@@ -9386,7 +9389,8 @@
     if (keys(%servers) > 1) {
         foreach my $server (keys(%servers)) {
             next if ($thismachine{$server});
-            &Apache::lonnet::remote_devalidate_cache($server,'domainconfig',$dom);
+            my $cachekey = &escape('domainconfig').':'.&escape($dom);
+            &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]);
         }
     }
     return;
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.565 loncom/interface/londocs.pm:1.566
--- loncom/interface/londocs.pm:1.565	Mon Sep 23 17:35:07 2013
+++ loncom/interface/londocs.pm	Sun Oct  6 20:33:45 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.565 2013/09/23 17:35:07 bisitz Exp $
+# $Id: londocs.pm,v 1.566 2013/10/06 20:33:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4997,7 +4997,8 @@
                    foreach my $server (keys(%servers)) {
                        next if (grep(/^\Q$server\E$/, at ids));
                        my $hashid=$coursenum.':'.$coursedom;
-                       &Apache::lonnet::remote_devalidate_cache($server,'suppcount',$hashid);
+                       my $cachekey = &escape('suppcount').':'.&escape($hashid);
+                       &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]);
                    }
                    &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
                    undef($suppchanges);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1240 loncom/lonnet/perl/lonnet.pm:1.1241
--- loncom/lonnet/perl/lonnet.pm:1.1240	Sun Oct  6 14:20:36 2013
+++ loncom/lonnet/perl/lonnet.pm	Sun Oct  6 20:33:51 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1240 2013/10/06 14:20:36 raeburn Exp $
+# $Id: lonnet.pm,v 1.1241 2013/10/06 20:33:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -356,8 +356,11 @@
 }
 
 sub remote_devalidate_cache {
-    my ($lonhost,$name,$id) = @_;
-    my $response = &reply('devalidatecache:'.&escape($name).':'.&escape($id),$lonhost);
+    my ($lonhost,$cachekeys) = @_;
+    my $items;
+    return unless (ref($cachekeys) eq 'ARRAY');
+    my $cachestr = join('&',@{$cachekeys});
+    my $response = &reply('devalidatecache:'.&escape($cachestr),$lonhost);
     return $response;
 }
 




More information about the LON-CAPA-cvs mailing list