From: toyomoyo Date: Wed, 7 Jun 2006 04:32:05 +0000 (+0000) Subject: merged, small changes to javascript progress bar 1) updates correctly when resuming... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9073d2ddadacd265de94e8c4ec3218c9be702032;p=moodle.git merged, small changes to javascript progress bar 1) updates correctly when resuming 2) number of tables not hard coded anymore --- diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php index cfb92581e6..548ff5af43 100755 --- a/admin/utfdbmigrate.php +++ b/admin/utfdbmigrate.php @@ -193,8 +193,22 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here $ignoretables = array(); //list of tables to ignore, optional + //one gigantic array to hold all db table information read from all the migrate2utf8.xml file. + require_once($CFG->dirroot.'/lib/xmlize.php'); + $xmls = utf_get_xml(1); + $tablestoconvert = 0; // total number of tables to convert + foreach ($xmls as $xml) { ///foreach xml file, we must get a list of tables + $dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE']; //real db tables + foreach ($dbtables as $dbtable) { + $tablestoconvert++; + } + } + // progress bar handling + // first let's find out how many tables there are + $done = 0; - print_progress($done, 158, 5, 1); + print_progress($done, $tablestoconvert, 5, 1); + $textlib = textlib_get_instance(); //only 1 reference @@ -288,11 +302,6 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here echo '
Resuming from @ record : '.$crash->record; } - require_once($CFG->dirroot.'/lib/xmlize.php'); - - //one gigantic array to hold all db table information read from all the migrate2utf8.xml file. - $xmls = utf_get_xml(1); - /************************************************************************ * Now we got all our tables in order * ************************************************************************/ @@ -304,7 +313,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here foreach ($dbtables as $dbtable) { $done++; - print_progress($done, 158, 5, 1); + print_progress($done, $tablestoconvert, 5, 1); $dbtablename = $dbtable['@']['name']; @@ -317,6 +326,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here } if ($crash && ($dbtablename != $crash->table)) { //resuming from crash + $done++; // need to update progress bar continue; } @@ -750,8 +760,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here } //finish the javascript bar - $done=159; - print_progress($done, 158, 5, 1); + $done = $tablestoconvert; + print_progress($done, $tablestoconvert, 5, 1); //prints the list of langs used in this site print_simple_box_start('center','50%');