pause();
$trackerManager->unsetMonitors();
///////////////////////////////////////////////////////////////////////////////
//// SYSTEM PREP
list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs();
$subdirs = array('full', 'langpack', 'module', 'patch', 'theme');
global $sugar_flavor;
prepSystemForUpgrade();
$uwMain = '';
$steps = array();
$step = 0;
$showNext = '';
$showCancel = '';
$showBack = '';
$showRecheck = '';
$stepNext = '';
$stepCancel = '';
$stepBack = '';
$stepRecheck = '';
$showDone = '';
$showExit = '';
$disableNextForLicense='';
if(!isset($_SESSION['step']) || !is_array($_SESSION['step'])){
$_SESSION['step'] = array();
}
//// END SYSTEM PREP
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// LOGIC
$uh = new UpgradeHistory();
$smarty = new Sugar_Smarty();
set_upgrade_vars();
//Initialize the session variables. If upgrade_progress.php is already created
//look for session vars there and restore them
initialize_session_vars();
$deletedPackage =false;
$cancelUpgrade = false;
$backOrRecheckUpgrade = false;
// this flag set in pre_install.php->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 = 'upload://upgrades/patch/'.basename(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 = 'upload://upgrades/patch/'.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.'
';
}
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';
//'