Example #1
0
function preflightCheckJsonAlterTableCharset()
{
    global $mod_strings;
    global $sugar_db_version;
    global $persistence;
    if (empty($sugar_db_version)) {
        include 'sugar_version.php';
    }
    $current_version = substr(preg_replace("#[^0-9]#", "", $sugar_db_version), 0, 3);
    if (version_compare($current_version, '450', "<")) {
        if (isset($persistence['allTables']) && !empty($persistence['allTables'])) {
            $alterTableContents = printAlterTableSql($persistence['allTables']);
            $alterTableSchema = "<p><a href='javascript:void(0); toggleNwFiles(\"alterTableSchemashow\");'>{$mod_strings['LBL_UW_CHARSET_SCHEMA_CHANGE']}</a>";
            $alterTableSchema .= "<div id='alterTableSchemashow' style='display:none;'>";
            $alterTableSchema .= "<textarea readonly cols='80' rows='10'>{$alterTableContents}</textarea>";
            $alterTableSchema .= "</div></p>";
        }
    } else {
        $alterTableSchema = '<i>' . $mod_strings['LBL_UW_PREFLIGHT_NOT_NEEDED'] . '</i>';
    }
    ob_start();
    echo $alterTableSchema;
    ob_flush();
}
 //testCleanUp($db->dbType);
 fclose($fp);
 $customTables = getCustomTables($db->dbType);
 if (!empty($customTables)) {
     $_SESSION['alterCustomTableQueries'] = alterCustomTables($db->dbType, $customTables);
 } else {
     $_SESSION['alterCustomTableQueries'] = false;
 }
 $_SESSION['allTables'] = getAllTables($db->dbType);
 $schema = "<p><a href='javascript:void(0); toggleNwFiles(\"schemashow\");'>{$mod_strings['LBL_UW_SHOW_SCHEMA']}</a>";
 $schema .= "<div id='schemashow' style='display:none;'>";
 $schema .= "<textarea readonly cols='80' rows='10'>{$contents}</textarea>";
 $schema .= "</div></p>";
 if (version_compare($current_version, '450', "<")) {
     if (isset($_SESSION['allTables']) && !empty($_SESSION['allTables'])) {
         $alterTableContents = printAlterTableSql($_SESSION['allTables']);
         $alterTableSchema = "<p><a href='javascript:void(0); toggleNwFiles(\"alterTableSchemashow\");'>{$mod_strings['LBL_UW_CHARSET_SCHEMA_CHANGE']}</a>";
         $alterTableSchema .= "<div id='alterTableSchemashow' style='display:none;'>";
         $alterTableSchema .= "<textarea readonly cols='80' rows='10'>{$alterTableContents}</textarea>";
         $alterTableSchema .= "</div></p>";
     }
 } else {
     $alterTableSchema = '<i>' . $mod_strings['LBL_UW_PREFLIGHT_NOT_NEEDED'] . '</i>';
 }
 if (!empty($sqlErrors)) {
     $stop = true;
     $out = "<b class='error'>{$mod_strings['ERR_UW_PREFLIGHT_ERRORS']}:</b> ";
     $out .= "<a href='javascript:void(0);toggleNwFiles(\"sqlErrors\");'>{$mod_strings['LBL_UW_SHOW_SQL_ERRORS']}</a><div id='sqlErrors' style='display:none'>";
     foreach ($sqlErrors as $sqlError) {
         $out .= "<br><span class='error'>{$sqlError}</span>";
     }