|
|
|
@ -29,7 +29,6 @@ import net.yacy.kelondro.logging.Log;
|
|
|
|
|
import net.yacy.kelondro.order.Base64Order;
|
|
|
|
|
import net.yacy.kelondro.order.Digest;
|
|
|
|
|
import net.yacy.kelondro.util.FileUtils;
|
|
|
|
|
|
|
|
|
|
import de.anomic.search.Switchboard;
|
|
|
|
|
import de.anomic.search.SwitchboardConstants;
|
|
|
|
|
|
|
|
|
@ -54,6 +53,10 @@ public class migration {
|
|
|
|
|
migrateWorkFiles(sb);
|
|
|
|
|
}
|
|
|
|
|
installSkins(sb); // FIXME: yes, bad fix for quick release 0.47
|
|
|
|
|
// add new navigation
|
|
|
|
|
if (sb.getConfig("search.navigation", "").equals("hosts,authors,namespace,topics")) {
|
|
|
|
|
sb.setConfig("search.navigation", "hosts,authors,namespace,topics,filetype,protocol");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* remove the static defaultfiles. We use them through a overlay now.
|
|
|
|
@ -78,7 +81,7 @@ public class migration {
|
|
|
|
|
if(file.exists())
|
|
|
|
|
delete(file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* copy skins from the release to DATA/SKINS.
|
|
|
|
|
*/
|
|
|
|
@ -88,10 +91,10 @@ public class migration {
|
|
|
|
|
if (defaultSkinsPath.exists()) {
|
|
|
|
|
final List<String> skinFiles = FileUtils.getDirListing(defaultSkinsPath.getAbsolutePath());
|
|
|
|
|
mkdirs(skinsPath);
|
|
|
|
|
for (String skinFile : skinFiles){
|
|
|
|
|
for (final String skinFile : skinFiles){
|
|
|
|
|
if (skinFile.endsWith(".css")){
|
|
|
|
|
File from = new File(defaultSkinsPath, skinFile);
|
|
|
|
|
File to = new File(skinsPath, skinFile);
|
|
|
|
|
final File from = new File(defaultSkinsPath, skinFile);
|
|
|
|
|
final File to = new File(skinsPath, skinFile);
|
|
|
|
|
if (from.lastModified() > to.lastModified()) try {
|
|
|
|
|
FileUtils.copy(from, to);
|
|
|
|
|
} catch (final IOException e) {}
|
|
|
|
@ -141,7 +144,7 @@ public class migration {
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
sb.initBookmarks();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
} catch (final IOException e) {
|
|
|
|
|
Log.logException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -165,7 +168,7 @@ public class migration {
|
|
|
|
|
file.delete();
|
|
|
|
|
} catch (final IOException e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file = new File(sb.getDataPath(), "DATA/SETTINGS/wiki-bkp.db");
|
|
|
|
|
if (file.exists()) {
|
|
|
|
|
Log.logInfo("MIGRATION", "Migrating wiki-bkp.db to "+ sb.workPath);
|
|
|
|
@ -173,16 +176,16 @@ public class migration {
|
|
|
|
|
try {
|
|
|
|
|
FileUtils.copy(file, file2);
|
|
|
|
|
file.delete();
|
|
|
|
|
} catch (final IOException e) {}
|
|
|
|
|
} catch (final IOException e) {}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
sb.initWiki();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
} catch (final IOException e) {
|
|
|
|
|
Log.logException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file=new File(sb.getDataPath(), "DATA/SETTINGS/message.db");
|
|
|
|
|
if(file.exists()){
|
|
|
|
|
Log.logInfo("MIGRATION", "Migrating message.db to "+ sb.workPath);
|
|
|
|
@ -194,7 +197,7 @@ public class migration {
|
|
|
|
|
} catch (final IOException e) {}
|
|
|
|
|
try {
|
|
|
|
|
sb.initMessages();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
} catch (final IOException e) {
|
|
|
|
|
Log.logException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -207,7 +210,7 @@ public class migration {
|
|
|
|
|
sb.setConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(acc)));
|
|
|
|
|
sb.setConfig("adminAccount", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fix unsafe old passwords
|
|
|
|
|
if ((acc = sb.getConfig("proxyAccountBase64", "")).length() > 0) {
|
|
|
|
|
sb.setConfig("proxyAccountBase64MD5", Digest.encodeMD5Hex(acc));
|
|
|
|
@ -224,14 +227,14 @@ public class migration {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void migrateSwitchConfigSettings(final Switchboard sb) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// migration for additional parser settings
|
|
|
|
|
String value = "";
|
|
|
|
|
//Locales in DATA, because DATA must be writable, htroot not.
|
|
|
|
|
if(sb.getConfig("locale.translated_html", "DATA/LOCALE/htroot").equals("htroot/locale")){
|
|
|
|
|
sb.setConfig("locale.translated_html", "DATA/LOCALE/htroot");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// migration for blacklists
|
|
|
|
|
if ((value = sb.getConfig("proxyBlackListsActive","")).length() > 0) {
|
|
|
|
|
sb.setConfig("proxy.BlackLists", value);
|
|
|
|
@ -239,16 +242,16 @@ public class migration {
|
|
|
|
|
sb.setConfig("dht.BlackLists", value);
|
|
|
|
|
sb.setConfig("search.BlackLists", value);
|
|
|
|
|
sb.setConfig("surftips.BlackLists", value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb.setConfig("BlackLists.Shared",sb.getConfig("proxyBlackListsShared",""));
|
|
|
|
|
sb.setConfig("proxyBlackListsActive", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// migration of http specific crawler settings
|
|
|
|
|
if ((value = sb.getConfig("crawler.acceptLanguage","")).length() > 0) {
|
|
|
|
|
sb.setConfig("crawler.http.acceptEncoding", sb.getConfig("crawler.acceptEncoding","gzip,deflate"));
|
|
|
|
|
sb.setConfig("crawler.http.acceptLanguage", sb.getConfig("crawler.acceptLanguage","en-us,en;q=0.5"));
|
|
|
|
|
sb.setConfig("crawler.http.acceptCharset", sb.getConfig("crawler.acceptCharset","ISO-8859-1,utf-8;q=0.7,*;q=0.7"));
|
|
|
|
|
}
|
|
|
|
|
sb.setConfig("crawler.http.acceptCharset", sb.getConfig("crawler.acceptCharset","ISO-8859-1,utf-8;q=0.7,*;q=0.7"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|