Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1170 and 1.1172.2.4

version 1.1170, 2012/05/18 20:03:22 version 1.1172.2.4, 2012/05/30 16:57:06
Line 97  use File::MMagic; Line 97  use File::MMagic;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use LONCAPA::Configuration;  use LONCAPA::Configuration;
 use LONCAPA::lonmetadata;  use LONCAPA::lonmetadata;
 use LONCAPA::Lond;  
   
 use File::Copy;  use File::Copy;
   
Line 1237  sub check_loadbalancing { Line 1236  sub check_loadbalancing {
     my ($is_balancer,$dom_in_use,$homeintdom,$rule_in_effect,      my ($is_balancer,$dom_in_use,$homeintdom,$rule_in_effect,
         $offloadto,$otherserver);          $offloadto,$otherserver);
     my $lonhost = $perlvar{'lonHostID'};      my $lonhost = $perlvar{'lonHostID'};
       my @hosts = &current_machine_ids();
     my $uprimary_id = &Apache::lonnet::domain($udom,'primary');      my $uprimary_id = &Apache::lonnet::domain($udom,'primary');
     my $uintdom = &Apache::lonnet::internet_dom($uprimary_id);      my $uintdom = &Apache::lonnet::internet_dom($uprimary_id);
     my $intdom = &Apache::lonnet::internet_dom($lonhost);      my $intdom = &Apache::lonnet::internet_dom($lonhost);
Line 1263  sub check_loadbalancing { Line 1263  sub check_loadbalancing {
         my $currtargets = $result->{'targets'};          my $currtargets = $result->{'targets'};
         my $currrules = $result->{'rules'};          my $currrules = $result->{'rules'};
         if ($currbalancer ne '') {          if ($currbalancer ne '') {
             my @hosts = &current_machine_ids();  
             if (grep(/^\Q$currbalancer\E$/,@hosts)) {              if (grep(/^\Q$currbalancer\E$/,@hosts)) {
                 $is_balancer = 1;                  $is_balancer = 1;
             }              }
Line 1379  sub check_loadbalancing { Line 1378  sub check_loadbalancing {
             }              }
         }          }
     }      }
       if (($otherserver ne '') && (grep(/^\Q$otherserver\E$/,@hosts))) {
           $is_balancer = 0;
       }
     return ($is_balancer,$otherserver);      return ($is_balancer,$otherserver);
 }  }
   
 sub get_loadbalancer_targets {  sub get_loadbalancer_targets {
     my ($rule_in_effect,$currtargets,$uname,$udom) = @_;      my ($rule_in_effect,$currtargets,$uname,$udom) = @_;
     my $offloadto;      my $offloadto;
     if ($rule_in_effect eq '') {      if ($rule_in_effect eq 'none') {
           return [$perlvar{'lonHostID'}];
       } elsif ($rule_in_effect eq '') {
         $offloadto = $currtargets;          $offloadto = $currtargets;
     } else {      } else {
         if ($rule_in_effect eq 'homeserver') {          if ($rule_in_effect eq 'homeserver') {
Line 2568  sub ssi { Line 2572  sub ssi {
     }      }
   
     $request->header(Cookie => $ENV{'HTTP_COOKIE'});      $request->header(Cookie => $ENV{'HTTP_COOKIE'});
     my $response=$ua->request($request);      my $response= $ua->request($request);
   
     if (wantarray) {      if (wantarray) {
  return ($response->content, $response);   return ($response->content, $response);
     } else {      } else {
Line 3959  my $cachedtime=(); Line 3962  my $cachedtime=();
 sub load_all_first_access {  sub load_all_first_access {
     my ($uname,$udom)=@_;      my ($uname,$udom)=@_;
     if (($cachedkey eq $uname.':'.$udom) &&      if (($cachedkey eq $uname.':'.$udom) &&
         (abs($cachedtime-time)<5)) {          (abs($cachedtime-time)<5) && (!$env{'form.markaccess'})) {
         return;          return;
     }      }
     $cachedtime=time;      $cachedtime=time;
Line 10760  sub declutter { Line 10763  sub declutter {
     $thisfn=~s|^adm/wrapper/||;      $thisfn=~s|^adm/wrapper/||;
     $thisfn=~s|^adm/coursedocs/showdoc/||;      $thisfn=~s|^adm/coursedocs/showdoc/||;
     $thisfn=~s/^res\///;      $thisfn=~s/^res\///;
       $thisfn=~s/^priv\///;
     unless (($thisfn =~ /^ext/) || ($thisfn =~ /\.(page|sequence)___\d+___ext/)) {      unless (($thisfn =~ /^ext/) || ($thisfn =~ /\.(page|sequence)___\d+___ext/)) {
         $thisfn=~s/\?.+$//;          $thisfn=~s/\?.+$//;
     }      }
Line 11682  B<rolesinit($udom,$username)>: get user Line 11686  B<rolesinit($udom,$username)>: get user
 returns user role, first access and timer interval hashes  returns user role, first access and timer interval hashes
   
 =item *  =item *
   X<privileged()>
   B<privileged($username,$domain)>: returns a true if user has a
   privileged and active role (i.e. su or dc), false otherwise.
   
   =item *
 X<getsection()>  X<getsection()>
 B<getsection($udom,$uname,$cname)>: finds the section of student in the  B<getsection($udom,$uname,$cname)>: finds the section of student in the
 course $cname, return section name/number or '' for "not in course"  course $cname, return section name/number or '' for "not in course"

Removed from v.1.1170  
changed lines
  Added in v.1.1172.2.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>