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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user