From fb06b2557033f9893e97d3d4c82424021fc969c9 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 18 Jun 2006 10:09:58 +0000 Subject: [PATCH] Merged migration fixes from stable --- admin/utfdbmigrate.php | 9 +++------ lib/adminlib.php | 17 ++++++++--------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php index 102a9b148600a..827ef95fce094 100755 --- a/admin/utfdbmigrate.php +++ b/admin/utfdbmigrate.php @@ -298,10 +298,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here $crash->field = $crashdata[1]; $crash->record = $crashdata[2]; - print_heading('Resume information :'); - echo '
Resuming from @ table : '.$crash->table; - echo '
Resuming from @ field : '.$crash->field; - echo '
Resuming from @ record : '.$crash->record; + notify("Resuming migration from: $crash->table / .$crash->field, Record: $crash->record"); } /************************************************************************ @@ -499,7 +496,6 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here continue; } else { $crash = 0; - print_heading('recovering from '.$dbtablename.'--'.$fieldname.'--'.$record->id); } } @@ -576,7 +572,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here $processedrecords++; //print some output once in a while if (($processedrecords) % 5000 == 0) { - echo 'Processing...'.$dbtablename.'...'.$fieldname.'...'.$record->id; + print_progress($done, $tablestoconvert, 5, 1, + 'Processing: '.$dbtablename.'/'.$fieldname.' '); } } }else { diff --git a/lib/adminlib.php b/lib/adminlib.php index cd6b27b6d0707..e3c7bcbd4fbde 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -310,8 +310,7 @@ function set_cron_lock($name,$value=true,$staleafter=7200,$clobberstale=false) { return true; } -function print_progress($done, $total, $updatetime=5, $sleeptime=1) { - static $count; +function print_progress($done, $total, $updatetime=5, $sleeptime=1, $donetext='') { static $starttime; static $lasttime; @@ -327,12 +326,6 @@ function print_progress($done, $total, $updatetime=5, $sleeptime=1) { echo ''; } - if (!isset($count)) { - $count = 0; - } - - $count++; - $now = time(); if ($done && (($now - $lasttime) >= $updatetime)) { @@ -341,8 +334,14 @@ function print_progress($done, $total, $updatetime=5, $sleeptime=1) { $percentage = format_float((float)$done / (float)$total, 2); $width = (int)(500 * $percentage); + if ($projectedtime > 10) { + $projectedtext = ' Ending: '.format_time($projectedtime); + } else { + $projectedtext = ''; + } + echo '';