Only allow disable or uninstall when all dependants or dependencies are disabled/enabled

This commit is contained in:
tfennelly committed 2015-10-01 16:35:05 +01:00
1 parent 7fb4696a6f
commit 3b5424e507
6 files changed
+504 -11

No files matched your search

@@ -520,9 +520,33 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
}
}
// Redo who depends on who.
resolveDependantPlugins();
LOGGER.info("Plugin " + p.getShortName()+":"+p.getVersion() + " dynamically installed");
}
@Restricted(NoExternalUse.class)
public void resolveDependantPlugins() {
for (PluginWrapper plugin : plugins) {
Set<String> dependants = new HashSet<>();
for (PluginWrapper possibleDependant : plugins) {
// The plugin could have just been deleted. If so, it doesn't
// count as a dependant.
if (possibleDependant.isDeleted()) {
continue;
}
List<Dependency> dependencies = possibleDependant.getDependencies();
for (Dependency dependency : dependencies) {
if (dependency.shortName.equals(plugin.getShortName())) {
dependants.add(possibleDependant.getShortName());
}
}
}
plugin.setDependants(dependants);
}
}
/**
* If the war file has any "/WEB-INF/plugins/[*.jpi | *.hpi]", extract them into the plugin directory.
*