if (is_file($sqlScript)) { logThis('found schema upgrade script: ' . $sqlScript); logThis('schema preflight using MySQL'); if (function_exists('sugar_fopen')) { $fp = sugar_fopen($sqlScript, 'r'); } else { $fp = fopen($sqlScript, 'r'); } $contents = stream_get_contents($fp); $anyScriptChanges = $contents; // remove __uw_temp tables //testCleanUp($db->dbType); fclose($fp); $customTables = getCustomTables($db->dbType); if (!empty($customTables)) { $_SESSION['alterCustomTableQueries'] = alterCustomTables($db->dbType, $customTables); } else { $_SESSION['alterCustomTableQueries'] = false; } $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 (!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>"; } $out .= "</div><hr />";
$sqlScript = $_SESSION['unzip_dir'] . '/scripts/' . $sqlFile . '.sql'; logThis('looking for schema script at: ' . $sqlScript); if (is_file($sqlScript)) { logThis('found schema upgrade script: ' . $sqlScript); logThis('schema preflight using MySQL'); if (function_exists('sugar_fopen')) { $fp = sugar_fopen($sqlScript, 'r'); } else { $fp = fopen($sqlScript, 'r'); } $contents = stream_get_contents($fp); $anyScriptChanges = $contents; fclose($fp); $customTables = getCustomTables(); if (!empty($customTables)) { $_SESSION['alterCustomTableQueries'] = alterCustomTables($customTables); } else { $_SESSION['alterCustomTableQueries'] = false; } $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 (!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>"; } $out .= "</div><hr />";