[LON-CAPA-cvs] cvs: loncom / lond
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 27 Jan 2006 23:04:27 -0000
albertel Fri Jan 27 18:04:27 2006 EDT
Modified files:
/loncom lond
Log:
- BUG 4562, meta data wasn't being invalidated (it's the unlcutered url that is stored)
Index: loncom/lond
diff -u loncom/lond:1.307 loncom/lond:1.308
--- loncom/lond:1.307 Fri Jan 27 16:45:28 2006
+++ loncom/lond Fri Jan 27 18:04:27 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.307 2006/01/27 21:45:28 albertel Exp $
+# $Id: lond,v 1.308 2006/01/27 23:04:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -59,7 +59,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.307 $'; #' stupid emacs
+my $VERSION='$Revision: 1.308 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -1944,6 +1944,7 @@
my $since=$now-$atime;
if ($since>$perlvar{'lonExpire'}) {
my $reply=&reply("unsub:$fname","$clientname");
+ &devalidate_meta_cache($fname);
unlink("$fname");
} else {
my $transname="$fname.in.transfer";
@@ -1974,14 +1975,7 @@
alarm(0);
}
rename($transname,$fname);
- use Cache::Memcached;
- my $memcache=
- new Cache::Memcached({'servers'=>['127.0.0.1:11211']});
- my $url=$fname;
- $url=~s-^/home/httpd/html--;
- $url=~s-\.meta$--;
- my $id=&escape('meta:'.$url);
- $memcache->delete($id);
+ &devalidate_meta_cache($fname);
}
}
&Reply( $client, "ok\n", $userinput);
@@ -1995,6 +1989,26 @@
}
®ister_handler("update", \&update_resource_handler, 0 ,1, 0);
+sub devalidate_meta_cache {
+ my ($url) = @_;
+ use Cache::Memcached;
+ my $memcache = new Cache::Memcached({'servers'=>['127.0.0.1:11211']});
+ $url = &declutter($url);
+ $url =~ s-\.meta$--;
+ my $id = &escape('meta:'.$url);
+ $memcache->delete($id);
+}
+
+sub declutter {
+ my $thisfn=shift;
+ $thisfn=~s/^\Q$perlvar{'lonDocRoot'}\E//;
+ $thisfn=~s/^\///;
+ $thisfn=~s|^adm/wrapper/||;
+ $thisfn=~s|^adm/coursedocs/showdoc/||;
+ $thisfn=~s/^res\///;
+ $thisfn=~s/\?.+$//;
+ return $thisfn;
+}
#
# Fetch a user file from a remote server to the user's home directory
# userfiles subdir.