[LON-CAPA-cvs] cvs: loncom /interface londocs.pm /publisher lonpublisher.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 27 Jun 2005 21:40:41 -0000


www		Mon Jun 27 17:40:41 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /loncom/publisher	lonpublisher.pm 
  Log:
  Saving my work on Bug #4127 - still having problems with "Invalid access"
  
  After recently changing resource version for a course, &symbverify fails
  in spite of both the URL and the given symb being correct.
  
  Not sure what else needs to be reset.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.191 loncom/interface/londocs.pm:1.192
--- loncom/interface/londocs.pm:1.191	Sun Jun 26 11:42:52 2005
+++ loncom/interface/londocs.pm	Mon Jun 27 17:40:38 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.191 2005/06/26 15:42:52 raeburn Exp $
+# $Id: londocs.pm,v 1.192 2005/06/27 21:40:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1667,8 +1667,15 @@
 	     &mt('Return to DOCS').'</a>');
 }
 
+
 # -------------------------------------------------------------- Check Versions
 
+sub devalidateversioncache {
+    my $src=shift;
+    &Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'.
+					  &Apache::lonnet::clutter($src));
+}
+
 sub checkversions {
     my $r=shift;
     my $html=&Apache::lonxml::xmlbegin();
@@ -1695,6 +1702,7 @@
 	foreach (keys %hash) {
 	    if ($_=~/^ids\_(\/res\/.+)$/) {
 		$newsetversions{$1}='mostrecent';
+                &devalidateversioncache($1);
 	    }
 	}
     } elsif ($env{'form.setcurrent'}) {
@@ -1704,6 +1712,7 @@
 		my $getvers=&Apache::lonnet::getversion($1);
 		if ($getvers>0) {
 		    $newsetversions{$1}=$getvers;
+		    &devalidateversioncache($1);
 		}
 	    }
 	}
@@ -1714,6 +1723,7 @@
 		my $src=$1;
 		if (($env{$_}) && ($env{$_} ne $setversions{$src})) {
 		    $newsetversions{$src}=$env{$_};
+		    &devalidateversioncache($src);
 		}
 	    }
 	}
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.198 loncom/publisher/lonpublisher.pm:1.199
--- loncom/publisher/lonpublisher.pm:1.198	Thu Jun 23 18:46:00 2005
+++ loncom/publisher/lonpublisher.pm	Mon Jun 27 17:40:39 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.198 2005/06/23 22:46:00 www Exp $
+# $Id: lonpublisher.pm,v 1.199 2005/06/27 21:40:39 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1647,10 +1647,16 @@
 	$r->register_cleanup(\&notify);
 	$registered_cleanup=1;
     }
+
+# ---------------------------------------------------------- Clear local caches
+    my $thisdistarget=$target;
+    $thisdistarget=~s/^\Q$docroot\E//;
+    &Apache::lonnet::devalidate_cache_new('resversion',$target);
+    &Apache::lonnet::devalidate_cache_new('meta',
+			 &Apache::lonnet::declutter($thisdistarget));
+
 # ------------------------------------------------ Provide link to new resource
     unless ($batch) {
-        my $thisdistarget=$target;
-        $thisdistarget=~s/^\Q$docroot\E//;
         
         my $thissrc=$source;
         $thissrc=~s/^\/home\/(\w+)\/public_html/\/priv\/$1/;