[LON-CAPA-cvs] cvs: loncom / lond
raeburn
raeburn@source.lon-capa.org
Sun, 26 Sep 2010 14:27:56 -0000
raeburn Sun Sep 26 14:27:56 2010 EDT
Modified files:
/loncom lond
Log:
- Efficiency.
- Skip release check for expired roles before calling &releasereqd_check,
instead of within releasereqd_check subroutine.
Index: loncom/lond
diff -u loncom/lond:1.456 loncom/lond:1.457
--- loncom/lond:1.456 Sun Sep 26 01:50:28 2010
+++ loncom/lond Sun Sep 26 14:27:56 2010
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.456 2010/09/26 01:50:28 raeburn Exp $
+# $Id: lond,v 1.457 2010/09/26 14:27:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,7 +58,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.456 $'; #' stupid emacs
+my $VERSION='$Revision: 1.457 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -3198,8 +3198,10 @@
my $cdom = $1;
my $cnum = $2;
unless ($skipcheck) {
- next unless (&releasereqd_check($cnum,$cdom,$key,$value,$major,$minor,
- $now,\%homecourses,\@ids));
+ my ($role,$end,$start) = split(/\_/,$value);
+ if (!$end || $end > $now) {
+ next unless (&releasereqd_check($cnum,$cdom,$key,$value,$major,
+ $minor,\%homecourses,\@ids));
}
}
}
@@ -7300,7 +7302,7 @@
}
sub releasereqd_check {
- my ($cnum,$cdom,$key,$value,$major,$minor,$now,$homecourses,$ids) = @_;
+ my ($cnum,$cdom,$key,$value,$major,$minor,$homecourses,$ids) = @_;
my $home = &Apache::lonnet::homeserver($cnum,$cdom);
return if ($home eq 'no_host');
my ($reqdmajor,$reqdminor,$displayrole);
@@ -7314,37 +7316,34 @@
return unless (&useable_role($reqdmajor,$reqdminor,$major,$minor));
}
}
- my ($role,$end,$start) = split(/_/,$value);
- if (!$end || $end > $now) {
- my $hashid = $cdom.':'.$cnum;
- my ($courseinfo,$cached) =
- &Apache::lonnet::is_cached_new('courseinfo',$hashid);
- if (defined($cached)) {
- if (ref($courseinfo) eq 'HASH') {
- if (exists($courseinfo->{'releaserequired'})) {
- my ($reqdmajor,$reqdminor) = split(/\./,$courseinfo->{'releaserequired'});
- return unless (&useable_role($reqdmajor,$reqdminor,$major,$minor));
- }
+ my $hashid = $cdom.':'.$cnum;
+ my ($courseinfo,$cached) =
+ &Apache::lonnet::is_cached_new('courseinfo',$hashid);
+ if (defined($cached)) {
+ if (ref($courseinfo) eq 'HASH') {
+ if (exists($courseinfo->{'releaserequired'})) {
+ my ($reqdmajor,$reqdminor) = split(/\./,$courseinfo->{'releaserequired'});
+ return unless (&useable_role($reqdmajor,$reqdminor,$major,$minor));
}
- } else {
- if (ref($ids) eq 'ARRAY') {
- if (grep(/^\Q$home\E$/,@{$ids})) {
- if (ref($homecourses) eq 'HASH') {
- if (ref($homecourses->{$hashid}) eq 'ARRAY') {
- push(@{$homecourses->{$hashid}},{$key=>$value});
- } else {
- $homecourses->{$hashid} = [{$key=>$value}];
- }
+ }
+ } else {
+ if (ref($ids) eq 'ARRAY') {
+ if (grep(/^\Q$home\E$/,@{$ids})) {
+ if (ref($homecourses) eq 'HASH') {
+ if (ref($homecourses->{$hashid}) eq 'ARRAY') {
+ push(@{$homecourses->{$hashid}},{$key=>$value});
+ } else {
+ $homecourses->{$hashid} = [{$key=>$value}];
}
- return;
}
+ return;
}
- my $courseinfo = &get_courseinfo_hash($cnum,$cdom,$home);
- if (ref($courseinfo) eq 'HASH') {
- if (exists($courseinfo->{'releaserequired'})) {
- my ($reqdmajor,$reqdminor) = split(/\./,$courseinfo->{'releaserequired'});
- return unless (&useable_role($reqdmajor,$reqdminor,$major,$minor));
- }
+ }
+ my $courseinfo = &get_courseinfo_hash($cnum,$cdom,$home);
+ if (ref($courseinfo) eq 'HASH') {
+ if (exists($courseinfo->{'releaserequired'})) {
+ my ($reqdmajor,$reqdminor) = split(/\./,$courseinfo->{'releaserequired'});
+ return unless (&useable_role($reqdmajor,$reqdminor,$major,$minor));
}
}
}