$preferences->backup_version = $CFG->backup_version;
$preferences->backup_release = $CFG->backup_release;
+ //Some parts of the backup doesn't know about $preferences, so we
+ //put a copy of it inside that CFG (always global) to be able to
+ //use it. Then, when needed I search for preferences inside CFG
+ //Used to avoid some problems in full_tag() when preferences isn't
+ //set globally (i.e. in scheduled backups)
+ $CFG->backup_preferences = $preferences;
+
//Check for temp and backup and backup_unique_code directory
//Create them as needed
schedule_backup_log($starttime,$preferences->backup_course," checking temp structures");
$status = clean_temp_data ($preferences);
}
+ //Unset CFG->backup_preferences only needed in scheduled backups
+ unset ($CFG->backup_preferences);
+
return $status;
}
fwrite ($bf,full_tag("GUEST",3,false,$course->guest));
fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate));
fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections));
- fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent));
+ //fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent)); INFO: This is out in 1.3
fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes));
fwrite ($bf,full_tag("SHOWREPORTS",3,false,$course->showreports));
fwrite ($bf,full_tag("GROUPMODE",3,false,$course->groupmode));
fwrite ($bf,full_tag("EVENTTYPE",4,false,$event->eventtype));
fwrite ($bf,full_tag("TIMESTART",4,false,$event->timestart));
fwrite ($bf,full_tag("TIMEDURATION",4,false,$event->timeduration));
+ fwrite ($bf,full_tag("VISIBLE",4,false,$event->visible));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$event->timemodified));
//End event tag
fwrite ($bf,end_tag("EVENT",3,true));
//This function encode things to make backup multi-site fully functional
//It does this conversions:
- // - $CFG->wwwroot -----------------------------> $@WWWROOT@$
- // - /file.php/$courseid -----------------------> /file.php/$@COURSEID@$
+ // - $CFG->wwwroot/file.php/courseid ----------------------> $@FILEPHP@$
// - Links to forums everywhere (DB) are encoded.
//
function backup_encode_absolute_links($content) {
global $CFG,$preferences;
- //Now we encode calls to file.php or wwwroot
- $search = array ($CFG->wwwroot,
- "/file.php/".$preferences->backup_course);
+ //Check if preferences is ok. If it isn't set, we are
+ //in a scheduled_backup to we are able to get a copy
+ //from CFG->backup_preferences
+ if (!isset($preferences)) {
+ $preferences = $CFG->backup_preferences;
+ }
+
+ //First, we check for every call to file.php inside the course
+ $search = array($CFG->wwwroot."/file.php/".$preferences->backup_course);
- $replace = array ("$@WWWROOT@$",
- "/file.php/$@COURSEID@$");
+ $replace = array("$@FILEPHP@$");
$result = str_replace($search,$replace,$content);
$eve->eventtype = backup_todb($info['EVENT']['#']['EVENTTYPE']['0']['#']);
$eve->timestart = backup_todb($info['EVENT']['#']['TIMESTART']['0']['#']);
$eve->timeduration = backup_todb($info['EVENT']['#']['TIMEDURATION']['0']['#']);
+ $eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']);
$eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']);
//Now search if that event exists (by description and timestart field) in
//This function decode things to make restore multi-site fully functional
//It does this conversions:
- // - $@WWWROOT@$ -------------------------------> $CFG->wwwroot
- // - $@COURSEID@$ ------------------------------> $courseid
+ // - $@FILEPHP@$ -------------------------------> $CFG->wwwroot/file.php/courseid
//
//Note: Inter-activities linking is being implemented as a final
//step in the restore execution, because we need to have it
global $CFG,$restore;
//Now decode wwwroot and file.php calls
- $search = array ("$@WWWROOT@$",
- "$@COURSEID@$");
+ $search = array ("$@FILEPHP@$");
- $replace = array ($CFG->wwwroot,
- $restore->course_id);
+ $replace = array ($CFG->wwwroot."/file.php/".$restore->course_id);
$result = str_replace($search,$replace,$content);