24. DONE: Take out THEME from backup directory.
25. TODO: Add support for forum_read table in backup and restore.
26. DONE: chat_users->course and chat_users->lang. No changes required!
+27. PROG: Make the backup/restore/scheduled/logs XHTML 1.0 Transitional.
+ Done in manual backups.
Eloy (stronk7)
23-01-2004
//Calculate the backup unique code to allow simultaneus backups (to define
//the temp-directory name and records in backup temp tables
$backup_unique_code = time();
- //Add as hidden name
- echo "<input type=\"hidden\" name=\"backup_unique_code\" value=\"".$backup_unique_code."\">";
if (empty($to)) {
//Now print the Backup Name tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string("name").":";
- echo "</B></td><td>";
+ echo "</b></td><td>";
//Add as text field
- echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\">";
+ echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backup_name."\" />";
echo "</td></tr>";
//Line
- echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+ echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now print the To Do list
echo "<tr>";
- echo "<td colspan=\"2\" align=\"center\"><p><b>";
+ echo "<td colspan=\"2\" align=\"center\"><b>";
} else {
- echo '<input type="hidden" name="backup_name" value="'.$backup_name.'" />';
+ echo '<input type="hidden" name="backup_name" value="'.$backup_name.'" /></b>';
}
$backup_logs = 0;
}
print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
- echo "<hr noshade size=\"1\">";
+ echo "<hr />";
}
if (empty($to)) {
echo get_string("backupdetails").":";
- echo "</td></tr>";
+ echo "</b></td></tr>";
}
//This is tha align to every ingo table
//If exists the lib & function
$var = "exists_".$modname;
if (isset($$var) && $$var) {
- //Add hidden fields
- $var = "backup_".$modname;
- echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
- $var = "backup_user_info_".$modname;
- echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\">";
$var = "backup_".$modname;
//Only if selected
if ($$var == 1) {
//Print the full tr
echo "<tr>";
- echo "<td colspan=\"2\"><p><b>";
+ echo "<td colspan=\"2\">";
+ //Add hidden fields
+ $var = "backup_".$modname;
+ echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
+ $var = "backup_user_info_".$modname;
+ echo "<input type=\"hidden\" name=\"".$var."\" value=\"".$$var."\" />";
//Print the mod name
- echo "<li>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
+ echo "<b>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
//Now look for user-data status
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
$var = "backup_user_info_".$modname;
//Print the user info
- echo $backup_user_options[$$var]."<p>";
+ echo $backup_user_options[$$var]."</b>";
//Call the check function to show more info
$modcheckbackup = $modname."_check_backup_mods";
$table->data = $modcheckbackup($id,$$var,$backup_unique_code);
}
}
- //Write metacourse hidden field
- echo "<input type=\"hidden\" name=\"backup_metacourse\" value=\"".$backup_metacourse."\">";
if (empty($to)) {
//Line
- echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+ echo "<tr><td colspan=\"2\"><hr /></td></tr>";
//Now print the Users tr
echo "<tr>";
- echo "<td colspan=\"2\"><p><b>";
+ echo "<td colspan=\"2\"><b>";
$user_options[0] = get_string("includeallusers");
$user_options[1] = get_string("includecourseusers");
$user_options[2] = get_string("includenoneusers");
- echo "<li>".$user_options[$backup_users]."<p>";
+ echo $user_options[$backup_users].'</b>';
//Print info
$table->data = user_check_backup($id,$backup_unique_code,$backup_users);
print_table($table);
echo "</td></tr>";
}
- //Add as hidden name
- echo "<input type=\"hidden\" name=\"backup_users\" value=\"".$backup_users."\">";
//Now print the Logs tr conditionally
if ($backup_logs && empty($to)) {
echo "<tr>";
- echo "<td colspan=\"2\"><p><b>";
- echo "<li>".get_string("includelogentries")."<p>";
+ echo "<td colspan=\"2\"><b>";
+ echo get_string("includelogentries").'</b>';
//Print info
$table->data = log_check_backup($id);
print_table($table);
echo "</td></tr>";
}
- //Add as hidden name
- echo "<input type=\"hidden\" name=\"backup_logs\" value=\"".$backup_logs."\">";
//Now print the User Files tr conditionally
if ($backup_user_files) {
echo "<tr>";
- echo "<td colspan=\"2\"><p><b>";
- echo "<li>".get_string("includeuserfiles")."<p>";
+ echo "<td colspan=\"2\"><b>";
+ echo get_string("includeuserfiles").'</b>';
//Print info
$table->data = user_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
- //Add as hidden name
- echo "<input type=\"hidden\" name=\"backup_user_files\" value=\"".$backup_user_files."\">";
//Now print the Course Files tr conditionally
if ($backup_course_files) {
echo "<tr>";
- echo "<td colspan=\"2\"><p><b>";
- echo "<li>".get_string("includecoursefiles")."<p>";
+ echo "<td colspan=\"2\"><b>";
+ echo get_string("includecoursefiles").'</b>';
//Print info
$table->data = course_files_check_backup($id,$backup_unique_code);
print_table($table);
echo "</td></tr>";
}
- //Add as hidden name
- echo "<input type=\"hidden\" name=\"backup_course_files\" value=\"".$backup_course_files."\">";
}
?>
</table>
<br />
<center>
+<input type="hidden" name="backup_unique_code" value="<?php p($backup_unique_code) ?>" />
+<input type="hidden" name="backup_metacourse" value="<?php p($backup_metacourse) ?>" />
+<input type="hidden" name="backup_users" value="<?php p($backup_users) ?>" />
+<input type="hidden" name="backup_logs" value="<?php p($backup_logs) ?>" />
+<input type="hidden" name="backup_user_files" value="<?php p($backup_user_files) ?>" />
+<input type="hidden" name="backup_course_files" value="<?php p($backup_course_files) ?>" />
<input type="hidden" name="to" value="<?php p($to) ?>" />
<input type="hidden" name="id" value="<?php p($id) ?>" />
<input type="hidden" name="launch" value="execute" />
if (empty($to)) {
//Start the main table
- echo "<table cellpadding=5>";
+ echo "<table cellpadding=\"5\">";
//Now print the Backup Name tr
echo "<tr>";
- echo "<td align=\"right\"><p><b>";
+ echo "<td align=\"right\"><b>";
echo get_string("name").":";
echo "</b></td><td>";
echo $preferences->backup_name;
}
//Check for temp and backup and backup_unique_code directory
//Create them as needed
- echo "<li>".get_string("creatingtemporarystructures");
+ echo "<li>".get_string("creatingtemporarystructures").'</li>';
$status = check_and_create_backup_dir($backup_unique_code);
//Empty dir
if ($status) {
}
//Delete old_entries from backup tables
- echo "<li>".get_string("deletingolddata");
+ echo "<li>".get_string("deletingolddata").'</li>';
$status = backup_delete_old_data();
if (!$status) {
error ("An error occurred deleting old backup data");
echo "<li>".get_string("creatingxmlfile");
//Begin a new list to xml contents
echo "<ul>";
- echo "<li>".get_string("writingheader");
+ echo "<li>".get_string("writingheader").'</li>';
//Obtain the xml file (create and open) and print prolog information
$backup_file = backup_open_xml($backup_unique_code);
- echo "<li>".get_string("writinggeneralinfo");;
+ echo "<li>".get_string("writinggeneralinfo").'</li>';
//Prints general info about backup to file
if ($backup_file) {
if (!$status = backup_general_info($backup_file,$preferences)) {
//Start new ul (for course)
echo "<ul>";
- echo "<li>".get_string("courseinfo");
+ echo "<li>".get_string("courseinfo").'</li>';
//Prints course start (tag and general info)
if ($status) {
if (!$status = backup_course_start($backup_file,$preferences)) {
}
//Metacourse information
if ($status && $preferences->backup_metacourse) {
- echo "<li>".get_string("metacourse");
+ echo "<li>".get_string("metacourse").'</li>';
if (!$status = backup_course_metacourse($backup_file,$preferences)) {
notify("An error occurred while backing up metacourse info");
}
}
- echo "<li>".get_string("blocks");
+ echo "<li>".get_string("blocks").'</li>';
//Blocks information
if ($status) {
if (!$status = backup_course_blocks($backup_file,$preferences)) {
notify("An error occurred while backing up course blocks");
}
}
- echo "<li>".get_string("sections");
+ echo "<li>".get_string("sections").'</li>';
//Section info
if ($status) {
if (!$status = backup_course_sections($backup_file,$preferences)) {
}
//End course contents (close ul)
- echo "</ul>";
+ echo "</ul></li>";
//User info
if ($status && $preferences->backup_users) {
- echo "<li>".get_string("writinguserinfo");
+ echo "<li>".get_string("writinguserinfo").'</li>';
if (!$status = backup_user_info($backup_file,$preferences)) {
notify("An error occurred while backing up user info");
}
//If we have selected to backup quizzes, backup categories and
//questions structure (step 1). See notes on mod/quiz/backuplib.php
if ($status and $preferences->mods['quiz']->backup) {
- echo "<li>".get_string("writingcategoriesandquestions");
+ echo "<li>".get_string("writingcategoriesandquestions").'</li>';
if (!$status = quiz_backup_question_categories($backup_file,$preferences)) {
notify("An error occurred while backing up quiz categories");
}
//Print logs if selected
if ($status) {
if ($preferences->backup_logs) {
- echo "<li>".get_string("writingloginfo");
+ echo "<li>".get_string("writingloginfo").'</li>';
if (!$status = backup_log_info($backup_file,$preferences)) {
notify("An error occurred while backing up log info");
}
//Print scales info
if ($status) {
- echo "<li>".get_string("writingscalesinfo");
+ echo "<li>".get_string("writingscalesinfo").'</li>';
if (!$status = backup_scales_info($backup_file,$preferences)) {
notify("An error occurred while backing up scales");
}
//Print groups info
if ($status) {
- echo "<li>".get_string("writinggroupsinfo");
+ echo "<li>".get_string("writinggroupsinfo").'</li>';
if (!$status = backup_groups_info($backup_file,$preferences)) {
notify("An error occurred while backing up groups");
}
//Print events info
if ($status) {
- echo "<li>".get_string("writingeventsinfo");
+ echo "<li>".get_string("writingeventsinfo").'</li>';
if (!$status = backup_events_info($backup_file,$preferences)) {
notify("An error occurred while backing up events");
}
//Iterate over modules and call backup
foreach ($preferences->mods as $module) {
if ($module->backup and $status) {
- echo "<li>".get_string("modulenameplural",$module->name);
+ echo "<li>".get_string("modulenameplural",$module->name).'</li>';
if (!$status = backup_module($backup_file,$preferences,$module->name)) {
notify("An error occurred while backing up '$module->name'");
}
}
}
//Close ul for module list
- echo "</ul>";
+ echo "</ul></li>";
//Close modules tag
if (!$status = backup_modules_end ($backup_file,$preferences)) {
notify("An error occurred while finishing the module backups");
}
//End xml contents (close ul)
- echo "</ul>";
+ echo "</ul></li>";
}
//Now, if selected, copy user files
if ($status) {
if ($preferences->backup_user_files) {
- echo "<li>".get_string("copyinguserfiles");
+ echo "<li>".get_string("copyinguserfiles").'</li>';
if (!$status = backup_copy_user_files ($preferences)) {
notify("An error occurred while copying user files");
}
//Now, if selected, copy course files
if ($status) {
if ($preferences->backup_course_files) {
- echo "<li>".get_string("copyingcoursefiles");
+ echo "<li>".get_string("copyingcoursefiles").'</li>';
if (!$status = backup_copy_course_files ($preferences)) {
notify("An error occurred while copying course files");
}
//Now, zip all the backup directory contents
if ($status) {
- echo "<li>".get_string("zippingbackup");
+ echo "<li>".get_string("zippingbackup").'</li>';
if (!$status = backup_zip ($preferences)) {
notify("An error occurred while zipping the backup");
}
//Now, copy the zip file to course directory
if ($status) {
- echo "<li>".get_string("copyingzipfile");
+ echo "<li>".get_string("copyingzipfile").'</li>';
if (!$status = copy_zip_to_course_dir ($preferences)) {
notify("An error occurred while copying the zip file to the course directory");
}
//Now, clean temporary data (db and filesystem)
if ($status) {
- echo "<li>".get_string("cleaningtempdata");
+ echo "<li>".get_string("cleaningtempdata").'</li>';
if (!$status = clean_temp_data ($preferences)) {
notify("An error occurred while cleaning up temporary data");
}
if (empty($to)) {
//Print final message
print_simple_box(get_string("backupfinished"),"center");
- print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&wdir=/backupdata");
+ print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&wdir=/backupdata");
} else {
print_simple_box(get_string('importdataexported'),"CENTER");
if (!empty($preferences->backup_destination)) {
if (isset($$var) && $$var) {
//Print the full tr
echo "<tr>";
- echo "<td align=\"right\"><p><b>";
+ echo "<td align=\"right\"><b>";
echo get_string("include")." ". get_string("modulenameplural",$modname).":";
- echo "</td><td>";
+ echo "</b></td><td>";
$backup_options[0] = get_string("no");
$backup_options[1] = get_string("yes");
$var = "backup_".$modname;
}
}
//Line
- echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
+ echo "<tr><td colspan=\"2\"><hr /></td></tr>";
if (empty($to)) {
//Now print the Metacourse tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string ("metacourse").":";
- echo "</td><td>";
+ echo "</b></td><td>";
$meta_options[0] = get_string("no");
$meta_options[1] = get_string("yes");
choose_from_menu($meta_options, "backup_metacourse", $backup_metacourse, "");
if (empty($to)) {
//Now print the Users tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string("users").":";
- echo "</td><td>";
+ echo "</b></td><td>";
$user_options[0] = get_string("all");
$user_options[1] = get_string("course");
$user_options[2] = get_string("none");
if (empty($to)) {
//Now print the Logs tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string("logs").":";
- echo "</td><td>";
+ echo "</b></td><td>";
$log_options[0] = get_string("no");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
if (empty($to)) {
//Now print the User Files tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string ("userfiles").":";
- echo "</td><td>";
+ echo "</b></td><td>";
$user_file_options[0] = get_string("no");
$user_file_options[1] = get_string("yes");
choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
}
//Now print the Course Files tr
echo "<tr>";
- echo "<td align=\"right\"><P><B>";
+ echo "<td align=\"right\"><b>";
echo get_string ("coursefiles").":";
- echo "</td><td>";
+ echo "</b></td><td>";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
-$backup_version = 2004102900; // The current version is a date (YYYYMMDDXX)
+$backup_version = 2005020500; // The current version is a date (YYYYMMDDXX)
$backup_release = "1.5 development"; // User-friendly version number