'; echo ''; echo '
'; echo '
'; } if ($_POST['DoUpgrade'] == _('Perform Upgrade')){ echo '
'; prnMsg(_('If there are any failures then please check with your system administrator'). '. '._('Please read all notes carefully to ensure they are expected'),'info'); $SQLScriptFile = file('./sql/mysql/upgrade3.11.1-4.00.sql'); $ScriptFileEntries = sizeof($SQLScriptFile); $ErrMsg = _('The script to upgrade the database failed because'); $sql =''; $InAFunction = false; echo '
'; for ($i=0; $i<=$ScriptFileEntries; $i++) { $SQLScriptFile[$i] = trim($SQLScriptFile[$i]); if (mb_substr($SQLScriptFile[$i], 0, 2) == '--') { $comment=mb_substr($SQLScriptFile[$i], 2); } if (mb_substr($SQLScriptFile[$i], 0, 2) != '--' AND mb_substr($SQLScriptFile[$i], 0, 3) != 'USE' AND mb_strstr($SQLScriptFile[$i],'/*')==FALSE AND mb_strlen($SQLScriptFile[$i])>1){ $sql .= ' ' . $SQLScriptFile[$i]; //check if this line kicks off a function definition - pg chokes otherwise if (mb_substr($SQLScriptFile[$i],0,15) == 'CREATE FUNCTION'){ $InAFunction = true; } //check if this line completes a function definition - pg chokes otherwise if (mb_substr($SQLScriptFile[$i],0,8) == 'LANGUAGE'){ $InAFunction = false; } if (mb_strpos($SQLScriptFile[$i],';')>0 AND ! $InAFunction){ $sql = mb_substr($sql,0,mb_strlen($sql)-1); $result = DB_query($sql, $ErrMsg, $DBMsg, false, false); switch (DB_error_no()) { case 0: echo ''; break; case 1050: echo ''; break; case 1060: echo ''; break; case 1061: echo ''; break; case 1062: echo ''; break; case 1068: echo ''; break; default: echo ''; break; } unset($sql); } } //end if its a valid sql line not a comment } //end of for loop around the lines of the sql script echo '
' . $comment . '' . _('Success') . '
' . $comment . '' . _('Note').' - '. _('Table has already been created') . '
' . $comment . '' . _('Note').' - '. _('Column has already been created') . '
' . $comment . '' . _('Note').' - '. _('Index already exists') . '
' . $comment . '' . _('Note').' - '. _('Entry has already been done') . '
' . $comment . '' . _('Note').' - '. _('Primary key already exists') . '
' . $comment . '' . _('Failure').' - '. _('Error number').' - '.DB_error_no() . '
'; /*Now run the data conversions required. */ } /*Dont do upgrade */ include('includes/footer.php'); ?>