forked from I2P_Developers/i2p.i2p
* UpdateManager:
- Convert to RouterApp and remove update hooks from context
(ticket #1185)
This commit is contained in:
@@ -370,7 +370,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
* @param app null for a new install
|
||||
*/
|
||||
private void installPlugin(String app, String url) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot install");
|
||||
return;
|
||||
@@ -397,7 +397,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
}
|
||||
|
||||
private void checkPlugin(String app) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot check");
|
||||
return;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
if (_action == null)
|
||||
return;
|
||||
if (_action.equals(_("Check for updates"))) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot check");
|
||||
return;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class PluginStarter implements Runnable {
|
||||
if (toUpdate.isEmpty())
|
||||
return;
|
||||
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) ctx.updateManager();
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(ctx);
|
||||
if (mgr == null)
|
||||
return;
|
||||
if (mgr.isUpdateInProgress())
|
||||
|
||||
@@ -645,7 +645,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
t.setPriority(Thread.NORM_PRIORITY - 1);
|
||||
t.start();
|
||||
|
||||
ConsoleUpdateManager um = new ConsoleUpdateManager(_context);
|
||||
ConsoleUpdateManager um = new ConsoleUpdateManager(_context, _mgr, null);
|
||||
um.start();
|
||||
|
||||
if (PluginStarter.pluginsEnabled(_context)) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.update.ConsoleUpdateManager;
|
||||
import net.i2p.update.UpdateManager;
|
||||
import net.i2p.update.UpdateType;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.Log;
|
||||
@@ -33,6 +35,17 @@ public class UpdateHandler {
|
||||
_context = ctx;
|
||||
_log = ctx.logManager().getLog(UpdateHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null if not found
|
||||
* @since 0.9.12
|
||||
*/
|
||||
public static ConsoleUpdateManager updateManager(RouterContext ctx) {
|
||||
ClientAppManager cmgr = ctx.clientAppManager();
|
||||
if (cmgr == null)
|
||||
return null;
|
||||
return (ConsoleUpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure this bean to query a particular router context
|
||||
@@ -75,7 +88,7 @@ public class UpdateHandler {
|
||||
}
|
||||
|
||||
private void update(UpdateType type) {
|
||||
ConsoleUpdateManager mgr = (ConsoleUpdateManager) _context.updateManager();
|
||||
ConsoleUpdateManager mgr = updateManager(_context);
|
||||
if (mgr == null)
|
||||
return;
|
||||
if (mgr.isUpdateInProgress(ROUTER_SIGNED) || mgr.isUpdateInProgress(ROUTER_UNSIGNED) ||
|
||||
|
||||
Reference in New Issue
Block a user