Diff for /loncom/metadata_database/searchcat.pl between versions 1.70.2.3 and 1.71

version 1.70.2.3, 2007/01/03 04:01:32 version 1.71, 2006/12/29 19:15:27
Line 241  foreach my $dom (@domains) { Line 241  foreach my $dom (@domains) {
             my ($group,$url,$fullpath);              my ($group,$url,$fullpath);
             if ($is_course) {              if ($is_course) {
                 ($group, my ($path)) = ($file =~ /^(\w+)(\/.+)$/);                  ($group, my ($path)) = ($file =~ /^(\w+)(\/.+)$/);
                 $fullpath = $pathstart.'/groups/'.$group.'/portfolio'.$path;                  $fullpath = $pathstart.'/groups/'.$group.'/portfolio/'.$path;
                 $url = $urlstart.'/groups/'.$group.'/portfolio'.$path;                  $url = $urlstart.'/groups/'.$group.'/portfolio'.$path;
             } else {              } else {
                 $fullpath = $pathstart.'/portfolio'.$file;                  $fullpath = $pathstart.'/portfolio'.$file;
                 $url = $urlstart.'/portfolio'.$file;                  $url .= $urlstart.'/portfolio'.$file;
             }              }
             if (ref($access{$file}) eq 'HASH') {              if (ref($access{$file}) eq 'HASH') {
                 &process_portfolio_access_data($url,$access{$file});                  &process_portfolio_access_data($url,$access{$file});
Line 330  sub process_portfolio_access_data { Line 330  sub process_portfolio_access_data {
         $acc_data->{keynum} = $key;          $acc_data->{keynum} = $key;
         my ($num,$scope,$end,$start) =          my ($num,$scope,$end,$start) =
                         ($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/);                          ($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/);
         next if (($scope ne 'public') && ($scope ne 'guest'));  
         $acc_data->{scope} = $scope;          $acc_data->{scope} = $scope;
         if ($end != 0) {          if ($end != 0) {
             $acc_data->{end} = &sqltime($end);              $acc_data->{end} = &LONCAPA::lonmetadata::sqltime($end);
         }          }
         $acc_data->{start} = &sqltime($start);          $acc_data->{start} = &LONCAPA::lonmetadata::sqltime($start);
         if (! $simulate) {          if (! $simulate) {
             my ($count,$err) =              my ($count,$err) =
               &LONCAPA::lonmetadata::store_metadata($dbh,                &LONCAPA::lonmetadata::store_metadata($dbh,
Line 613  sub portfolio_metadata { Line 612  sub portfolio_metadata {
         $metacache{'owner'} = $uname.':'.$dom;          $metacache{'owner'} = $uname.':'.$dom;
         $metacache{'domain'} = $dom;          $metacache{'domain'} = $dom;
         $metacache{'mime'} = $mime;          $metacache{'mime'} = $mime;
         if ($group ne '') {          if (defined($group)) {
             $metacache{'keys'} .= ',courserestricted';              $metacache{'keys'} .= ',courserestricted';
             $metacache{'courserestricted'} = 'course.'.$dom.'_'.$uname;              $metacache{'courserestricted'} = 'course.'.$dom.'_'.$uname;
         }           } 
Line 693  sub getfiledates { Line 692  sub getfiledates {
         $ref->{'lastrevisiondate'} =~ /^\s*$/) {          $ref->{'lastrevisiondate'} =~ /^\s*$/) {
         $ref->{'lastrevisiondate'} = (stat($target))[9];          $ref->{'lastrevisiondate'} = (stat($target))[9];
     }      }
     $ref->{'creationdate'}     = &sqltime($ref->{'creationdate'});      $ref->{'creationdate'}     = 
     $ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'});          &LONCAPA::lonmetadata::sqltime($ref->{'creationdate'});
       $ref->{'lastrevisiondate'} = 
           &LONCAPA::lonmetadata::sqltime($ref->{'lastrevisiondate'});
 }  }
   
 ########################################################  ########################################################
Line 889  sub propath { Line 890  sub propath {
 }   } 
   
 ##  ##
 ## &sqltime($timestamp)  
 ##  
 ## Convert perl $timestamp to MySQL time.  MySQL expects YYYY-MM-DD HH:MM:SS  
 ##  
 sub sqltime {  
     my ($time) = @_;  
     my $mysqltime;  
     if ($time =~   
         /(\d+)-(\d+)-(\d+) # YYYY-MM-DD  
         \s                 # a space  
         (\d+):(\d+):(\d+)  # HH:MM::SS  
         /x ) {   
         # Some of the .meta files have the time in mysql  
         # format already, so just make sure they are 0 padded and  
         # pass them back.  
         $mysqltime = sprintf('%04d-%02d-%02d %02d:%02d:%02d',  
                              $1,$2,$3,$4,$5,$6);  
     } elsif ($time =~ /^\d+$/) {  
         my @TimeData = gmtime($time);  
         # Alter the month to be 1-12 instead of 0-11  
         $TimeData[4]++;  
         # Alter the year to be from 0 instead of from 1900  
         $TimeData[5]+=1900;  
         $mysqltime = sprintf('%04d-%02d-%02d %02d:%02d:%02d',  
                              @TimeData[5,4,3,2,1,0]);  
     } elsif (! defined($time) || $time == 0) {  
         $mysqltime = 0;  
     } else {  
         &log(0,"    sqltime:Unable to decode time ".$time);  
         $mysqltime = 0;  
     }  
     return $mysqltime;  
 }  
   
 ##  
 ## &declutter($filename)  ## &declutter($filename)
 ##   Given a filename, returns a url for the filename.  ##   Given a filename, returns a url for the filename.
 sub declutter {  sub declutter {

Removed from v.1.70.2.3  
changed lines
  Added in v.1.71


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