Skip to content

Commit

Permalink
MDL-21160 database activity - remap scale on restore
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Dec 18, 2009
1 parent b9a18f1 commit 06cc4c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mod/data/restorelib.php
Expand Up @@ -97,6 +97,14 @@ function data_restore_mods($mod,$restore) {
$database->editany = backup_todb($info['MOD']['#']['EDITANY']['0']['#']);
$database->notification = backup_todb($info['MOD']['#']['NOTIFICATION']['0']['#']);

// We have to recode the scale field if it's <0 (positive is a grade, not a scale)
if ($database->scale < 0) {
$scale = backup_getid($restore->backup_unique_code, 'scale', abs($database->scale));
if ($scale) {
$database->scale = -($scale->new_id);
}
}

$newid = insert_record ('data', $database);

//Do some output
Expand Down Expand Up @@ -730,4 +738,4 @@ function data_decode_content_links_caller($restore) {
return $status;
}

?>
?>

0 comments on commit 06cc4c9

Please sign in to comment.