Exemple #1
0
 /** Clear the entire database except for the administrator users. */
 public static void clearDB() {
   if (!Session.user().isModerator()) {
     flash.error("secure.cleardberror");
     Application.index(0);
   }
   Database.clearKeepAdmins();
   flash.success("secure.cleardbflash");
   Application.admin();
 }
Exemple #2
0
  /**
   * Load an XML database file
   *
   * @param xml the XML database file to be loaded. This field is mandatory.
   */
  public static void loadXML(@Required File xml) {
    if (!Session.user().isModerator()) {
      Application.index(0);
    }
    if (xml == null) {
      flash.error("secure.xmlselecterror");
      Application.admin();
    }

    try {
      Database.importXML(xml);
      flash.success("secure.xmlloadflash");
    } catch (Throwable e) {
      flash.error("secure.xmlloaderror", e.getMessage());
      e.printStackTrace();
      Application.admin();
    }
    if (xml != null) {
      xml.delete();
    }
    Application.index(0);
  }