version 1.1353, 2017/08/27 13:48:52
|
version 1.1354, 2017/08/27 17:49:49
|
Line 3171 sub externalssi {
|
Line 3171 sub externalssi {
|
} |
} |
} |
} |
|
|
|
|
|
# If the local copy of a replicated resource is outdated, trigger a |
|
# connection from the homeserver to flush the delayed queue. If no update |
|
# happens, remove local copies of outdated resource (and corresponding |
|
# metadata file). |
|
|
sub remove_stale_resfile { |
sub remove_stale_resfile { |
my ($url) = @_; |
my ($url) = @_; |
my $stale; |
my $removed; |
if ($url=~m{^/res/($match_domain)/($match_username)/}) { |
if ($url=~m{^/res/($match_domain)/($match_username)/}) { |
my $audom = $1; |
my $audom = $1; |
my $auname = $2; |
my $auname = $2; |
Line 3194 sub remove_stale_resfile {
|
Line 3200 sub remove_stale_resfile {
|
my $remmodtime = &HTTP::Date::str2time( $response->header('Last-modified') ); |
my $remmodtime = &HTTP::Date::str2time( $response->header('Last-modified') ); |
my $locmodtime = (stat($fname))[9]; |
my $locmodtime = (stat($fname))[9]; |
if ($locmodtime < $remmodtime) { |
if ($locmodtime < $remmodtime) { |
unlink($fname); |
my $stale; |
if ($uri!~/\.meta$/) { |
my $answer = &reply('pong',$homeserver); |
unlink($fname.'.meta'); |
if ($answer eq $homeserver.':'.$perlvar{'lonHostID'}) { |
|
sleep(0.2); |
|
$locmodtime = (stat($fname))[9]; |
|
if ($locmodtime < $remmodtime) { |
|
my $posstransfer = $fname.'.in.transfer'; |
|
if ((-e $posstransfer) && ($remmodtime < (stat($posstransfer))[9])) { |
|
$removed = 1; |
|
} else { |
|
$stale = 1; |
|
} |
|
} else { |
|
$removed = 1; |
|
} |
|
} else { |
|
$stale = 1; |
|
} |
|
if ($stale) { |
|
unlink($fname); |
|
if ($uri!~/\.meta$/) { |
|
unlink($fname.'.meta'); |
|
} |
|
&reply("unsub:$fname",$homeserver); |
|
$removed = 1; |
} |
} |
&reply("unsub:$fname",$homeserver); |
|
$stale = 1; |
|
} |
} |
} |
} |
} |
} |
Line 3207 sub remove_stale_resfile {
|
Line 3233 sub remove_stale_resfile {
|
} |
} |
} |
} |
} |
} |
return $stale; |
return $removed; |
} |
} |
|
|
# -------------------------------- Allow a /uploaded/ URI to be vouched for |
# -------------------------------- Allow a /uploaded/ URI to be vouched for |