From: Eloy Lafuente Date: Fri, 18 Dec 2009 17:40:16 +0000 (+0000) Subject: MDL-21160 database activity - remap scale on restore ; merged from 19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=14594faa80f1e843082f17bdf1e680fc433a5f88;p=moodle.git MDL-21160 database activity - remap scale on restore ; merged from 19_STABLE --- diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index 9b76d31e23..096c5fbc9e 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -99,6 +99,14 @@ function data_restore_mods($mod,$restore) { unset($database->notification); /// Unset it if null to get proper Moodle 2.0 default (0) applied } + // 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 = $DB->insert_record ('data', $database); //Do some output @@ -727,5 +735,3 @@ function data_decode_content_links_caller($restore) { return $status; } - -