From bc75ea5e1288dd6d3b3cc04ca80bb2473f432250 Mon Sep 17 00:00:00 2001 From: allo Date: Sun, 22 Jan 2006 17:21:46 +0000 Subject: [PATCH] correcting migration 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 --- source/migration.java | 59 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/source/migration.java b/source/migration.java index 63ca88cdb..93a739092 100644 --- a/source/migration.java +++ b/source/migration.java @@ -63,51 +63,38 @@ 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); + 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); } }