grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026download($release_map['category_id'], $release_map['package_id'], $_REQUEST['release_id']); $perform = true; if ($release_map['type'] != 'patch') { $pm->performSetup($tempFile, $release_map['type'], false); header('Location: index.php?module=Administration&action=UpgradeWizard&view=module'); } } } $base_filename = urldecode($tempFile); } else { $upload = new UploadFile('upgrade_zip'); /* Bug 51722 - Cannot Upload Upgrade File if System Settings Are Not Sufficient, Just Make sure that we can upload no matter what, set the default to 60M */ global $sugar_config; $upload_maxsize_backup = $sugar_config['upload_maxsize']; $sugar_config['upload_maxsize'] = 60000000; /* End Bug 51722 */ if (!$upload->confirm_upload()) { logThis('ERROR: no file uploaded!'); echo $mod_strings['ERR_UW_NO_FILE_UPLOADED']; $error = $upload->get_upload_error(); // add PHP error if isset if ($error) { $out = "{$mod_strings['ERR_UW_PHP_FILE_ERRORS'][$error]}"; } } else { $tempFile = "upload://".$upload->get_stored_file_name(); if (!$upload->final_move($tempFile)) { logThis('ERROR: could not move temporary file to final destination!'); unlinkUWTempFiles(); $out = "{$mod_strings['ERR_UW_NOT_VALID_UPLOAD']}"; } else { logThis('File uploaded to '.$tempFile); $base_filename = urldecode(basename($tempFile)); $perform = true; } } /* Bug 51722 - Restore the upload size in the config */ $sugar_config['upload_maxsize'] = $upload_maxsize_backup; /* End Bug 51722 */ } if ($perform) { $manifest_file = extractManifest($tempFile); if (is_file($manifest_file)) { require_once($manifest_file); $error = validate_manifest($manifest); if (!empty($error)) { $out = "{$error}"; break; } $upgrade_zip_type = $manifest['type']; // exclude the bad permutations if ($upgrade_zip_type != "patch") { logThis('ERROR: incorrect patch type found: '.$upgrade_zip_type); unlinkUWTempFiles(); $out = "{$mod_strings['ERR_UW_ONLY_PATCHES']}"; break; } sugar_mkdir("$base_upgrade_dir/$upgrade_zip_type", 0775, true); $target_path = "$base_upgrade_dir/$upgrade_zip_type/$base_filename"; $target_manifest = remove_file_extension($target_path) . "-manifest.php"; if (isset($manifest['icon']) && $manifest['icon'] != "") { logThis('extracting icons.'); $icon_location = extractFile($tempFile, $manifest['icon']); $path_parts = pathinfo($icon_location); copy($icon_location, remove_file_extension($target_path) . "-icon." . pathinfo($icon_location, PATHINFO_EXTENSION)); } if (rename($tempFile, $target_path)) { logThis('copying manifest.php to final destination.'); copy($manifest_file, $target_manifest); $out .= "{$base_filename} {$mod_strings['LBL_UW_FILE_UPLOADED']}.\n"; } else { logThis('ERROR: cannot copy manifest.php to final destination.'); $out .= "{$mod_strings['ERR_UW_UPLOAD_ERR']}"; break; } } else { logThis('ERROR: no manifest.php file found!'); unlinkUWTempFiles(); $out = "{$mod_strings['ERR_UW_NO_MANIFEST']}"; break; } $_SESSION['install_file'] = basename($tempFile); logThis('zip file moved to ['.$_SESSION['install_file'].']'); //rrs serialize manifest for saving in the db $serial_manifest = array(); $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); $_SESSION['install_manifest'] = base64_encode(serialize($serial_manifest)); } if (!empty($tempFile)) { upgradeUWFiles($target_path); //set the upgrade progress status. actually it should be set when a file is uploaded set_upgrade_progress('upload', 'done'); } break; // end 'upload' case 'delete': logThis('running delete'); 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 (@unlink($delete_me)) { logThis('unlinking: '.$delete_me); $out = basename($delete_me).$mod_strings['LBL_UW_FILE_DELETED']; } else { logThis('ERROR: could not delete ['.$delete_me.']'); $error = $mod_strings['ERR_UW_FILE_NOT_DELETED'].$delete_me; } if (!empty($error)) { $out = "{$error}"; } unlinkUWTempFiles(); //set the upgrade progress status. actually it should be set when a file is uploaded set_upgrade_progress('upload', 'in_progress'); break; } //// END UPLOAD FILE PROCESSING FORM /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// READY TO INSTALL UPGRADES $validReturn = getValidPatchName(); $ready = $validReturn['ready']; $disabled = $validReturn['disabled']; //// END READY TO INSTALL UPGRADES /////////////////////////////////////////////////////////////////////////////// if (isset($_SESSION['install_file']) && !empty($_SESSION['install_file']) && is_file($_SESSION['install_file'])) { $stop = false; } else { $stop = true; } if ($stop == false) { set_upgrade_progress('upload', 'done'); } $frozen = $out; if (!$stop) { if (!empty($GLOBALS['top_message'])) { $GLOBALS['top_message'] .= ""; } else { $GLOBALS['top_message'] = ''; } $GLOBALS['top_message'] .= "{$mod_strings['LBL_UPLOAD_SUCCESS']}"; } else { if (!$frozen) { $GLOBALS['top_message'] .= ""; } else { $GLOBALS['top_message'] = "{$frozen}"; } } /////////////////////////////////////////////////////////////////////////////// //// UPLOAD FORM $form = ''; if (empty($GLOBALS['sugar_config']['disable_uw_upload'])) { $form =<< {$mod_strings['LBL_SELECT_FILE']} eoq; } $hidden_fields = ""; $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; $form2 = ''; /* Removing Install From Sugar tab from Upgradewizard. if(class_exists("PackageManagerDisplay")) { $form2 = PackageManagerDisplay::buildPatchDisplay($form, $hidden_fields, 'index.php', array('patch', 'module')); } */ if ($form2 == null) { $form2 = $form; } $json = getVersionedScript('include/JSON.js'); $form3 =<< {$mod_strings['LBL_UW_FILES_QUEUED']} {$ready} eoq2; $form5 =<< eoq5; $uwMain = $form2.$form3.$form5; //// END UPLOAD FORM /////////////////////////////////////////////////////////////////////////////// //set the upgrade progress status. actually it should be set when a file is uploaded //set_upgrade_progress('upload','done'); $showBack = true; $showCancel = true; $showRecheck = false; $showNext = true; $stepBack = $_REQUEST['step'] - 1; $stepNext = $_REQUEST['step'] + 1; $stepCancel = -1; $stepRecheck = $_REQUEST['step']; $_SESSION['step'][$steps['files'][$_REQUEST['step']]] = ($stop) ? 'failed' : 'success';