From 2b27d0a9460263a247a02f6c4703471fdb9eb1bf Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 5 Sep 2007 18:37:34 +0000 Subject: [PATCH] Now restoring groups is cross-db (the detection of existing groups) --- backup/restorelib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index 49c5e49afcaaa..ff1bd609e5d6f 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -2100,7 +2100,18 @@ function restore_create_groups($restore,$xml_file) { //Now search if that group exists (by name and description field) in //restore->course_id course - $gro_db = get_record("groups","courseid",$restore->course_id,"name",$gro->name,"description",$gro->description); + //Going to compare LOB columns so, use the cross-db sql_compare_text() in both sides. + $description_clause = ''; + if (!empty($gro->description)) { /// Only for groups having a description + $literal_description = "'" . $gro->description . "'"; + $description_clause = " AND " . + sql_compare_text('description') . " = " . + sql_compare_text($literal_description); + } + $gro_db = get_record_sql("SELECT * + FROM {$CFG->prefix}groups + WHERE courseid = $restore->course_id AND + name = '{$gro->name}'" . $description_clause); //If it doesn't exist, create if (!$gro_db) { $create_group = true;