grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026=0) { $stop = true; // flag to show "next" if (isset($_SESSION['files'])) { unset($_SESSION['files']); } $errors = preflightCheck(); if (check_php_version() === -1) { $phpVersion = "{$mod_strings['ERR_CHECKSYS_PHP_INVALID_VER']} ".constant('PHP_VERSION')." "; $error_txt = ''.$phpVersion.''; if (count($errors) == 0) { $errors[] = ''; } $errors[] = $error_txt; logThis($error_txt); } $diffs = ''; $schema = ''; $anyScriptChanges = ''; $db = DBManagerFactory::getInstance(); //Quickcreatedefs on the basis of editviewdefs updateQuickCreateDefs(); upgradeSugarCache($_SESSION['install_file']); if ((count($errors) == 1)) { // only diffs logThis('file preflight check passed successfully.'); $stop = false; $out = $mod_strings['LBL_UW_PREFLIGHT_TESTS_PASSED']."

".$mod_strings['LBL_UW_PREFLIGHT_TESTS_PASSED3'].""; $stop = false; $disableEmail = (empty($current_user->email1)) ? 'DISABLED' : 'CHECKED'; if (count($errors['manual']) > 0) { $preserveFiles = array(); $diffs =<< function preflightToggleAll(cb) { var checkAll = false; var form = document.getElementById('diffs'); if(cb.checked == true) { checkAll = true; } for(i=0; i
{$mod_strings['LBL_UW_PREFLIGHT_ADD_TASK']}
{$mod_strings['LBL_UW_PREFLIGHT_EMAIL_REMINDER']}

{$mod_strings['LBL_UW_SHOW_DIFFS']}

"; $diffs .= "
"; // list preserved files (templates, etc.) $preserve = ''; foreach ($preserveFiles as $pf) { if (empty($preserve)) { $preserve .= ""; } $preserve .= ""; } if (!empty($preserve)) { $preserve .= '
"; $preserve .= $mod_strings['LBL_UW_PREFLIGHT_PRESERVE_FILES']; $preserve .= "
".str_replace(getcwd(), '.', $pf)."

'; } $diffs = $preserve.$diffs; } else { // NO FILE DIFFS REQUIRED $diffs = $mod_strings['LBL_UW_PREFLIGHT_NO_DIFFS']; } } else { logThis('*** ERROR: found too many preflight errors - displaying errors and stopping execution.'); $out = "{$mod_strings['ERR_UW_PREFLIGHT_ERRORS']}:
"; $out .= ""; foreach ($errors as $error) { if (is_array($error)) { // manual diff files continue; } else { $out .= "{$error}
"; } } $out .= "

"; } $diffs =''; /////////////////////////////////////////////////////////////////////////////// //// SCHEMA SCRIPT HANDLING logThis('starting schema preflight check...'); //Check the current and target versions and store them in session variables if (empty($sugar_db_version)) { include('sugar_version.php'); } if (!isset($manifest['version']) || empty($manifest['version'])) { include($_SESSION['unzip_dir'].'/manifest.php'); } $origVersion = implodeVersion($sugar_db_version, 3, '0'); $destVersion = implodeVersion($manifest['version'], 3, '0'); //save the versions as session variables $_SESSION['current_db_version'] = $sugar_db_version; $_SESSION['target_db_version'] = $manifest['version']; $_SESSION['upgrade_from_flavor'] = $manifest['name']; // aw: BUG 10161: check flavor conversion sql files $sqlFile = ''; // cn: bug if (version_compare($sugar_db_version, $manifest['version'], '=')) { $type = $db->getScriptName(); switch ($manifest['name']) { case 'SugarCE to SugarPro': $sqlFile = $origVersion . '_ce_to_pro_' . $type; break; case 'SugarCE to SugarEnt': $sqlFile = $origVersion . '_ce_to_ent_' . $type; break; case 'SugarCE to SugarCorp': $sqlFile = $origVersion . '_ce_to_corp_' . $db->dbType; break; case 'SugarCE to SugarUlt': $sqlFile = $origVersion . '_ce_to_ult_' . $db->dbType; break; case 'SugarPro to SugarEnt': $sqlFile = $origVersion . '_pro_to_ent_' . $type; break; default: break; } } else { $type = $db->dbType; if ($type == 'oci8') { $type = 'oracle'; } $sqlFile = $origVersion . '_to_' . $destVersion . '_' . $type; } $newTables = array(); $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 = "

{$mod_strings['LBL_UW_SHOW_SCHEMA']}"; $schema .= "

"; if (!empty($sqlErrors)) { $stop = true; $out = "{$mod_strings['ERR_UW_PREFLIGHT_ERRORS']}: "; $out .= "{$mod_strings['LBL_UW_SHOW_SQL_ERRORS']}
"; } } else { $customTableSchema = ''; logThis('no schema script found - all schema preflight skipped'); } logThis('schema preflight done.'); //// END SCHEMA SCRIPT HANDLING /////////////////////////////////////////////////////////////////////////////// //php version suggestion $php_suggested_ver = ''; if (check_php_version() === 0) { $php_suggested_ver=$mod_strings['LBL_CURRENT_PHP_VERSION'].phpversion().". ".$mod_strings['LBL_RECOMMENDED_PHP_VERSION_1'].constant('SUITECRM_PHP_REC_VERSION').$mod_strings['LBL_RECOMMENDED_PHP_VERSION_2']; } if (empty($mod_strings['LBL_UPGRADE_TAKES_TIME_HAVE_PATIENCE'])) { $mod_strings['LBL_UPGRADE_TAKES_TIME_HAVE_PATIENCE'] = 'Upgrade may take some time'; } $style_for_out = empty($out)?'style=\'display:none\'':''; $style_for_dif = empty($diffs)?'style=\'display:none\'':''; $style_for_schemaChange = empty($schema)?'style=\'display:none\'':''; $final =<<
{$out} {$mod_strings['LBL_UW_MANUAL_MERGE']} {$diffs}   {$mod_strings['LBL_UW_SCHEMA_CHANGE']} {$schema}
{$mod_strings['LBL_UW_DB_METHOD']}
eoq; $form5 =<< eoq5; $uwMain = $final.$form5; //set the upgrade progress status. set_upgrade_progress('preflight', 'done'); } else { $stop = true; if (empty($mod_strings['LBL_INCOMPATIBLE_PHP_VERSION'])) { $mod_strings['LBL_INCOMPATIBLE_PHP_VERSION'] = 'Php version 5.2.2 or above is required.'; } $php_verison_warning =<< {$mod_strings['LBL_INCOMPATIBLE_PHP_VERSION']} eoq; $php_warnings = $php_verison_warning; } //Add the backward compatibility check as well. //Php Backward compatibility checks if (ini_get("zend.ze1_compatibility_mode")) { $stop = true; if (empty($mod_strings['LBL_BACKWARD_COMPATIBILITY_ON'])) { $mod_strings['LBL_BACKWARD_COMPATIBILITY_ON'] = 'Php Backward Compatibility mode is turned on. Set zend.ze1_compatibility_mode to Off for proceeding further'; } $php_compatibility_warning =<< {$mod_strings['LBL_BACKWARD_COMPATIBILITY_ON']} eoq; $php_warnings .= $php_compatibility_warning; } if ($php_warnings != null) { $uwMain = $php_warnings; } $GLOBALS['top_message'] = "{$mod_strings['LBL_UW_PREFLIGHT_TESTS_PASSED2']}"; $showBack = false; $showCancel = true; $showRecheck = true; $showNext = ($stop) ? false : true; $stepBack = $_REQUEST['step'] - 1; $stepNext = $_REQUEST['step'] + 1; $stepCancel = -1; $stepRecheck = $_REQUEST['step']; $_SESSION['step'][$steps['files'][$_REQUEST['step']]] = ($stop) ? 'failed' : 'success';