Skip to content

Commit

Permalink
correcting migration
Browse files Browse the repository at this point in the history
warning: if you have wiki*.db or message.db in SETTINGS, your new DBs in WORK will be overwritten
(only in case you replayed a backup, in normal operation you should have the DBs in WORK OR in SETTINGS)


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1407 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Jan 22, 2006
1 parent d6581c4 commit bc75ea5
Showing 1 changed file with 23 additions and 36 deletions.
59 changes: 23 additions & 36 deletions source/migration.java
Expand Up @@ -63,51 +63,38 @@ public static void migrateWorkFiles(plasmaSwitchboard sb){
File file=new File(sb.getRootPath(), "DATA/SETTINGS/wiki.db");
File file2;
if (file.exists()) {
serverLog.logInfo("MIGRATION", "Migrating wiki.db to "
+ sb.workPath);
serverLog.logInfo("MIGRATION", "Migrating wiki.db to "+ sb.workPath);
sb.wikiDB.close();
file2 = new File(sb.workPath, "wiki.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) {
}

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) {
}

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);
} catch (IOException e) {}
}
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);
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);
}
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);
}
}

Expand Down

0 comments on commit bc75ea5

Please sign in to comment.