Diff for /rat/lonuserstate.pm between versions 1.149.2.2 and 1.153

version 1.149.2.2, 2019/02/07 01:51:34 version 1.153, 2017/09/03 18:52:23
Line 42  use Safe::Hole; Line 42  use Safe::Hole;
 use Opcode;  use Opcode;
 use Apache::lonenc;  use Apache::lonenc;
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use LONCAPA;  use LONCAPA qw(:DEFAULT :match);
 use File::Basename;  use File::Basename;
   
     
Line 255  sub loadmap { Line 255  sub loadmap {
  push(@map_ids, $resource_id);   push(@map_ids, $resource_id);
                 if ($hash{'src_'.$lpc.'.'.$resource_id}) {                  if ($hash{'src_'.$lpc.'.'.$resource_id}) {
                     $rescount{$lpc} ++;                      $rescount{$lpc} ++;
                     if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) ||                      if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || 
                         ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) {                          ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) {
                         $mapcount{$lpc} ++;                          $mapcount{$lpc} ++; 
                     }                      }
                 }                  }
                 unless ($codechecked) {                  unless ($codechecked) {
Line 484  sub parse_resource { Line 484  sub parse_resource {
     } elsif ($turi!~/\.(sequence|page)$/) {      } elsif ($turi!~/\.(sequence|page)$/) {
  $turi='/adm/coursedocs/showdoc'.$turi;   $turi='/adm/coursedocs/showdoc'.$turi;
     }      }
           } elsif ($turi=~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {
               $turi='/adm/wrapper'.$turi;
  } elsif ($turi=~/\S/) { # normal non-empty internal resource   } elsif ($turi=~/\S/) { # normal non-empty internal resource
     my $mapdir=$uri;      my $mapdir=$uri;
     $mapdir=~s/[^\/]+$//;      $mapdir=~s/[^\/]+$//;
Line 1207  sub readmap { Line 1209  sub readmap {
     }      }
     @cond=('true:normal');      @cond=('true:normal');
   
     unless (open(LOCKFILE,">","$fn.db.lock")) {      unless (open(LOCKFILE,">$fn.db.lock")) {
  #    # 
  # Most likely a permissions problem on the lockfile or its directory.   # Most likely a permissions problem on the lockfile or its directory.
  #   #
Line 1225  sub readmap { Line 1227  sub readmap {
         &unlink_tmpfiles($fn);          &unlink_tmpfiles($fn);
     }      }
     undef %randompick;      undef %randompick;
     undef %randompickseed;  
     undef %randomorder;  
     undef %randomizationcode;  
     undef %hiddenurl;      undef %hiddenurl;
     undef %encurl;      undef %encurl;
     undef %rescount;  
     undef %mapcount;  
     $retfrid='';      $retfrid='';
     $errtext='';      $errtext='';
     my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags.      my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags.
Line 1373  sub readmap { Line 1370  sub readmap {
             $lock=1;              $lock=1;
         }          }
         undef %randompick;          undef %randompick;
         undef %randompickseed;  
         undef %randomorder;  
         undef %randomizationcode;  
         undef %hiddenurl;          undef %hiddenurl;
         undef %encurl;          undef %encurl;
         undef %rescount;  
         undef %mapcount;  
         $errtext='';          $errtext='';
         $retfrid='';          $retfrid='';
  #   #
Line 1530  sub build_tmp_hashes { Line 1522  sub build_tmp_hashes {
 # ---------------------------------------------------- Store away initial state  # ---------------------------------------------------- Store away initial state
     {      {
         my $cfh;          my $cfh;
         if (open($cfh,">","$fn.state")) {          if (open($cfh,">$fn.state")) {
             print $cfh join("\n",@cond);              print $cfh join("\n",@cond);
             $gotstate = 1;              $gotstate = 1;
         } else {          } else {
Line 1567  sub evalstate { Line 1559  sub evalstate {
     if (-e $fn) {      if (-e $fn) {
  my @conditions=();   my @conditions=();
  {   {
     open(my $fh,"<",$fn);      open(my $fh,"<$fn");
     @conditions=<$fh>;      @conditions=<$fh>;
             close($fh);              close($fh);
  }     }  

Removed from v.1.149.2.2  
changed lines
  Added in v.1.153


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