|
|
@ -4,12 +4,17 @@ import com.fr.base.Env; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.extra.plugindependence.DownLoadDependenceUI; |
|
|
|
import com.fr.design.extra.plugindependence.DownLoadDependenceUI; |
|
|
|
import com.fr.general.*; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
|
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.plugin.Plugin; |
|
|
|
import com.fr.plugin.Plugin; |
|
|
|
import com.fr.plugin.PluginConfigManager; |
|
|
|
import com.fr.plugin.PluginConfigManager; |
|
|
|
import com.fr.plugin.PluginLoader; |
|
|
|
import com.fr.plugin.PluginLoader; |
|
|
|
import com.fr.plugin.PluginManagerHelper; |
|
|
|
import com.fr.plugin.PluginManagerHelper; |
|
|
|
|
|
|
|
import com.fr.plugin.PluginUtils; |
|
|
|
import com.fr.plugin.dependence.PluginDependence; |
|
|
|
import com.fr.plugin.dependence.PluginDependence; |
|
|
|
import com.fr.plugin.dependence.PluginDependenceException; |
|
|
|
import com.fr.plugin.dependence.PluginDependenceException; |
|
|
|
import com.fr.plugin.dependence.PluginDependenceUnit; |
|
|
|
import com.fr.plugin.dependence.PluginDependenceUnit; |
|
|
@ -115,8 +120,8 @@ public class PluginHelper { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Plugin readPlugin(File chosenFile) throws Exception { |
|
|
|
public static Plugin readPlugin(File chosenFile) throws Exception { |
|
|
|
// 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起
|
|
|
|
// 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起
|
|
|
|
StableUtils.deleteFile(new File(TEMP_PATH)); |
|
|
|
StableUtils.deleteFile(new File(TEMP_PATH)) |
|
|
|
|
|
|
|
|
|
|
|
IOUtils.unzip(chosenFile, TEMP_PATH); |
|
|
|
IOUtils.unzip(chosenFile, TEMP_PATH); |
|
|
|
File pluginFileDir = getTempPluginFileDirectory(); |
|
|
|
File pluginFileDir = getTempPluginFileDirectory(); |
|
|
|
if (pluginFileDir == null) { |
|
|
|
if (pluginFileDir == null) { |
|
|
@ -268,6 +273,12 @@ public class PluginHelper { |
|
|
|
FRLogger.getLogger().error(jarExpiredInfo); |
|
|
|
FRLogger.getLogger().error(jarExpiredInfo); |
|
|
|
throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); |
|
|
|
throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (isHigherEnvVersion(plugin.getEnvVersion())) { |
|
|
|
|
|
|
|
String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); |
|
|
|
|
|
|
|
FRLogger.getLogger().error(envVersionNotSupport); |
|
|
|
|
|
|
|
throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
File fileToCheck = getTempPluginFileDirectory(); |
|
|
|
File fileToCheck = getTempPluginFileDirectory(); |
|
|
|
File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); |
|
|
|
File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); |
|
|
|
if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { |
|
|
|
if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { |
|
|
@ -278,7 +289,12 @@ public class PluginHelper { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isHigherEnvVersion(String envVersion) { |
|
|
|
|
|
|
|
//高于8.0
|
|
|
|
|
|
|
|
return PluginUtils.compareVersion(envVersion, "8.0") > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取插件解压的临时文件夹 |
|
|
|
* 获取插件解压的临时文件夹 |
|
|
|
* |
|
|
|
* |
|
|
|