version 1.3, 2007/08/02 01:34:07
|
version 1.5, 2008/01/21 17:47:21
|
Line 115 sub copyfile {
|
Line 115 sub copyfile {
|
'/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/' |
'/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/' |
=> '/uploaded/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/', |
=> '/uploaded/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/', |
'/public/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/' |
'/public/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/' |
=> '/public/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/' |
=> '/public/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/', |
|
'/adm/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/' |
|
=> '/adm/'.$newcrsdata{'domain'}.'/'.$newcrsdata{'num'}.'/', |
))); |
))); |
} |
} |
} |
} |
Line 159 sub copyresourcedb {
|
Line 161 sub copyresourcedb {
|
|
|
$startdate = $start{'default_enrollment_start_date'}; |
$startdate = $start{'default_enrollment_start_date'}; |
} |
} |
my $today=time; |
|
my $delta=0; |
|
if ($startdate) { |
|
my $oneday=60*60*24; |
|
$delta=$today-$startdate; |
|
$delta=int($delta/$oneday)*$oneday; |
|
} |
|
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach (keys %data) { |
foreach (keys %data) { |
if ($_=~/\wtype$/) { |
if ($_=~/\wtype$/) { |
Line 186 sub copyresourcedb {
|
Line 181 sub copyresourcedb {
|
delete $data{$_}; |
delete $data{$_}; |
} |
} |
} |
} |
# adjust dates |
|
foreach (keys %data) { |
|
my $thiskey=$_; |
|
$thiskey=~s/^$origcrsid/$newcrsid/; |
|
$newdata{$thiskey}=$data{$_}; |
|
if ($data{$_.'.type'}=~/^date_(start|end)$/) { |
|
if ($delta > 0) { |
|
$newdata{$thiskey}=$newdata{$thiskey}+$delta; |
|
} else { |
|
# no delta, it's unlikely we want the old dates and times |
|
delete($newdata{$thiskey}); |
|
delete($newdata{$thiskey.'.type'}); |
|
} |
|
} |
|
} |
|
return &Apache::lonnet::put |
return &Apache::lonnet::put |
('resourcedata',\%newdata,$newcrsdata{'domain'},$newcrsdata{'num'}); |
('resourcedata',\%newdata,$newcrsdata{'domain'},$newcrsdata{'num'}); |
} |
} |