--- loncom/lonnet/perl/lonnet.pm 2022/02/27 02:19:13 1.1172.2.147 +++ loncom/lonnet/perl/lonnet.pm 2022/03/25 22:53:51 1.1172.2.147.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1172.2.147 2022/02/27 02:19:13 raeburn Exp $ +# $Id: lonnet.pm,v 1.1172.2.147.2.1 2022/03/25 22:53:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5536,9 +5536,10 @@ my %cachedtimes=(); my $cachedtime=''; sub load_all_first_access { - my ($uname,$udom)=@_; + my ($uname,$udom,$ignorecache)=@_; if (($cachedkey eq $uname.':'.$udom) && - (abs($cachedtime-time)<5) && (!$env{'form.markaccess'})) { + (abs($cachedtime-time)<5) && (!$env{'form.markaccess'}) && + (!$ignorecache)) { return; } $cachedtime=time; @@ -5547,7 +5548,7 @@ sub load_all_first_access { } sub get_first_access { - my ($type,$argsymb,$argmap)=@_; + my ($type,$argsymb,$argmap,$ignorecache)=@_; my ($symb,$courseid,$udom,$uname)=&whichuser(); if ($argsymb) { $symb=$argsymb; } my ($map,$id,$res)=&decode_symb($symb); @@ -5559,7 +5560,7 @@ sub get_first_access { } else { $res=$symb; } - &load_all_first_access($uname,$udom); + &load_all_first_access($uname,$udom,$ignorecache); return $cachedtimes{"$courseid\0$res"}; } @@ -8633,7 +8634,8 @@ sub get_commblock_resources { } } } - if ($interval[0] =~ /^\d+$/) { + if ($interval[0] =~ /^(\d+)/) { + my $timelimit = $1; my $first_access; if ($type eq 'resource') { $first_access=&get_first_access($interval[1],$item); @@ -8643,7 +8645,7 @@ sub get_commblock_resources { $first_access=&get_first_access($interval[1]); } if ($first_access) { - my $timesup = $first_access+$interval[0]; + my $timesup = $first_access+$timelimit; if ($timesup > $now) { my $activeblock; if ($type eq 'resource') {