UWUpgrade(); //ADDING A SESSION VARIBALE FOR KEEPING TRACK OF TOTAL UPGRADE TIME. if(!isset($_SESSION['totalUpgradeTime'])){ $_SESSION['totalUpgradeTime'] = 0; } if(!isset($mod_strings['LBL_UW_ACCEPT_THE_LICENSE']) || $mod_strings['LBL_UW_ACCEPT_THE_LICENSE'] == null){ $mod_strings['LBL_UW_ACCEPT_THE_LICENSE'] = 'Accept License'; } if(!isset($mod_strings['LBL_UW_CONVERT_THE_LICENSE']) || $mod_strings['LBL_UW_CONVERT_THE_LICENSE'] == null){ $mod_strings['LBL_UW_CONVERT_THE_LICENSE'] = 'Convert License'; } $license_title = $mod_strings['LBL_UW_ACCEPT_THE_LICENSE']; if((isset($sugar_flavor) && $sugar_flavor != null) && ($sugar_flavor=='OS' || $sugar_flavor=='CE')){ $license_title = $mod_strings['LBL_UW_CONVERT_THE_LICENSE']; } if(isset($_REQUEST['delete_package']) && $_REQUEST['delete_package'] == 'true') { logThis('running delete old package'); $error = ''; if(!isset($_REQUEST['install_file']) || ($_REQUEST['install_file'] == "")) { logThis('ERROR: trying to delete non-existent file: ['.$_REQUEST['install_file'].']'); $error .= $mod_strings['ERR_UW_NO_FILE_UPLOADED'].'
'; } // delete file in upgrades/patch $delete_me = urldecode( $_REQUEST['install_file'] ); if(is_file($delete_me) && !@unlink($delete_me)) { logThis('ERROR: could not delete: '.$delete_me); $error .= $mod_strings['ERR_UW_FILE_NOT_DELETED'].$delete_me.'
'; } // delete back up instance $delete_dir = clean_path(remove_file_extension(urldecode($_REQUEST['install_file'])) . "-restore"); if(is_dir($delete_dir) && !@rmdir_recursive($delete_dir)) { logThis('ERROR: could not delete: '.$delete_dir); $error .= $mod_strings['ERR_UW_FILE_NOT_DELETED'].$delete_dir.'
'; } // delete file in cache/upload $fileS = explode('/', $delete_me); $c = count($fileS); $fileName = (isset($fileS[$c-1]) && !empty($fileS[$c-1])) ? $fileS[$c-1] : $fileS[$c-2]; $deleteUpload = getcwd().'/'.$sugar_config['upload_dir'].$fileName; logThis('Trying to delete '.$deleteUpload); if(is_file($deleteUpload) && !@unlink($deleteUpload)) { logThis('ERROR: could not delete: ['.$deleteUpload.']'); $error .= $mod_strings['ERR_UW_FILE_NOT_DELETED'].$sugar_config['upload_dir'].$fileName; } if(!empty($error)) { $out = "{$error}
"; if(!empty($GLOBALS['top_message'])){ $GLOBALS['top_message'] .= "
{$out}"; } else{ $GLOBALS['top_message'] = $out; } } } //redirect to the new upgradewizard if(isset($_SESSION['Upgraded451Wizard']) && $_SESSION['Upgraded451Wizard']==true){ if(!isset($_SESSION['Initial_451to500_Step'])){ //redirect to the new upgradewizard $redirect_new_wizard = $sugar_config['site_url' ].'/index.php?module=UpgradeWizard&action=index'; //'
'; //echo ""; $_SESSION['Initial_451to500_Step'] = true; //unset($_SESSION['step']); $_REQUEST['step'] = 0; } $steps = array( 'files' => array( 'license_fiveO', 'preflight', 'commit', 'end', 'cancel', ), 'desc' => array ( $license_title, $mod_strings['LBL_UW_TITLE_PREFLIGHT'], $mod_strings['LBL_UW_TITLE_COMMIT'], $mod_strings['LBL_UW_TITLE_END'], $mod_strings['LBL_UW_TITLE_CANCEL'], ), ); } else{ if(isset($_SESSION['UpgradedUpgradeWizard']) && $_SESSION['UpgradedUpgradeWizard'] == true) { // Upgrading from 5.0 upwards and upload already performed. $steps = array( 'files' => array( 'start', 'systemCheck', 'preflight', 'commit', 'end', 'cancel', ), 'desc' => array ( $mod_strings['LBL_UW_TITLE_START'], $mod_strings['LBL_UW_TITLE_SYSTEM_CHECK'], $mod_strings['LBL_UW_TITLE_PREFLIGHT'], $mod_strings['LBL_UW_TITLE_COMMIT'], $mod_strings['LBL_UW_TITLE_END'], $mod_strings['LBL_UW_TITLE_CANCEL'], ), ); } else{ /* BEGIN TEMP FIX: This can be removed post 6.1. As this is a new string that is introduced in 6.1, we can't effectively load it into a pre 6.1 instance. Running global $current_language; $lang = $current_language; if(empty($lang)) $lang = $GLOBALS['sugar_config']['default_language']; require_once('include/SugarObjects/LanguageManager.php'); LanguageManager::clearLanguageCache('UpgradeWizard',$lang); LanguageManager::loadModuleLanguage('UpgradeWizard',$lang,true); causes strange theme issues with the Upgrade Wizard. */ if (empty($mod_strings['LBL_UW_TITLE_LAYOUTS'])) $mod_strings['LBL_UW_TITLE_LAYOUTS'] = 'Layouts'; /* END TEMP FIX */ // Upgrading from 5.0 upwards and upload not performed yet. $steps = array( 'files' => array( 'start', 'systemCheck', 'upload', 'preflight', 'commit', 'layouts', 'end', 'cancel', ), 'desc' => array ( $mod_strings['LBL_UW_TITLE_START'], $mod_strings['LBL_UW_TITLE_SYSTEM_CHECK'], $mod_strings['LBL_UPLOAD_UPGRADE'], $mod_strings['LBL_UW_TITLE_PREFLIGHT'], $mod_strings['LBL_UW_TITLE_COMMIT'], $mod_strings['LBL_UW_TITLE_LAYOUTS'], $mod_strings['LBL_UW_TITLE_END'], $mod_strings['LBL_UW_TITLE_CANCEL'], ), ); } } $upgradeStepFile = ''; if(isset($_REQUEST['step']) && $_REQUEST['step'] !=null){ if($_REQUEST['step'] == -1) { $_REQUEST['step'] = count($steps['files']) - 1; } elseif($_REQUEST['step'] >= count($steps['files'])) { $_REQUEST['step'] = 0; } $upgradeStepFile = $steps['files'][$_REQUEST['step']]; } else { //check if upgrade was run before. If so then resume from there $previouUpgradeRun = get_upgrade_progress(); if($previouUpgradeRun != null){ //echo 'Previous run '.$previouUpgradeRun.'
'; $upgradeStepFile = $previouUpgradeRun; //reset REQUEST for($i=0;$igetAll(); $upgrades_installed = 0; $uwHistory = '
'.$mod_strings['LBL_UW_DESC_MODULES_INSTALLED']."
\n"; $uwHistory .= "
    \n"; $uwHistory .= "\n"; $uwHistory .= << eoq; foreach($installeds as $installed) { $form_action = ''; $filename = from_html($installed->filename); $date_entered = $installed->date_entered; $type = $installed->type; //rrs only display patches here if($type == 'patch'){ $version = $installed->version; $upgrades_installed++; $link = is_file($filename)? ' ':''; $view = 'default'; $target_manifest = remove_file_extension( $filename ) . "-manifest.php"; // cn: bug 9174 - cleared out upgrade dirs, or corrupt entries in upgrade_history give us bad file paths if(is_file($target_manifest)) { require_once( "$target_manifest" ); $name = empty($manifest['name']) ? $filename : $manifest['name']; $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description']; if(isset($manifest['icon']) && $manifest['icon'] != "") { $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : ""; $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : ""; $manifest_icon = clean_path($manifest['icon']); $icon = ""; } else { $icon = getImageForType( $manifest['type'] ); } $uwHistory .= "\n". "\n". "\n"; } } } if($upgrades_installed == 0) { $uwHistory .= ""; } $uwHistory .= "
    {$mod_strings['LBL_ML_NAME']} {$mod_strings['LBL_ML_TYPE']} {$mod_strings['LBL_ML_VERSION']} {$mod_strings['LBL_ML_INSTALLED']} {$mod_strings['LBL_ML_DESCRIPTION']} {$mod_strings['LBL_ML_ACTION']}
    $icon$name$type$version$date_entered$description$link
    "; $uwHistory .= $mod_strings['LBL_UW_NO_INSTALLED_UPGRADES']; $uwHistory .= "
