$moduleupdate_name = $package->getModuleNameFromZip($uploadfilename); if ($moduleupdate_name == null) { $smarty->assign("MODULEUPDATE_FAILED", "true"); $smarty->assign("MODULEUPDATE_FILE_INVALID", "true"); } else { if (!$package->isLanguageType() && $moduleupdate_name != $target_modulename) { $smarty->assign("MODULEUPDATE_FAILED", "true"); $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true"); } else { if ($package->isLanguageType() && trim($package->xpath_value('prefix')) != $target_modulename) { $smarty->assign("MODULEUPDATE_FAILED", "true"); $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true"); } else { $moduleupdate_dep_vtversion = $package->getDependentVtigerVersion(); $moduleupdate_license = $package->getLicense(); $moduleupdate_version = $package->getVersion(); if (!$package->isLanguageType()) { $moduleInstance = Vtiger_Module::getInstance($moduleupdate_name); $moduleupdate_exists = $moduleInstance ? "true" : "false"; $moduleupdate_dir_name = "modules/{$moduleupdate_name}"; $moduleupdate_dir_exists = is_dir($moduleupdate_dir_name) ? "true" : "false"; $smarty->assign("MODULEUPDATE_CUR_VERSION", $moduleInstance ? $moduleInstance->version : ''); $smarty->assign("MODULEUPDATE_NOT_EXISTS", !$moduleupdate_exists); $smarty->assign("MODULEUPDATE_DIR", $moduleupdate_dir_name); $smarty->assign("MODULEUPDATE_DIR_NOT_EXISTS", !$moduleupdate_dir_exists); // If version is matching, dis-allow migration if (version_compare($moduleupdate_version, $moduleInstance->version, '=')) { $smarty->assign("MODULEUPDATE_FAILED", "true"); $smarty->assign("MODULEUPDATE_SAME_VERSION", "true"); } }