Skip to content

Commit

Permalink
Now restoring groups is cross-db (the detection of existing groups)
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 5, 2007
1 parent 15ef45d commit 2b27d0a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backup/restorelib.php
Expand Up @@ -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;
Expand Down

0 comments on commit 2b27d0a

Please sign in to comment.