mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
fixed wrong } in hotpot_restore_dates()
This commit is contained in:
parent
25d13710ed
commit
0160a028c2
1 changed files with 21 additions and 22 deletions
|
@ -482,34 +482,33 @@ function hotpot_restore_logs($restore, $log) {
|
||||||
function hotpot_restore_dates($recordtype, &$restore, &$xml, $TAGS, $NAMETAG='NAME') {
|
function hotpot_restore_dates($recordtype, &$restore, &$xml, $TAGS, $NAMETAG='NAME') {
|
||||||
if (!empty($restore->course_startdateoffset)) {
|
if (!empty($restore->course_startdateoffset)) {
|
||||||
|
|
||||||
// check course backup data directory exists
|
// check course backup data directory exists
|
||||||
$course_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
|
$course_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
|
||||||
check_dir_exists($course_dir, true);
|
check_dir_exists($course_dir, true);
|
||||||
|
|
||||||
// open $restorelog and start output for this HotPot
|
// open $restorelog and start output for this HotPot
|
||||||
$restorelog = fopen("$course_dir/restorelog.html", "a");
|
$restorelog = fopen("$course_dir/restorelog.html", "a");
|
||||||
fwrite ($restorelog, "<br>Hotpot - ".$xml['NAME'][0]['#']." <br>");
|
fwrite ($restorelog, "<br>Hotpot - ".$xml['NAME'][0]['#']." <br>");
|
||||||
|
|
||||||
// loop through time fields
|
// loop through time fields
|
||||||
$TAGS = array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED');
|
$TAGS = array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED');
|
||||||
foreach ($TAGS as $TAG) {
|
foreach ($TAGS as $TAG) {
|
||||||
|
|
||||||
// check $TAG has a sensible value
|
// check $TAG has a sensible value
|
||||||
if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#'])) {
|
if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#'])) {
|
||||||
|
|
||||||
// write old date to $restorelog
|
// write old date to $restorelog
|
||||||
$value = $xml[$TAG][0]['#'];
|
$value = $xml[$TAG][0]['#'];
|
||||||
$date = usergetdate($value);
|
$date = usergetdate($value);
|
||||||
fwrite ($restorelog, "$TAG was ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']);
|
fwrite ($restorelog, "$TAG was ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']);
|
||||||
|
|
||||||
// write new date to $restorelog
|
// write new date to $restorelog
|
||||||
$value += $restore->course_startdateoffset;
|
$value += $restore->course_startdateoffset;
|
||||||
$date = usergetdate($value);
|
$date = usergetdate($value);
|
||||||
fwrite ($restorelog, " $TAG is now ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
|
fwrite ($restorelog, " $TAG is now ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
|
||||||
|
|
||||||
// update $value in $xml tree (as a string)
|
// update $value in $xml tree (as a string)
|
||||||
$xml[$TAG][0]['#'] = "$value";
|
$xml[$TAG][0]['#'] = "$value";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue