forked from I2P_Developers/i2p.i2p
* Plugins: Add completion message after all-update check
This commit is contained in:
@ -127,6 +127,7 @@ public class PluginStarter implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log log = ctx.logManager().getLog(PluginStarter.class);
|
Log log = ctx.logManager().getLog(PluginStarter.class);
|
||||||
|
int updated = 0;
|
||||||
for (Map.Entry<String, String> entry : toUpdate.entrySet()) {
|
for (Map.Entry<String, String> entry : toUpdate.entrySet()) {
|
||||||
String appName = entry.getKey();
|
String appName = entry.getKey();
|
||||||
if (log.shouldLog(Log.WARN))
|
if (log.shouldLog(Log.WARN))
|
||||||
@ -152,7 +153,13 @@ public class PluginStarter implements Runnable {
|
|||||||
Thread.sleep(5*1000);
|
Thread.sleep(5*1000);
|
||||||
} catch (InterruptedException ie) {}
|
} catch (InterruptedException ie) {}
|
||||||
} while (puh.isRunning());
|
} while (puh.isRunning());
|
||||||
|
if (puh.wasUpdateSuccessful())
|
||||||
|
updated++;
|
||||||
}
|
}
|
||||||
|
if (updated > 0)
|
||||||
|
puc.setDoneStatus(ngettext("1 plugin updated", "{0} plugins updated", updated, ctx));
|
||||||
|
else
|
||||||
|
puc.setDoneStatus(Messages.getString("Plugin update check complete", ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** this shouldn't throw anything */
|
/** this shouldn't throw anything */
|
||||||
@ -764,4 +771,9 @@ public class PluginStarter implements Runnable {
|
|||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
method.invoke(urlClassLoader, new Object[]{u});
|
method.invoke(urlClassLoader, new Object[]{u});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** translate a string */
|
||||||
|
private static String ngettext(String s, String p, int n, I2PAppContext ctx) {
|
||||||
|
return Messages.getString(n, s, p, ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,12 @@ public class PluginUpdateChecker extends UpdateHandler {
|
|||||||
public void setAppStatus(String status) {
|
public void setAppStatus(String status) {
|
||||||
updateStatus(status);
|
updateStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 0.8.13 */
|
||||||
|
public void setDoneStatus(String status) {
|
||||||
|
updateStatus(status);
|
||||||
|
scheduleStatusClean(status);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return _pluginUpdateCheckerRunner != null && _pluginUpdateCheckerRunner.isRunning();
|
return _pluginUpdateCheckerRunner != null && _pluginUpdateCheckerRunner.isRunning();
|
||||||
|
@ -42,6 +42,8 @@ public class PluginUpdateHandler extends UpdateHandler {
|
|||||||
private static PluginUpdateRunner _pluginUpdateRunner;
|
private static PluginUpdateRunner _pluginUpdateRunner;
|
||||||
private String _xpi2pURL;
|
private String _xpi2pURL;
|
||||||
private String _appStatus;
|
private String _appStatus;
|
||||||
|
private volatile boolean _updated;
|
||||||
|
|
||||||
private static final String XPI2P = "app.xpi2p";
|
private static final String XPI2P = "app.xpi2p";
|
||||||
private static final String ZIP = XPI2P + ".zip";
|
private static final String ZIP = XPI2P + ".zip";
|
||||||
public static final String PLUGIN_DIR = "plugins";
|
public static final String PLUGIN_DIR = "plugins";
|
||||||
@ -92,6 +94,11 @@ public class PluginUpdateHandler extends UpdateHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 0.8.13 */
|
||||||
|
public boolean wasUpdateSuccessful() {
|
||||||
|
return _updated;
|
||||||
|
}
|
||||||
|
|
||||||
private void scheduleStatusClean(String msg) {
|
private void scheduleStatusClean(String msg) {
|
||||||
SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
|
SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
|
||||||
}
|
}
|
||||||
@ -108,6 +115,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class PluginUpdateRunner extends UpdateRunner implements Runnable, EepGet.StatusListener {
|
public class PluginUpdateRunner extends UpdateRunner implements Runnable, EepGet.StatusListener {
|
||||||
|
private boolean _updated;
|
||||||
|
|
||||||
public PluginUpdateRunner(String url) {
|
public PluginUpdateRunner(String url) {
|
||||||
super();
|
super();
|
||||||
@ -115,6 +123,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void update() {
|
protected void update() {
|
||||||
|
_updated = false;
|
||||||
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
|
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
|
||||||
// use the same settings as for updater
|
// use the same settings as for updater
|
||||||
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
|
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
|
||||||
@ -383,6 +392,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updated = true;
|
||||||
to.delete();
|
to.delete();
|
||||||
if (Boolean.valueOf(props.getProperty("dont-start-at-install")).booleanValue()) {
|
if (Boolean.valueOf(props.getProperty("dont-start-at-install")).booleanValue()) {
|
||||||
if (Boolean.valueOf(props.getProperty("router-restart-required")).booleanValue())
|
if (Boolean.valueOf(props.getProperty("router-restart-required")).booleanValue())
|
||||||
|
Reference in New Issue
Block a user