version 1.7, 2008/09/11 13:19:28
|
version 1.11, 2015/06/23 17:49:06
|
Line 48 sub innercrsdirlist {
|
Line 48 sub innercrsdirlist {
|
unless ($path) { $path=''; } else { $path.='/'; } |
unless ($path) { $path=''; } else { $path.='/'; } |
my %crsdata=&Apache::lonnet::coursedescription($courseid); |
my %crsdata=&Apache::lonnet::coursedescription($courseid); |
my $getpropath = 1; |
my $getpropath = 1; |
my @listing=&Apache::lonnet::dirlist |
my ($dirlistref,$listerror) = |
($which,$crsdata{'domain'},$crsdata{'num'},$getpropath); |
&Apache::lonnet::dirlist($which,$crsdata{'domain'}, |
foreach (@listing) { |
$crsdata{'num'},$getpropath); |
unless ($_=~/^\./) { |
if (ref($dirlistref) eq 'ARRAY') { |
my @unpackline = split (/\&/,$_); |
foreach (@{$dirlistref}) { |
if ($unpackline[3]&$dirptr) { |
unless ($_=~/^\./) { |
|
my @unpackline = split (/\&/,$_); |
|
if ($unpackline[3]&$dirptr) { |
# is a directory, recurse |
# is a directory, recurse |
&innercrsdirlist($courseid,$which.$unpackline[0], |
&innercrsdirlist($courseid,$which.$unpackline[0], |
$path.$unpackline[0]); |
$path.$unpackline[0]); |
} else { |
} else { |
# is a file, put into output |
# is a file, put into output |
push (@output,$path.$unpackline[0]); |
push (@output,$path.$unpackline[0]); |
|
} |
} |
} |
} |
} |
} |
} |
return @output; |
return @output; |
} |
} |
Line 163 sub copyresourcedb {
|
Line 166 sub copyresourcedb {
|
$startdate = $start{'default_enrollment_start_date'}; |
$startdate = $start{'default_enrollment_start_date'}; |
} |
} |
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($key=~/\wtype$/) { |
if ($key=~/\wtype$/) { |
my $newkey=$key; |
my $newkey=$key; |
$newkey=~s/type$/\.type/; |
$newkey=~s/type$/\.type/; |
Line 174 sub copyresourcedb {
|
Line 177 sub copyresourcedb {
|
# adjust symbs |
# adjust symbs |
my $pattern='uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'; |
my $pattern='uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'; |
my $new= 'uploaded/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/'; |
my $new= 'uploaded/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/'; |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($key=~/\Q$pattern\E/) { |
if ($key=~/\Q$pattern\E/) { |
my $newkey=$key; |
my $newkey=$key; |
$newkey=~s/\Q$pattern\E/$new/; |
$newkey=~s/\Q$pattern\E/$new/; |
Line 183 sub copyresourcedb {
|
Line 186 sub copyresourcedb {
|
} |
} |
} |
} |
# transfer hash |
# transfer hash |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
my $thiskey=$key; |
my $thiskey=$key; |
$thiskey=~s/^$origcrsid/$newcrsid/; |
$thiskey=~s/^$origcrsid/$newcrsid/; |
$newdata{$thiskey}=$data{$key}; |
$newdata{$thiskey}=$data{$key}; |
Line 224 sub copydbfiles {
|
Line 227 sub copydbfiles {
|
$origcrs_discussion=~s|/|_|g; |
$origcrs_discussion=~s|/|_|g; |
foreach (&crsdirlist($origcrsid)) { |
foreach (&crsdirlist($origcrsid)) { |
if ($_=~/\.db$/) { |
if ($_=~/\.db$/) { |
unless |
unless ($_=~/^(nohist\_|disclikes|discussiontimes|classlist|versionupdate |
($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata|\Q$origcrs_discussion\E|slots|slot_reservations|gradingqueue|reviewqueue|CODEs|groupmembership)/) { |
|resourcedata|\Q$origcrs_discussion\E|slots|slot_reservations |
©db($origcrsid,$newcrsid,$_); |
|gradingqueue|reviewqueue|CODEs|groupmembership|comm_block)/) { |
} |
©db($origcrsid,$newcrsid,$_); |
|
} |
} |
} |
} |
} |
} |
} |