\n"; $uwHistory .= "\n"; //// END UPGRADE HISTORY /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// PAGE OUTPUT if($upgradeStepFile=='preflight' || $upgradeStepFile=='commit' || $upgradeStepFile=='end'){ $UW_510RC_PACKAGE_MESSAGE=<<

We do not recommended upgrading your production system to 5.1.0 RC. We recommend upgrading a development system for testing purposes.

eoq; } $js=<< function toggleNwFiles(target) { var div = document.getElementById(target); if(div.style.display == "none") { div.style.display = ""; } else { div.style.display = "none"; } } function handlePreflight(step) { if(step == 'preflight') { if(document.getElementById('select_schema_change') != null){ document.getElementById('schema').value = document.getElementById('select_schema_change').value; } if(document.getElementById('diffs') != null) { /* preset the hidden var for defaults */ checkSqlStatus(false); theForm = document.getElementById('diffs'); var serial = ''; for(i=0; i'; } return; } function getSelectedModulesForLayoutMerge() { var found_one = false; var results = new Array(); var table = document.getElementById('layoutSelection'); var moduleCheckboxes = table.getElementsByTagName('input'); for (var i = 0; i < moduleCheckboxes.length; i++) { var singleCheckbox = moduleCheckboxes[i]; if( typeof(singleCheckbox.type) != 'undefined' && singleCheckbox.type == 'checkbox' && singleCheckbox.name.substring(0,2) == 'lm' && singleCheckbox.checked ) { found_one = true; results.push(singleCheckbox.name.substring(3)); //remove the 'lm_' key } } var selectedModules = results.join('^,^'); var selectedModulesElement = document.createElement('input'); selectedModulesElement.setAttribute('type', 'hidden'); selectedModulesElement.setAttribute('name', 'layoutSelectedModules'); selectedModulesElement.setAttribute('value', selectedModules); var upgradeForms = document.getElementsByName('UpgradeWizardForm'); upgradeForms[0].appendChild(selectedModulesElement); return found_one; } eoq; $smarty->assign('UW_MAIN', $uwMain); $smarty->assign('UW_JS', $js); $smarty->assign('CHECKLIST', getChecklist($steps, $step)); $smarty->assign('UW_TITLE', get_module_title($mod_strings['LBL_UW_TITLE'], $mod_strings['LBL_UW_TITLE'].": ".$steps['desc'][$_REQUEST['step']], true)); $smarty->assign('MOD', $mod_strings); $smarty->assign('APP', $app_strings); $smarty->assign('GRIDLINE', $current_user->getPreference('gridline')); $smarty->assign('showNext', $showNext); $smarty->assign('showCancel', $showCancel); $smarty->assign('showBack', $showBack); $smarty->assign('showRecheck', $showRecheck); $smarty->assign('showDone', $showDone); $smarty->assign('showExit', $showExit); $smarty->assign('STEP_NEXT', $stepNext); $smarty->assign('STEP_CANCEL', $stepCancel); $smarty->assign('STEP_BACK', $stepBack); $smarty->assign('STEP_RECHECK', $stepRecheck); $smarty->assign('step', $steps['files'][$_REQUEST['step']]); $smarty->assign('UW_HISTORY', $uwHistory); $smarty->assign('disableNextForLicense',$disableNextForLicense); $u_allow='true'; if(isset($stop) && $stop == true) { $frozen = (isset($frozen)) ? "
".$frozen : ''; $smarty->assign('frozen', $frozen); if($step == 'upload') $u_allow = 'false'; } $smarty->assign('u_allow', $u_allow); if(!empty($GLOBALS['top_message'])){ $smarty->assign('top_message', $GLOBALS['top_message']); } if ($sugar_config['sugar_version'] < '5.5') { $smarty->assign('includeContainerCSS', true); } else { $smarty->assign('includeContainerCSS', false); } // else $smarty->display('modules/UpgradeWizard/uw_main.tpl'); //// END PAGE OUTPUT /////////////////////////////////////////////////////////////////////////////// ?>