mark installed plugin as core after server started

This commit is contained in:
Eduard Heimbuch
2019-09-18 15:47:58 +02:00
parent 7e85f374ab
commit 913b7080fd
3 changed files with 20 additions and 7 deletions

View File

@@ -195,11 +195,7 @@ public class DefaultPluginManager implements PluginManager {
dependencyTracker.removeInstalled(installed.getDescriptor());
installed.setMarkedForUninstall(true);
try {
Files.createFile(installed.getDirectory().resolve(InstalledPlugin.UNINSTALL_MARKER_FILENAME));
} catch (IOException e) {
throw new PluginException("could not mark plugin " + name + " in path " + installed.getDirectory() + " for uninstall", e);
}
createMarkerFile(installed, InstalledPlugin.UNINSTALL_MARKER_FILENAME);
if (restartAfterInstallation) {
restart("plugin installation");
@@ -219,6 +215,19 @@ public class DefaultPluginManager implements PluginManager {
&& dependencyTracker.mayUninstall(p.getDescriptor().getInformation().getName());
}
private void markAsCore(InstalledPlugin plugin) {
createMarkerFile(plugin, PluginConstants.FILE_CORE);
plugin.markAsCore();
}
private void createMarkerFile(InstalledPlugin plugin, String markerFile) {
try {
Files.createFile(plugin.getDirectory().resolve(markerFile));
} catch (IOException e) {
throw new PluginException("could not mark plugin " + plugin.getId() + " in path " + plugin.getDirectory() + "as " + markerFile, e);
}
}
@Override
public void executePendingAndRestart() {
PluginPermissions.manage().check();

View File

@@ -462,7 +462,7 @@ public final class PluginProcessor
if (Files.exists(descriptorPath)) {
boolean core = Files.exists(directory.resolve("core"));
boolean core = Files.exists(directory.resolve(PluginConstants.FILE_CORE));
ClassLoader cl = createClassLoader(classLoader, smp);