Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

warning if the DBs already exist in WORK

alloa40acf050ef5
diff --git a/source/migration.java b/source/migration.java
index 93a739092..63ca88cdb 100644
--- a/source/migration.java
+++ b/source/migration.java
@@ -63,38 +63,51 @@ public class migration {
File file=new File(sb.getRootPath(), "DATA/SETTINGS/wiki.db");
File file2;
if (file.exists()) {
- serverLog.logInfo("MIGRATION", "Migrating wiki.db to "+ sb.workPath);
- sb.wikiDB.close();
+ serverLog.logInfo("MIGRATION", "Migrating wiki.db to "
+ + sb.workPath);
file2 = new File(sb.workPath, "wiki.db");
- try {
- serverFileUtils.copy(file, file2);
- file.delete();
- } catch (IOException e) {
- }
-
- file = new File(sb.getRootPath(), "DATA/SETTINGS/wiki-bkp.db");
- if (file.exists()) {
- serverLog.logInfo("MIGRATION", "Migrating wiki-bkp.db to "+ sb.workPath);
- file2 = new File(sb.workPath, "wiki-bkp.db");
+ if (file2.exists()) {
+ serverLog.logWarning("MIGRATION", "wiki.db already exists in "
+ + sb.workPath + "! Not migrating.");
+ } else {
+ sb.wikiDB.close();
try {
serverFileUtils.copy(file, file2);
file.delete();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
+
+ file = new File(sb.getRootPath(), "DATA/SETTINGS/wiki-bkp.db");
+ if (file.exists()) {
+ serverLog.logInfo("MIGRATION", "Migrating wiki-bkp.db to " + sb.workPath);
+ file2 = new File(sb.workPath, "wiki-bkp.db");
+ try {
+ serverFileUtils.copy(file, file2);
+ file.delete();
+ } catch (IOException e) {
+ }
+ }
+ sb.initWiki((int) sb.getConfigLong("ramCacheWiki", 1024) / 1024);
}
- sb.initWiki((int) sb.getConfigLong("ramCacheWiki", 1024) / 1024);
}
file=new File(sb.getRootPath(), "DATA/SETTINGS/message.db");
- if(file.exists()){
- serverLog.logInfo("MIGRATION", "Migrating message.db to "+ sb.workPath);
- sb.messageDB.close();
- file2=new File(sb.workPath, "message.db");
- try {
- serverFileUtils.copy(file, file2);
- file.delete();
- } catch (IOException e) {}
- sb.initMessages((int) sb.getConfigLong("ramCacheMessage", 1024) / 1024);
+ if (file.exists()) {
+ serverLog.logInfo("MIGRATION", "Migrating message.db to " + sb.workPath);
+ file2 = new File(sb.workPath, "message.db");
+ if (file2.exists()) {
+ serverLog.logWarning("MIGRATION", "message.db already exists in " + sb.workPath + "! Not migrating.");
+ } else {
+ sb.messageDB.close();
+
+ try {
+ serverFileUtils.copy(file, file2);
+ file.delete();
+ } catch (IOException e) {
+ }
+ sb.initMessages((int) sb.getConfigLong("ramCacheMessage", 1024) / 1024);
+ }
}
}