diff --git a/backup/lib.php b/backup/lib.php index af002b420f2..860fe4516d4 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -497,17 +497,25 @@ //This function is used to check that every necessary function to //backup/restore exists in the current php installation. Thanks to //gregb@crowncollege.edu by the idea. - function backup_required_functions() { + function backup_required_functions($justcheck=false) { if(!function_exists('utf8_encode')) { - error('You need to add XML support to your PHP installation'); + if (empty($justcheck)) { + error('You need to add XML support to your PHP installation'); + } else { + return false; + } } + return true; } //This function send n white characters to the browser and flush the //output buffer. Used to avoid browser timeouts and to show the progress. function backup_flush($n=0,$time=false) { + if (defined('RESTORE_SILENTLY_NOFLUSH')) { + return; + } if ($time) { $ti = strftime("%X",time()); } else { @@ -543,4 +551,108 @@ return ($status && $status2); } + + /** this function will restore an entire backup.zip into the specified course + * using standard moodle backup/restore functions, but silently. + * @param string $pathtofile the absolute path to the backup file. + * @param int $destinationcourse the course id to restore to. + * @param boolean $emptyfirst whether to delete all coursedata first. + * @param boolean $userdata whether to include any userdata that may be in the backup file. + */ + function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false) { + global $CFG,$SESSION,$USER; // is there such a thing on cron? I guess so.. + + if (empty($USER)) { + $USER = get_admin(); + $USER->admin = 1; // not sure why, but this doesn't get set + } + + define('RESTORE_SILENTLY',true); // don't output all the stuff to us. + + $debuginfo = 'import_backup_file_silently: '; + $cleanupafter = false; + $errorstr = ''; // passed by reference to restore_precheck to get errors from. + + if (!$course = get_record('course','id',$destinationcourse)) { + mtrace($debuginfo.'Course with id $destinationcourse was not a valid course!'); + return false; + } + + // first check we have a valid file. + if (!file_exists($pathtofile) || !is_readable($pathtofile)) { + mtrace($debuginfo.'File '.$pathtofile.' either didn\'t exist or wasn\'t readable'); + return false; + } + + // now make sure it's a zip file + require_once($CFG->dirroot.'/lib/filelib.php'); + $filename = substr($pathtofile,strrpos($pathtofile,'/')+1); + $mimetype = mimeinfo("type", $filename); + if ($mimetype != 'application/zip') { + mtrace($debuginfo.'File '.$pathtofile.' was of wrong mimetype ('.$mimetype.')' ); + return false; + } + + // restore_precheck wants this within dataroot, so lets put it there if it's not already.. + if (strstr($pathtofile,$CFG->dataroot) === false) { + // first try and actually move it.. + if (!check_dir_exists($CFG->dataroot.'/temp/backup/',true)) { + mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! '); + return false; + } + if (!copy($pathtofile,$CFG->dataroot.'/temp/backup/'.$filename)) { + mtrace($debuginfo.'File '.$pathtofile.' outside of dataroot and couldn\'t move it! '); + return false; + } else { + $pathtofile = 'temp/backup/'.$filename; + $cleanupafter = true; + } + } else { + // it is within dataroot, so take it off the path for restore_precheck. + $pathtofile = substr($pathtofile,strlen($CFG->dataroot.'/')); + } + + if (!backup_required_functions()) { + mtrace($debuginfo.'Required function check failed (see backup_required_functions)'); + return false; + } + + @ini_set("max_execution_time","3000"); + raise_memory_limit("128M"); + + if (!$backup_unique_code = restore_precheck($destinationcourse,$pathtofile,$errorstr,true)) { + mtrace($debuginfo.'Failed restore_precheck (error was '.$errorstr.')'); + return false; + } + + restore_setup_for_check($SESSION->restore,$backup_unique_code); + + // add on some extra stuff we need... + $SESSION->restore->restoreto = 1; + $SESSION->restore->course_id = $destinationcourse; + $SESSION->restore->deleting = $emptyfirst; + + // maybe we need users (defaults to 2 in restore_setup_for_check) + if (!empty($userdata)) { + $SESSION->restore->users = 1; + } + + // we also need modules... + if ($allmods = get_records("modules")) { + foreach ($allmods as $mod) { + $modname = $mod->name; + //Now check that we have that module info in the backup file + if (isset($SESSION->info->mods[$modname]) && $SESSION->info->mods[$modname]->backup == "true") { + $SESSION->restore->mods[$modname]->restore = true; + $SESSION->restore->mods[$modname]->userinfo = $userdata; + } + } + } + if (!restore_execute($SESSION->restore,$SESSION->info,$SESSION->course_header,$errorstr)) { + mtrace($debuginfo.'Failed restore_execute (error was '.$errorstr.')'); + return false; + } + return true; + } + ?> diff --git a/backup/restore_execute.html b/backup/restore_execute.html index 2faeb97b675..d5893fc28fe 100644 --- a/backup/restore_execute.html +++ b/backup/restore_execute.html @@ -41,350 +41,8 @@ if (!$site = get_site()) { error("Site not found!"); } - - //Checks for the required files/functions to restore every module - //and include them - if ($allmods = get_records("modules") ) { - foreach ($allmods as $mod) { - $modname = $mod->name; - $modfile = "$CFG->dirroot/mod/$modname/restorelib.php"; - //If file exists and we have selected to restore that type of module - if ((file_exists($modfile)) and ($restore->mods[$modname]->restore)) { - include_once($modfile); - } - } - } - - //Start the main table - echo "
";
-
- //Start the main ul
- echo "
|
";
@@ -4488,19 +4567,29 @@
//Check the file exists
if (!is_file($file)) {
- error ("File not exists ($file)");
+ if (!defined('RESTORE_SILENTLY')) {
+ error ("File not exists ($file)");
+ } else {
+ $errorstr = "File not exists ($file)";
+ return false;
+ }
}
//Check the file name ends with .zip
if (!substr($file,-4) == ".zip") {
- error ("File has an incorrect extension");
+ if (!defined('RESTORE_SILENTLY')) {
+ error ("File has an incorrect extension");
+ } else {
+ $errorstr = 'File has an incorrect extension';
+ return false;
+ }
}
//Now calculate the unique_code for this restore
$backup_unique_code = time();
//Now check and create the backup dir (if it doesn't exist)
- if (empty($silent)) {
+ if (!defined('RESTORE_SILENTLY')) {
echo "
"; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -319,14 +323,18 @@ $assignment->description = addslashes($result); $status = update_record("assignment",$assignment); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -363,9 +371,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -455,7 +465,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/chat/restorelib.php b/mod/chat/restorelib.php index 6a5c89e4489..537463788fc 100644 --- a/mod/chat/restorelib.php +++ b/mod/chat/restorelib.php @@ -52,7 +52,9 @@ $newid = insert_record ("chat",$chat); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -217,17 +221,21 @@ $chat->intro = addslashes($result); $status = update_record("chat",$chat); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -302,7 +310,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/choice/restorelib.php b/mod/choice/restorelib.php index 4fe031576c6..e0d4bc9d5f5 100644 --- a/mod/choice/restorelib.php +++ b/mod/choice/restorelib.php @@ -125,7 +125,9 @@ } //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -232,9 +236,11 @@ function choice_options_restore_mods($choiceid,$info,$restore) { //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -338,17 +344,21 @@ function choice_options_restore_mods($choiceid,$info,$restore) { $choice->text = addslashes($result); $status = update_record("choice",$choice); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -383,9 +393,11 @@ function choice_options_restore_mods($choiceid,$info,$restore) { //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -474,7 +486,9 @@ function choice_options_restore_mods($choiceid,$info,$restore) { } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/exercise/restorelib.php b/mod/exercise/restorelib.php index d5393878ed1..f5169415ff1 100644 --- a/mod/exercise/restorelib.php +++ b/mod/exercise/restorelib.php @@ -75,7 +75,9 @@ $newid = insert_record ("exercise",$exercise); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -174,9 +178,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -233,9 +239,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -305,9 +313,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -360,9 +370,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index e185ab7a000..e049bf10568 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -92,7 +92,9 @@ } //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -232,9 +236,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -337,9 +343,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -401,9 +409,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -548,9 +558,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -599,9 +611,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -817,7 +831,9 @@ $status = true; break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } @@ -1021,14 +1037,18 @@ $post->message = addslashes($result); $status = update_record("forum_posts",$post); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -1051,14 +1071,18 @@ $forum->intro = addslashes($result); $status = update_record("forum",$forum); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } diff --git a/mod/glossary/restorelib.php b/mod/glossary/restorelib.php index ed9ce19836e..5ebc12e1c55 100644 --- a/mod/glossary/restorelib.php +++ b/mod/glossary/restorelib.php @@ -113,7 +113,9 @@ $newid = insert_record ("glossary",$glossary); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -255,9 +259,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -306,9 +312,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -344,9 +352,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -388,9 +398,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -440,9 +452,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -599,14 +613,18 @@ $entry->definition = addslashes($result); $status = update_record("glossary_entries",$entry); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -629,17 +647,21 @@ $glossary->intro = addslashes($result); $status = update_record("glossary",$glossary); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -678,9 +700,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -710,9 +734,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -902,7 +928,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/hotpot/restorelib.php b/mod/hotpot/restorelib.php index 843ff279c73..35774581a04 100644 --- a/mod/hotpot/restorelib.php +++ b/mod/hotpot/restorelib.php @@ -71,7 +71,9 @@ function hotpot_restore_mods($mod, $restore) { $foreign_keys = array('course' => $restore->course_id); $more_restore = ''; // print a message after each hotpot is backed up - $more_restore .= 'print "
action (".$log->module."-".$log->action.") unknown. Not restored "; + if (!defined('RESTORE_SILENTLY')) { + print "action (".$log->module."-".$log->action.") unknown. Not restored "; + } break; } // end switch return $status ? $log : false; diff --git a/mod/journal/restorelib.php b/mod/journal/restorelib.php index 844b9148781..e7684241071 100644 --- a/mod/journal/restorelib.php +++ b/mod/journal/restorelib.php @@ -59,7 +59,9 @@ $newid = insert_record ("journal",$journal); //Do some output - echo ""; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -181,9 +185,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -211,9 +217,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -309,7 +317,9 @@ $status = true; break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/label/restorelib.php b/mod/label/restorelib.php index b8aae4ea9fa..1bd7f57dba9 100644 --- a/mod/label/restorelib.php +++ b/mod/label/restorelib.php @@ -43,7 +43,9 @@ $newid = insert_record ("label",$label); //Do some output - echo " '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -127,7 +133,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/lesson/restorelib.php b/mod/lesson/restorelib.php index 1efc9d028c8..53f59937325 100644 --- a/mod/lesson/restorelib.php +++ b/mod/lesson/restorelib.php @@ -90,7 +90,9 @@ $newid = insert_record("lesson", $lesson); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -300,9 +304,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -366,9 +372,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -417,9 +425,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -474,9 +484,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -522,9 +534,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -575,9 +589,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -642,9 +658,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -748,14 +766,18 @@ $page->contents = addslashes($result); $status = update_record("lesson_pages",$page); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -833,7 +855,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/quiz/question.php b/mod/quiz/question.php index 686332921dd..b51c7245b63 100644 --- a/mod/quiz/question.php +++ b/mod/quiz/question.php @@ -339,7 +339,7 @@ echo ' '; print_simple_box_start('center'); - require('questiontypes/'.$QUIZ_QTYPES[$qtype]->name().'/editquestion.php'); + require_once('questiontypes/'.$QUIZ_QTYPES[$qtype]->name().'/editquestion.php'); print_simple_box_end(); if ($usehtmleditor) { diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index 95683c87e97..c20dee0edcc 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -146,10 +146,14 @@ //Do some output if ($newid) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo " "; + } } else { //We must never arrive here !! - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo " "; + } $status = false; } backup_flush(300); @@ -164,7 +168,9 @@ } else { $status = false; } - echo ' "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 40 == 0) { + echo " "; + } } backup_flush(300); } @@ -356,9 +364,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -416,9 +426,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -483,9 +495,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -536,9 +550,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -600,9 +616,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -648,9 +666,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -724,9 +744,11 @@ "answertext",$match_sub->answertext); //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -779,9 +801,11 @@ "positionkey",$multianswer->positionkey); //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -824,9 +848,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -871,9 +897,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -924,9 +952,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -1001,9 +1031,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -1056,9 +1088,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -1324,7 +1358,9 @@ $newid = insert_record ("quiz",$quiz); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1461,9 +1499,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1534,9 +1574,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1772,9 +1814,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1919,9 +1963,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -2025,17 +2071,21 @@ $quiz->intro = addslashes($result); $status = update_record("quiz",$quiz); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -2069,9 +2119,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -2199,7 +2251,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/quiz/restorelibpre15.php b/mod/quiz/restorelibpre15.php index 3f705772220..53ee83303d6 100644 --- a/mod/quiz/restorelibpre15.php +++ b/mod/quiz/restorelibpre15.php @@ -132,10 +132,14 @@ //Do some output if ($newid) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo " "; + } } else { - //We must never arrive here !! - echo " "; + if (!defined('RESTORE_SILENTLY')) { + //We must never arrive here !! + echo " "; + } $status = false; } backup_flush(300); @@ -150,7 +154,9 @@ } else { $status = false; } - echo ' "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 40 == 0) { + echo " "; + } } backup_flush(300); } @@ -350,9 +358,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -411,9 +421,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -481,9 +493,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -534,9 +548,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -601,9 +617,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -649,9 +667,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -725,9 +745,11 @@ "answertext",$match_sub->answertext); //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -770,9 +792,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -828,9 +852,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -888,9 +914,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -983,9 +1011,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -1262,7 +1292,9 @@ $newid = insert_record ("quiz",$quiz); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1399,9 +1433,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1470,9 +1506,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1718,9 +1756,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1775,9 +1815,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -1821,9 +1863,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -1951,7 +1995,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/resource/restorelib.php b/mod/resource/restorelib.php index 6b832226364..e5505ec42d9 100644 --- a/mod/resource/restorelib.php +++ b/mod/resource/restorelib.php @@ -82,7 +82,9 @@ $newid = insert_record ("resource",$resource); //Do some output - echo " '.htmlentities($content1).' changed to '.htmlentities($result1).' '; - echo ' '.htmlentities($content2).' changed to '.htmlentities($result2).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content1).' changed to '.htmlentities($result1).' '; + echo ' '.htmlentities($content2).' changed to '.htmlentities($result2).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -241,9 +247,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -300,7 +308,9 @@ $status = true; break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/scorm/restorelib.php b/mod/scorm/restorelib.php index 534da7cae0b..748d6485697 100755 --- a/mod/scorm/restorelib.php +++ b/mod/scorm/restorelib.php @@ -113,7 +113,9 @@ //The structure is equal to the db, so insert the scorm $newid = insert_record ("scorm",$scorm); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -327,9 +331,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -477,14 +483,18 @@ $scorm->summary = addslashes($result); $status = update_record("scorm",$scorm); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } diff --git a/mod/survey/restorelib.php b/mod/survey/restorelib.php index 5b9c643b9dd..b243fc334ea 100644 --- a/mod/survey/restorelib.php +++ b/mod/survey/restorelib.php @@ -53,7 +53,9 @@ $newid = insert_record ("survey",$survey); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -175,9 +179,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -281,17 +287,21 @@ $survey->intro = addslashes($result); $status = update_record("survey",$survey); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -390,7 +400,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } diff --git a/mod/wiki/restorelib.php b/mod/wiki/restorelib.php index 13c60c4a6e0..39352fdfa7a 100644 --- a/mod/wiki/restorelib.php +++ b/mod/wiki/restorelib.php @@ -59,7 +59,9 @@ $newid = insert_record ("wiki",$wiki); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -192,9 +196,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -350,14 +356,18 @@ $page->content = addslashes($result); $status = update_record("wiki_pages",$page); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); } @@ -380,17 +390,21 @@ $wiki->summary = addslashes($result); $status = update_record("wiki",$wiki); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } diff --git a/mod/workshop/restorelib.php b/mod/workshop/restorelib.php index ae098198547..4c32bcbf54e 100644 --- a/mod/workshop/restorelib.php +++ b/mod/workshop/restorelib.php @@ -138,9 +138,11 @@ $newid = insert_record ("workshop",$workshop); //Do some output - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -244,9 +248,11 @@ //Do some output if (($i+1) % 10 == 0) { - echo "."; - if (($i+1) % 200 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 200 == 0) { + echo " "; + } } backup_flush(300); } @@ -288,9 +294,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -348,9 +356,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -422,9 +432,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -491,9 +503,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -537,9 +551,11 @@ //Do some output if (($i+1) % 50 == 0) { - echo "."; - if (($i+1) % 1000 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 1000 == 0) { + echo " "; + } } backup_flush(300); } @@ -633,9 +649,11 @@ //Do some output $i++; if (($i+1) % 1 == 0) { - echo "."; - if (($i+1) % 20 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 20 == 0) { + echo " "; + } } backup_flush(300); } @@ -733,17 +751,21 @@ $workshop->description = addslashes($result); $status = update_record("workshop",$workshop); if ($CFG->debug>7) { - echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + if (!defined('RESTORE_SILENTLY')) { + echo ' '.htmlentities($content).' changed to '.htmlentities($result).' '; + } } } //Do some output if (($i+1) % 5 == 0) { - echo "."; - if (($i+1) % 100 == 0) { - echo " "; + if (!defined('RESTORE_SILENTLY')) { + echo "."; + if (($i+1) % 100 == 0) { + echo " "; + } } backup_flush(300); - } + } } } @@ -928,7 +950,9 @@ } break; default: - echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + if (!defined('RESTORE_SILENTLY')) { + echo "action (".$log->module."-".$log->action.") unknow. Not restored "; //Debug + } break; } |