} //Initialize session errors array if (!isset($_SESSION['sqlSkippedQueries']) && !is_array($_SESSION['sqlSkippedQueries'])) { $_SESSION['sqlSkippedQueries'] = array(); } // prevent "REFRESH" double commits if (!isset($_SESSION['committed'])) { //$_SESSION['committed'] = true; // flag to prevent refresh double-commit //set the flag at the end though unset($_SESSION['rebuild_relationships']); unset($_SESSION['rebuild_extensions']); //put checks for follwing files if (!isset($_SESSION['unzip_dir']) || empty($_SESSION['unzip_dir'])) { logThis('unzipping files in upgrade archive...'); $errors = array(); list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs(); $unzip_dir = ''; //also come up with mechanism to read from upgrade-progress file if (!isset($_SESSION['install_file']) || empty($_SESSION['install_file']) || !is_file($_SESSION['install_file'])) { if (file_exists(clean_path($base_tmp_upgrade_dir)) && ($handle = opendir(clean_path($base_tmp_upgrade_dir)))) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //echo $base_tmp_upgrade_dir."/".$file.'</br>'; if (is_file($base_tmp_upgrade_dir . "/" . $file . "/manifest.php")) { require_once $base_tmp_upgrade_dir . "/" . $file . "/manifest.php"; $package_name = $manifest['copy_files']['from_dir']; //echo file_exists($base_tmp_upgrade_dir."/".$file."/".$package_name).'</br>'; if (file_exists($base_tmp_upgrade_dir . "/" . $file . "/" . $package_name) && file_exists($base_tmp_upgrade_dir . "/" . $file . "/scripts") && file_exists($base_tmp_upgrade_dir . "/" . $file . "/manifest.php")) { //echo 'Yeah this the directory '. $base_tmp_upgrade_dir."/".$file; $unzip_dir = $base_tmp_upgrade_dir . "/" . $file; if (file_exists("{$base_upgrade_dir}/patch/" . $package_name . '.zip')) {
function deletePackageOnCancel() { global $mod_strings; global $sugar_config; list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs(); logThis('running delete'); if (!isset($_SESSION['install_file']) || $_SESSION['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 = "{$base_upgrade_dir}/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 = "<b><span class='error'>{$error}</span></b><br />"; } }