]> git.mjollnir.org Git - moodle.git/commitdiff
Merged migration fixes from stable
authormoodler <moodler>
Sun, 18 Jun 2006 10:09:58 +0000 (10:09 +0000)
committermoodler <moodler>
Sun, 18 Jun 2006 10:09:58 +0000 (10:09 +0000)
admin/utfdbmigrate.php
lib/adminlib.php

index 102a9b148600a493248a10edae46b311cd11447a..827ef95fce09492939303bed99c6775d77bb1849 100755 (executable)
@@ -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 '<br>Resuming from @ table : '.$crash->table;
-        echo '<br>Resuming from @ field : '.$crash->field;
-        echo '<br>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 {
index cd6b27b6d07073d71f8d902b4e233c7524401ec5..e3c7bcbd4fbde657c2d800abb0081b86f1a39609 100644 (file)
@@ -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 '</div>';
     }
 
-    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 '<script>';
-        echo 'document.getElementById("text").innerHTML = "'.$count.' done.  Ending: '.format_time($projectedtime).'";'."\n";
+        echo 'document.getElementById("text").innerHTML = "'.addslashes($donetext).' '.$done.' done.'.$projectedtext.'";'."\n";
         echo 'document.getElementById("slider").style.width = \''.$width.'px\';'."\n";
         echo '</script>';