version 1.301, 2005/10/17 20:09:01
|
version 1.305.2.1, 2006/01/27 23:05:30
|
Line 1943 sub update_resource_handler {
|
Line 1943 sub update_resource_handler {
|
my $since=$now-$atime; |
my $since=$now-$atime; |
if ($since>$perlvar{'lonExpire'}) { |
if ($since>$perlvar{'lonExpire'}) { |
my $reply=&reply("unsub:$fname","$clientname"); |
my $reply=&reply("unsub:$fname","$clientname"); |
|
&devalidate_meta_cache($fname); |
unlink("$fname"); |
unlink("$fname"); |
} else { |
} else { |
my $transname="$fname.in.transfer"; |
my $transname="$fname.in.transfer"; |
Line 1973 sub update_resource_handler {
|
Line 1974 sub update_resource_handler {
|
alarm(0); |
alarm(0); |
} |
} |
rename($transname,$fname); |
rename($transname,$fname); |
use Cache::Memcached; |
&devalidate_meta_cache($fname); |
my $memcache= |
|
new Cache::Memcached({'servers'=>['127.0.0.1:11211']}); |
|
my $url=$fname; |
|
$url=~s-^/home/httpd/html--; |
|
my $id=&escape('meta:'.$url); |
|
$memcache->delete($id); |
|
} |
} |
} |
} |
&Reply( $client, "ok\n", $userinput); |
&Reply( $client, "ok\n", $userinput); |
Line 1993 sub update_resource_handler {
|
Line 1988 sub update_resource_handler {
|
} |
} |
®ister_handler("update", \&update_resource_handler, 0 ,1, 0); |
®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 |
# Fetch a user file from a remote server to the user's home directory |
# userfiles subdir. |
# userfiles subdir. |
Line 3594 sub dump_dcmail_handler {
|
Line 3609 sub dump_dcmail_handler {
|
if ($hashref) { |
if ($hashref) { |
while (my ($key,$value) = each(%$hashref)) { |
while (my ($key,$value) = each(%$hashref)) { |
my $match = 1; |
my $match = 1; |
my ($timestamp,$subj,$uname,$udom) = split(/:/,&unescape($key),5); |
my ($timestamp,$subj,$uname,$udom) = |
$timestamp = &unescape($timestamp); |
split(/:/,&unescape(&unescape($key)),5); # yes, twice really |
$subj = &unescape($subj); |
$subj = &unescape($subj); |
$uname = &unescape($uname); |
|
$udom = &unescape($udom); |
|
unless ($startfilter eq '.' || !defined($startfilter)) { |
unless ($startfilter eq '.' || !defined($startfilter)) { |
if ($timestamp < $startfilter) { |
if ($timestamp < $startfilter) { |
$match = 0; |
$match = 0; |