avatar

952

Make sure to save the auctions.xml file if we're changing databases.

by mrs, 09 Jun, 2009 08:12 PM
951 952  
172172     SearchManager.getInstance().saveSearches();
173173     AuctionStats as = AuctionServerManager.getInstance().getStats();
174174     JConfig.setConfiguration("last.auctioncount", Integer.toString(as.getCount()));
175     Database.saveDBConfig();
175     if(Database.saveDBConfig()) {
176       // If we're changing databases, we'll need the auction information saved so we can load it into the new database.
177       AuctionsManager.getInstance().saveAuctions();
178     }
176179     JConfig.saveConfiguration(cfgFilename);
177180     ActiveRecord.shutdown(); //  TODO -- Can this be put before the saveDBConfig?
178181     JConfig.log().logMessage("Shutting down JBidwatcher.");
951 952  
185185     return mConn;
186186   }
187187 
188   public static void saveDBConfig() {
188   public static boolean saveDBConfig() {
189189     if(JConfig.queryConfiguration("temp.db.protocol") != null) {
190190       String[] keys = { "db.framework", "db.protocol", "db.driver", "db.user", "db.pass" };
191191       for(String key : keys) {
192192         JConfig.setConfiguration(key, JConfig.queryConfiguration("temp." + key));
193193       }
194194       JConfig.kill("jbidwatcher.created_db");
195       return true;
195196     }
197     return false;
196198   }
197199 }