"; $install_type = getInstallType( $install_file ); $version = ""; $previous_version = ""; $show_files = true; $zip_from_dir = "."; $zip_to_dir = "."; $zip_force_copy = array(); $license_file = $unzip_dir.'/LICENSE.txt'; $readme_file = $unzip_dir.'/README.txt'; $require_license = false; $found_readme = false; $author = ''; $name = ''; $description = ''; $is_uninstallable = true; $id_name = ''; $dependencies = array(); $remove_tables = 'true'; unzip( $install_file, $unzip_dir ); if($install_type == 'module' && $mode != 'Uninstall'){ if(file_exists($license_file)){ $require_license = true; } } //Scan the unzip dir for unsafe files if(!empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan']) && $install_type != 'patch'){ require_once('ModuleInstall/ModuleScanner.php'); $ms = new ModuleScanner(); $ms->scanPackage($unzip_dir); if($ms->hasIssues()){ $ms->displayIssues(); sugar_cleanup(true); } } // assumption -- already validated manifest.php at time of upload require_once( "$unzip_dir/manifest.php" ); if( isset( $manifest['copy_files']['from_dir'] ) && $manifest['copy_files']['from_dir'] != "" ){ $zip_from_dir = $manifest['copy_files']['from_dir']; } if( isset( $manifest['copy_files']['to_dir'] ) && $manifest['copy_files']['to_dir'] != "" ){ $zip_to_dir = $manifest['copy_files']['to_dir']; } if( isset( $manifest['copy_files']['force_copy'] ) && $manifest['copy_files']['force_copy'] != "" ){ $zip_force_copy = $manifest['copy_files']['force_copy']; } if( isset( $manifest['version'] ) ){ $version = $manifest['version']; } if( isset( $manifest['author'] ) ){ $author = $manifest['author']; } if( isset( $manifest['name'] ) ){ $name = $manifest['name']; } if( isset( $manifest['description'] ) ){ $description = $manifest['description']; } if( isset( $manifest['is_uninstallable'] ) ){ $is_uninstallable = $manifest['is_uninstallable']; } if(isset($installdefs) && isset( $installdefs['id'] ) ){ $id_name = $installdefs['id']; } if( isset( $manifest['dependencies']) ){ $dependencies = $manifest['dependencies']; } if( isset( $manifest['remove_tables']) ){ $remove_tables = $manifest['remove_tables']; } if($remove_tables != 'prompt'){ $hidden_fields .= ""; } if(file_exists($readme_file) || !empty($manifest['readme'])){ $found_readme = true; } $uh = new UpgradeHistory(); //check dependencies first if(!empty($dependencies)){ $not_found = $uh->checkDependencies($dependencies); if(!empty($not_found) && count($not_found) > 0){ die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]"); }//fi } switch( $install_type ){ case "full": case "patch": if( !is_writable( "config.php" ) ){ die( $mod_strings['ERR_UW_CONFIG'] ); } break; case "theme": break; case "langpack": // find name of language pack: find single file in include/language/xx_xx.lang.php $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); while( $f = $d->read() ){ if( $f == "." || $f == ".." ){ continue; } else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ $new_lang_name = $match[1]; } } if( $new_lang_name == "" ){ die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); } $hidden_fields .= ""; $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); if( $new_lang_desc == "" ){ die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); } $hidden_fields .= ""; if( !is_writable( "config.php" ) ){ die( $mod_strings['ERR_UW_CONFIG'] ); } break; case "module": $previous_install = array(); if(!empty($id_name) & !empty($version)) $previous_install = $uh->determineIfUpgrade($id_name, $version); $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; $show_files = false; //rrs pull out unique_key $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; $hidden_fields .= ""; break; default: die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); } $new_files = findAllFilesRelative( "$unzip_dir/$zip_from_dir", array() ); $hidden_fields .= ""; $serial_manifest = array(); $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); $hidden_fields .= ""; // present list to user ?>
info( "Upgrade Wizard patches" ); ?>