Abstracted a bit of the restore procedure to allow for silent restoring.

Added new function, import_backup_file_silently
Changed everything that prints stuff to check for a constant first.
Backup_flush checks a different constant, this is so that output can still
get flushed to the browser when necessary but not print <li>s everywhere.
Please test this!
This commit is contained in:
mjollnir_
2006-01-15 21:09:13 +00:00
parent f16021da64
commit f90666aa5c
22 changed files with 1582 additions and 829 deletions
+24 -12
View File
@@ -79,7 +79,9 @@
$newid = insert_record ("assignment",$assignment);
//Do some output
echo "<li>".get_string("modulename","assignment")." \"".format_string(stripslashes($assignment->name),true)."\"</li>";
if (!defined('RESTORE_SILENTLY')) {
echo "<li>".get_string("modulename","assignment")." \"".format_string(stripslashes($assignment->name),true)."\"</li>";
}
backup_flush(300);
if ($newid) {
@@ -154,9 +156,11 @@
//Do some output
if (($i+1) % 50 == 0) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br />";
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
@@ -319,14 +323,18 @@
$assignment->description = addslashes($result);
$status = update_record("assignment",$assignment);
if ($CFG->debug>7) {
echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.htmlentities($content).'<br />changed to<br />'.htmlentities($result).'<hr /><br />';
}
}
}
//Do some output
if (($i+1) % 5 == 0) {
echo ".";
if (($i+1) % 100 == 0) {
echo "<br />";
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 100 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
@@ -363,9 +371,11 @@
//Do some output
$i++;
if (($i+1) % 1 == 0) {
echo ".";
if (($i+1) % 20 == 0) {
echo "<br />";
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 20 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
@@ -455,7 +465,9 @@
}
break;
default:
echo "action (".$log->module."-".$log->action.") unknow. Not restored<br />"; //Debug
if (!defined('RESTORE_SILENTLY')) {
echo "action (".$log->module."-".$log->action.") unknow. Not restored<br />"; //Debug
}
break;
}