Remove configuration cleaning options.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Sep 2012 12:54:58 +0000 (14:54 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Sep 2012 12:54:58 +0000 (14:54 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/web/OptionsPage.java
src/main/resources/templates/options.html

index 4001f46..1093c0c 100644 (file)
@@ -2175,8 +2175,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        configuration.getBooleanValue("Option/ActivateFcpInterface").setValue(options.getBooleanOption("ActivateFcpInterface").getReal());
                        configuration.getIntValue("Option/FcpFullAccessRequired").setValue(options.getIntegerOption("FcpFullAccessRequired").getReal());
                        configuration.getBooleanValue("Option/SoneRescueMode").setValue(options.getBooleanOption("SoneRescueMode").getReal());
-                       configuration.getBooleanValue("Option/ClearOnNextRestart").setValue(options.getBooleanOption("ClearOnNextRestart").getReal());
-                       configuration.getBooleanValue("Option/ReallyClearOnNextRestart").setValue(options.getBooleanOption("ReallyClearOnNextRestart").getReal());
 
                        /* save known Sones. */
                        int soneCounter = 0;
@@ -2277,19 +2275,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
 
                }));
                options.addBooleanOption("SoneRescueMode", new DefaultOption<Boolean>(false));
-               options.addBooleanOption("ClearOnNextRestart", new DefaultOption<Boolean>(false));
-               options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption<Boolean>(false));
-
-               /* read options from configuration. */
-               options.getBooleanOption("ClearOnNextRestart").set(configuration.getBooleanValue("Option/ClearOnNextRestart").getValue(null));
-               options.getBooleanOption("ReallyClearOnNextRestart").set(configuration.getBooleanValue("Option/ReallyClearOnNextRestart").getValue(null));
-               boolean clearConfiguration = options.getBooleanOption("ClearOnNextRestart").get() && options.getBooleanOption("ReallyClearOnNextRestart").get();
-               options.getBooleanOption("ClearOnNextRestart").set(null);
-               options.getBooleanOption("ReallyClearOnNextRestart").set(null);
-               if (clearConfiguration) {
-                       /* stop loading the configuration. */
-                       return;
-               }
 
                loadConfigurationValue("InsertionDelay");
                loadConfigurationValue("PostsPerPage");
@@ -2940,58 +2925,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        return this;
                }
 
-               /**
-                * Returns whether Sone should clear its settings on the next restart.
-                * In order to be effective, {@link #isReallyClearOnNextRestart()} needs
-                * to return {@code true} as well!
-                *
-                * @return {@code true} if Sone should clear its settings on the next
-                *         restart, {@code false} otherwise
-                */
-               public boolean isClearOnNextRestart() {
-                       return options.getBooleanOption("ClearOnNextRestart").get();
-               }
-
-               /**
-                * Sets whether Sone will clear its settings on the next restart.
-                *
-                * @param clearOnNextRestart
-                *            {@code true} if Sone should clear its settings on the next
-                *            restart, {@code false} otherwise
-                * @return This preferences
-                */
-               public Preferences setClearOnNextRestart(Boolean clearOnNextRestart) {
-                       options.getBooleanOption("ClearOnNextRestart").set(clearOnNextRestart);
-                       return this;
-               }
-
-               /**
-                * Returns whether Sone should really clear its settings on next
-                * restart. This is a confirmation option that needs to be set in
-                * addition to {@link #isClearOnNextRestart()} in order to clear Sone’s
-                * settings on the next restart.
-                *
-                * @return {@code true} if Sone should really clear its settings on the
-                *         next restart, {@code false} otherwise
-                */
-               public boolean isReallyClearOnNextRestart() {
-                       return options.getBooleanOption("ReallyClearOnNextRestart").get();
-               }
-
-               /**
-                * Sets whether Sone should really clear its settings on the next
-                * restart.
-                *
-                * @param reallyClearOnNextRestart
-                *            {@code true} if Sone should really clear its settings on
-                *            the next restart, {@code false} otherwise
-                * @return This preferences
-                */
-               public Preferences setReallyClearOnNextRestart(Boolean reallyClearOnNextRestart) {
-                       options.getBooleanOption("ReallyClearOnNextRestart").set(reallyClearOnNextRestart);
-                       return this;
-               }
-
        }
 
 }
index ab962d8..c770da3 100644 (file)
@@ -132,10 +132,6 @@ public class OptionsPage extends SoneTemplatePage {
                        Integer fcpFullAccessRequiredInteger = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("fcp-full-access-required", 1), preferences.getFcpFullAccessRequired().ordinal());
                        FullAccessRequired fcpFullAccessRequired = FullAccessRequired.values()[fcpFullAccessRequiredInteger];
                        preferences.setFcpFullAccessRequired(fcpFullAccessRequired);
-                       boolean clearOnNextRestart = Boolean.parseBoolean(request.getHttpRequest().getPartAsStringFailsafe("clear-on-next-restart", 5));
-                       preferences.setClearOnNextRestart(clearOnNextRestart);
-                       boolean reallyClearOnNextRestart = Boolean.parseBoolean(request.getHttpRequest().getPartAsStringFailsafe("really-clear-on-next-restart", 5));
-                       preferences.setReallyClearOnNextRestart(reallyClearOnNextRestart);
                        webInterface.getCore().touchConfiguration();
                        if (fieldErrors.isEmpty()) {
                                throw new RedirectException(getPath());
@@ -161,8 +157,6 @@ public class OptionsPage extends SoneTemplatePage {
                templateContext.set("trust-comment", preferences.getTrustComment());
                templateContext.set("fcp-interface-active", preferences.isFcpInterfaceActive());
                templateContext.set("fcp-full-access-required", preferences.getFcpFullAccessRequired().ordinal());
-               templateContext.set("clear-on-next-restart", preferences.isClearOnNextRestart());
-               templateContext.set("really-clear-on-next-restart", preferences.isReallyClearOnNextRestart());
        }
 
 }
index 119c8a1..4ec88cb 100644 (file)
                        </select>
                </p>
 
-               <h2><%= Page.Options.Section.Cleaning.Title|l10n|html></h2>
-
-               <p><%= Page.Options.Option.ClearOnNextRestart.Description|l10n|html|replace needle=="{strong}" replacement=="<strong>"|replace needle=="{/strong}" replacement=="</strong>"></p>
-               <p><select name="clear-on-next-restart"><option disabled="disabled"><%= WebInterface.SelectBox.Choose|l10n|html></option><option value="true"<%if clear-on-next-restart> selected="selected"<%/if>><%= WebInterface.SelectBox.Yes|l10n|html></option><option value="false"<%if ! clear-on-next-restart> selected="selected"<%/if>><%= WebInterface.SelectBox.No|l10n|html></option></select>
-
-               <p><%= Page.Options.Option.ReallyClearOnNextRestart.Description|l10n|html|replace needle=="{strong}" replacement=="<strong>"|replace needle=="{/strong}" replacement=="</strong>"></p>
-               <p><select name="really-clear-on-next-restart"><option disabled="disabled"><%= WebInterface.SelectBox.Choose|l10n|html></option><option value="true"<%if really-clear-on-next-restart> selected="selected"<%/if>><%= WebInterface.SelectBox.Yes|l10n|html></option><option value="false"<%if ! really-clear-on-next-restart> selected="selected"<%/if>><%= WebInterface.SelectBox.No|l10n|html></option></select>
-
                <p><button type="submit"><%= Page.Options.Button.Save|l10n|html></button></p>
 
        </form>