|
|
|
@ -64,6 +64,11 @@ public class VersionCheckUtils {
|
|
|
|
|
private static final String ID = "id"; |
|
|
|
|
private static final String VERSION = "version"; |
|
|
|
|
private static final String NAME = "name"; |
|
|
|
|
private static final String RUNNING = "running"; |
|
|
|
|
private static final String SYNC = "sync"; |
|
|
|
|
private static final String GROUP = "group"; |
|
|
|
|
private static final String BI = "bi"; |
|
|
|
|
private static final String BIPREFIX = "com.finebi"; |
|
|
|
|
private static final Set<String> pluginsNeedIgnore = new HashSet<>(); |
|
|
|
|
static { |
|
|
|
|
pluginsNeedIgnore.addAll(Arrays.asList( |
|
|
|
@ -263,13 +268,10 @@ public class VersionCheckUtils {
|
|
|
|
|
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap(); |
|
|
|
|
for (int i = 0; i < remotePlugins.size(); i++) { |
|
|
|
|
remotePlugin = remotePlugins.getJSONObject(i); |
|
|
|
|
if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) { |
|
|
|
|
if (isPluginNeedIgnore(remotePlugin)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String remotePluginID = remotePlugin.getString(ID); |
|
|
|
|
if (pluginsNeedIgnore.contains(remotePluginID)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (localPluginsMap.containsKey(remotePluginID)) { |
|
|
|
|
if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) { |
|
|
|
|
continue; |
|
|
|
@ -290,6 +292,12 @@ public class VersionCheckUtils {
|
|
|
|
|
return differentPlugins; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean isPluginNeedIgnore(JSONObject remotePlugin) { |
|
|
|
|
return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC)) |
|
|
|
|
|| (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX) |
|
|
|
|
|| pluginsNeedIgnore.contains(remotePlugin.getString(ID))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static JSONArray syncPlugins(JSONArray differentPlugins) { |
|
|
|
|
Set<String> uninstallFailed = uninstallPlugins(differentPlugins); |
|
|
|
|
List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed); |
|
|
|
|