diff --git a/backup/CHANGES_14_15.txt b/backup/CHANGES_14_15.txt index 71b804639bd..b0a31fc131b 100644 --- a/backup/CHANGES_14_15.txt +++ b/backup/CHANGES_14_15.txt @@ -43,7 +43,7 @@ Now I show the specific detailed status of every item in the process: 26. DONE: chat_users->course and chat_users->lang. No changes required! 27. PROG: Make the backup/restore/config/logs/index.php XHTML 1.0 Transitional. Done in manual backups, config, logs and restore. -28. TODO: Add course->theme, groups->them and user->theme. If no present, +28. DONE: Add course->theme, groups->them and user->theme. If no present, default blank. 29. TODO: Add support for block instances in modules. Bug 2517. Eloy (stronk7) diff --git a/backup/backuplib.php b/backup/backuplib.php index 27abee3d5f9..0b42ca4df63 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -609,6 +609,7 @@ fwrite ($bf,full_tag("GROUPMODE",3,false,$course->groupmode)); fwrite ($bf,full_tag("GROUPMODEFORCE",3,false,$course->groupmodeforce)); fwrite ($bf,full_tag("LANG",3,false,$course->lang)); + fwrite ($bf,full_tag("THEME",3,false,$course->theme)); fwrite ($bf,full_tag("COST",3,false,$course->cost)); fwrite ($bf,full_tag("MARKER",3,false,$course->marker)); fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible)); @@ -990,6 +991,7 @@ fwrite ($bf,full_tag("CITY",4,false,$user_data->city)); fwrite ($bf,full_tag("COUNTRY",4,false,$user_data->country)); fwrite ($bf,full_tag("LANG",4,false,$user_data->lang)); + fwrite ($bf,full_tag("THEME",4,false,$user_data->theme)); fwrite ($bf,full_tag("TIMEZONE",4,false,$user_data->timezone)); fwrite ($bf,full_tag("FIRSTACCESS",4,false,$user_data->firstaccess)); fwrite ($bf,full_tag("LASTACCESS",4,false,$user_data->lastaccess)); @@ -1312,6 +1314,7 @@ fwrite ($bf,full_tag("DESCRIPTION",4,false,$group->description)); fwrite ($bf,full_tag("PASSWORD",4,false,$group->password)); fwrite ($bf,full_tag("LANG",4,false,$group->lang)); + fwrite ($bf,full_tag("THEME",4,false,$group->theme)); fwrite ($bf,full_tag("PICTURE",4,false,$group->picture)); fwrite ($bf,full_tag("HIDEPICTURE",4,false,$group->hidepicture)); fwrite ($bf,full_tag("TIMECREATED",4,false,$group->timecreated)); diff --git a/backup/restorelib.php b/backup/restorelib.php index 9aff00ac2cc..50f9d4e11b0 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -584,6 +584,7 @@ $course->groupmode = addslashes($course_header->course_groupmode); $course->groupmodeforce = addslashes($course_header->course_groupmodeforce); $course->lang = addslashes($course_header->course_lang); + $course->theme = addslashes($course_header->course_theme); $course->cost = addslashes($course_header->course_cost); $course->marker = addslashes($course_header->course_marker); $course->visible = addslashes($course_header->course_visible); @@ -612,6 +613,12 @@ $course->metacourse = 0; } + //Check if the theme exists in destination server + $themes = get_list_of_themes(); + if (!in_array($course->theme, $themes)) { + $course->theme = ''; + } + //Now insert the record $newid = insert_record("course",$course); if ($newid) { @@ -1075,6 +1082,12 @@ //Nothing to do, we are in the same server } + //Check if the theme exists in destination server + $themes = get_list_of_themes(); + if (!in_array($user->theme, $themes)) { + $user->theme = ''; + } + //We are going to create the user //The structure is exactly as we need $newid = insert_record ("user",$user); @@ -1596,6 +1609,7 @@ $gro->description = backup_todb($info['GROUP']['#']['DESCRIPTION']['0']['#']); $gro->password = backup_todb($info['GROUP']['#']['PASSWORD']['0']['#']); $gro->lang = backup_todb($info['GROUP']['#']['LANG']['0']['#']); + $gro->theme = backup_todb($info['GROUP']['#']['THEME']['0']['#']); $gro->picture = backup_todb($info['GROUP']['#']['PICTURE']['0']['#']); $gro->hidepicture = backup_todb($info['GROUP']['#']['HIDEPICTURE']['0']['#']); $gro->timecreated = backup_todb($info['GROUP']['#']['TIMECREATED']['0']['#']); @@ -1612,6 +1626,13 @@ if ($create_group) { //Me must recode the courseid to the restore->course_id $gro->courseid = $restore->course_id; + + //Check if the theme exists in destination server + $themes = get_list_of_themes(); + if (!in_array($gro->theme, $themes)) { + $gro->theme = ''; + } + //The structure is equal to the db, so insert the group $newid = insert_record ("groups",$gro); } else { @@ -2832,6 +2853,9 @@ case "LANG": $this->info->course_lang = $this->getContents(); break; + case "THEME": + $this->info->course_theme = $this->getContents(); + break; case "COST": $this->info->course_cost = $this->getContents(); break; @@ -3190,6 +3214,9 @@ case "LANG": $this->info->tempuser->lang = $this->getContents(); break; + case "THEME": + $this->info->tempuser->theme = $this->getContents(); + break; case "TIMEZONE": $this->info->tempuser->timezone = $this->getContents(); break;