Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added options and execution methods for automated updates
orbiterbec4dbc753b4
diff --git a/htroot/ConfigUpdate_p.html b/htroot/ConfigUpdate_p.htmlindex ab8d47cba..9c1a4cd0c 100644--- a/htroot/ConfigUpdate_p.html+++ b/htroot/ConfigUpdate_p.html@@ -3,16 +3,18 @@<head><title>YaCy '#[clientname]#': System Update</title>#%env/templates/metas.template%#- <meta http-equiv="REFRESH" content="30" /></head><body style="margin:0px;">#%env/templates/header.template%##%env/templates/submenuConfig.template%#<h2>System Update</h2>- #(candeploy)#::+ #(candeploy)#+ This servlet can only be used on operation systems that are currently supported for deploy functions.+ If you see this message this means that your operation sytem ist not supported.+ ::<fieldset>- <legend>System Update</legend>+ <legend>Manual System Update</legend><dl><dt>Available Releases</dt><dd><form action="ConfigUpdate_p.html" method="get">@@ -21,10 +23,7 @@<option #(selected)#::selected#(/selected)# value="#[url]#">#[name]#</option>#{/availreleases}#</select>- <button type="submit" name="downloadRelease" value="DownloadRelease">- <img src="/env/grafics/lock.gif" alt="" />- Download Release- </button><br><br>+ <input type="submit" name="downloadRelease" value="DownloadRelease" /></form></dd><dt>Downloaded Releases</dt><dd><form action="Steering.html" method="get">@@ -40,8 +39,54 @@</form></dd></dl></fieldset>++ <form action="ConfigUpdate_p.html" method="get">+ <fieldset>+ <legend>Automated System Update</legend>+ <dl>++ <dt>+ manual update <input type="radio" name="updateMode" value="manual" #(manualUpdateChecked)#::checked="checked" #(/manualUpdateChecked)#/> + </dt>+ <dd>+ no automatic look-up, updates can be made manually using this interface (see options above)<br /><br />+ </dd>++ <dt>+ automatic update <input type="radio" name="updateMode" value="auto" #(autoUpdateChecked)#::checked="checked" #(/autoUpdateChecked)#/> + </dt>+ <dd>+ updates are made within fixed cycles:+ <fieldset>+ <dl>+ <dt>Time beween lookup</dt>+ <dd><input type="text" name="cycle" value="#[cycle]#" size="4" maxlength="4" />hours</dd>+ <dt>Release blacklist</dt>+ <dd><input type="text" name="blacklist" value="#[blacklist]#" size="20" maxlength="20" />(regex on release number strings)</dd>+ <dt>Release type</dt>+ <dd>+ <input type="radio" name="releaseType" value="main" #(releaseTypeMainChecked)#::checked="checked" #(/releaseTypeMainChecked)#/>only main releases + <input type="radio" name="releaseType" value="any" #(releaseTypeAnyChecked)#::checked="checked" #(/releaseTypeAnyChecked)#/>any release including developer releases+ </dd>+ </dl>+ </fieldset>+ </dd>+ <dt><input type="submit" name="configSubmit" value="Submit"></dt>+ <dd>#(configCommit)#::<div class="commit">Accepted Changes.</div>#(/configCommit)#</dd>+ </dl>+ </fieldset>+ </form>++ <fieldset>+ <legend>System Update Statistics</legend>+ <dl>+ <dt>Last System Lookup</dt><dd><p>#(lastlookup)#never::#[time]##(/lastlookup)#</p></dd>+ <dt>Last Release Download</dt><dd><p>#(lastdownload)#never::#[time]##(/lastdownload)#</p></dd>+ <dt>Last Deploy</dt><dd><p>#(lastdeploy)#never::#[time]##(/lastdeploy)#</p></dd>+ </dl>+ </fieldset>#(/candeploy)##%env/templates/footer.template%#</body>-</html>+</html>\ No newline at end of filediff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.javaindex 1c8f9bafa..a4d0d426f 100644--- a/htroot/ConfigUpdate_p.java+++ b/htroot/ConfigUpdate_p.java@@ -26,6 +26,7 @@import java.io.File;import java.io.IOException;+import java.util.Date;import java.util.Iterator;import java.util.TreeSet;@@ -44,6 +45,8 @@ public class ConfigUpdate_p {final serverObjects prop = new serverObjects();final plasmaSwitchboard sb = (plasmaSwitchboard) env;+ prop.put("candeploy_configCommit", 0);+if (post != null) {if (post.containsKey("downloadRelease")) {// download a release@@ -57,79 +60,103 @@ public class ConfigUpdate_p {}}}-++ if (post.containsKey("configSubmit")) {+ prop.put("candeploy_configCommit", 1);+ sb.setConfig("update.process", (post.get("updateMode", "manual").equals("manual")) ? "manual" : "auto");+ sb.setConfig("update.cycle", Math.max(12, post.getLong("cycle", 168)));+ sb.setConfig("update.blacklist", post.get("blacklist", ""));+ sb.setConfig("update.concept", (post.get("releaseType", "any").equals("any")) ? "any" : "main");+ }}-++ // set if this should be visible+ if (serverSystem.canExecUnix) {+ // we can deploy a new system with (i.e.)+ // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy+ prop.put("candeploy", 1);+ } else {+ prop.put("candeploy", 0);+ }+// version information- String versionstring = yacy.combined2prettyVersion(sb.getConfig("version","0.1"));+ String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));prop.put("versionpp", versionstring);boolean devenvironment = versionstring.startsWith("dev");double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));// cut off the SVN Rev in the Versiontry {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}- if (serverSystem.canExecUnix) {- // we can deploy a new system with (i.e.)- // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy- // list downloaded releases- yacyVersion release, dflt;- String[] downloaded = sb.releasePath.list();- prop.put("candeploy", 1);- prop.put("candeploy_deployenabled", (downloaded.length == 0) ? 0 : ((devenvironment) ? 1 : 2)); // prevent that a developer-version is over-deployed+ // list downloaded releases+ yacyVersion release, dflt;+ String[] downloaded = sb.releasePath.list();- TreeSet downloadedreleases = new TreeSet();- for (int j = 0; j < downloaded.length; j++) {- try {- release = (yacyVersion) new yacyVersion(downloaded[j]);- downloadedreleases.add(release);- } catch (RuntimeException e) {- // not a valid release- new File(sb.releasePath, downloaded[j]).deleteOnExit(); // can be also a restart- or deploy-file- }+ prop.put("candeploy_deployenabled", (downloaded.length == 0) ? 0 : ((devenvironment) ? 1 : 2)); // prevent that a developer-version is over-deployed++ TreeSet downloadedreleases = new TreeSet();+ for (int j = 0; j < downloaded.length; j++) {+ try {+ release = (yacyVersion) new yacyVersion(downloaded[j]);+ downloadedreleases.add(release);+ } catch (RuntimeException e) {+ // not a valid release+ new File(sb.releasePath, downloaded[j]).deleteOnExit(); // can be also a restart- or deploy-file}- dflt = (downloadedreleases.size() == 0) ? null : (yacyVersion) downloadedreleases.last();- Iterator i = downloadedreleases.iterator();- int relcount = 0;- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);- prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);- relcount++;- }- prop.put("candeploy_downloadedreleases", relcount);+ }+ dflt = (downloadedreleases.size() == 0) ? null : (yacyVersion) downloadedreleases.last();+ Iterator i = downloadedreleases.iterator();+ int relcount = 0;+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);+ prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);+ relcount++;+ }+ prop.put("candeploy_downloadedreleases", relcount);- // list remotely available releases- TreeSet[] releasess = yacyVersion.allReleases(false); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}- relcount = 0;- // main- TreeSet releases = releasess[(yacy.pro) ? 0 : 2];- releases.removeAll(downloadedreleases);- i = releases.iterator();- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());- prop.put("candeploy_availreleases_" + relcount + "_selected", 0);- relcount++;- }- // dev- dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();- releases = releasess[(yacy.pro) ? 1 : 3];- releases.removeAll(downloadedreleases);- i = releases.iterator();- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());- prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);- relcount++;- }- prop.put("candeploy_availreleases", relcount);- } else {- prop.put("candeploy", 0);+ // list remotely available releases+ TreeSet[] releasess = yacyVersion.allReleases(false); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}+ relcount = 0;+ // main+ TreeSet releases = releasess[(yacy.pro) ? 0 : 2];+ releases.removeAll(downloadedreleases);+ i = releases.iterator();+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());+ prop.put("candeploy_availreleases_" + relcount + "_selected", 0);+ relcount++;+ }+ // dev+ dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();+ releases = releasess[(yacy.pro) ? 1 : 3];+ releases.removeAll(downloadedreleases);+ i = releases.iterator();+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());+ prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);+ relcount++;}+ prop.put("candeploy_availreleases", relcount);++ // properties for automated system update+ prop.put("candeploy_manualUpdateChecked", (sb.getConfig("update.process", "manual").equals("manual")) ? 1 : 0);+ prop.put("candeploy_autoUpdateChecked", (sb.getConfig("update.process", "manual").equals("auto")) ? 1 : 0);+ prop.put("candeploy_cycle", sb.getConfigLong("update.cycle", 168));+ prop.put("candeploy_blacklist", sb.getConfig("update.blacklist", ""));+ prop.put("candeploy_releaseTypeMainChecked", (sb.getConfig("update.concept", "any").equals("any")) ? 0 : 1);+ prop.put("candeploy_releaseTypeAnyChecked", (sb.getConfig("update.concept", "any").equals("any")) ? 1 : 0);+ prop.put("candeploy_lastlookup", (sb.getConfigLong("update.time.lookup", 0) == 0) ? 0 : 1);+ prop.put("candeploy_lastlookup_time", new Date(sb.getConfigLong("update.time.lookup", 0)).toString());+ prop.put("candeploy_lastdownload", (sb.getConfigLong("update.time.download", 0) == 0) ? 0 : 1);+ prop.put("candeploy_lastdownload_time", new Date(sb.getConfigLong("update.time.download", 0)).toString());+ prop.put("candeploy_lastdeploy", (sb.getConfigLong("update.time.deploy", 0) == 0) ? 0 : 1);+ prop.put("candeploy_lastdeploy_time", new Date(sb.getConfigLong("update.time.deploy", 0)).toString());/*if ((adminaccess) && (yacyVersion.latestRelease >= (thisVersion+0.01))) { // only new Versions(not new SVN)diff --git a/htroot/Network.java b/htroot/Network.javaindex 094866d13..47be416d9 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -466,7 +466,7 @@ public class Network {String peertags = serverCodings.set2string(seed.getPeerTags(), ",", false);prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ((peertags == null) || (peertags.length() == 0)) ? "no tags given" : ("tags = " + peertags));}- prop.put(STR_TABLE_LIST + conCount + "_version", yacy.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));+ prop.put(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));prop.put(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-"));prop.put(STR_TABLE_LIST + conCount + "_uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, "0"))));diff --git a/htroot/Status.java b/htroot/Status.javaindex a2c061023..90b8fc7c7 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -154,7 +154,7 @@ public class Status {}// version information- String versionstring = yacy.combined2prettyVersion(sb.getConfig("version","0.1"));+ String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));prop.put("versionpp", versionstring);double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));diff --git a/htroot/Steering.java b/htroot/Steering.javaindex 8c18766f5..c46c7021f 100644--- a/htroot/Steering.java+++ b/htroot/Steering.java@@ -84,7 +84,7 @@ public class Steering {}if (post.containsKey("update")) {- boolean devenvironment = yacy.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");+ boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");String releaseFileName = post.get("releaseinstall", "");File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/" + releaseFileName);if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) {diff --git a/source/de/anomic/data/htmlTools.java b/source/de/anomic/data/htmlTools.javaindex 4249fa82a..ed3b11edb 100644--- a/source/de/anomic/data/htmlTools.java+++ b/source/de/anomic/data/htmlTools.java@@ -95,6 +95,7 @@ public class htmlTools {//patterns that will be replaced. To add new codes or patterns, just put them at the end//of the list. Codes or patterns in this list can not be escaped with [= or <pre>public static final String[] htmlentities={+ "\\", "\", // Backslash"\u005E","^", // Caret"\u0060","`", // Accent Grave `diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex f7c345fb0..fe7b7853e 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -2015,7 +2015,28 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serfor(int i=0;i<deleteQueue.size();++i) yacyCore.seedDB.removePotential((String)deleteQueue.get(i));}-+ // check if update is available and+ // if auto-update is activated perform an automatic installation and restart+ yacyVersion updateVersion = yacyVersion.rulebasedUpdateInfo();+ if (updateVersion != null) try {+ // there is a version that is more recent. Load it and re-start with it+ log.logInfo("AUTO-UPDATE: downloading more recent release " + updateVersion.url);+ yacyVersion.downloadRelease(updateVersion);+ File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/" + updateVersion.name);+ boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");+ if (devenvironment) {+ log.logInfo("AUTO-UPDATE: omiting update because this is a development environment");+ } else if ((!releaseFile.exists()) || (releaseFile.length() == 0)) {+ log.logInfo("AUTO-UPDATE: omiting update because download failed (file cannot be found or is too small)");+ } else {+ yacyVersion.deployRelease(updateVersion.name);+ terminate(5000);+ log.logInfo("AUTO-UPDATE: deploy and restart initiated");+ }+ } catch (IOException e) {+ log.logSevere("AUTO-UPDATE: could not download and install release " + updateVersion.url + ": " + e.getMessage());+ }+// initiate broadcast about peer startup to spread supporter urlif (yacyCore.newsPool.size(yacyNewsPool.OUTGOING_DB) == 0) {// read profile@@ -2035,7 +2056,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements seryacyCore.newsPool.publishMyNews(new yacyNewsRecord(yacyNewsPool.CATEGORY_PROFILE_BROADCAST, news));}}-+// set a maximum amount of memory for the cacheslong memprereq = Math.max(getConfigLong(INDEXER_MEMPREREQ, 0), wordIndex.minMem());// setConfig(INDEXER_MEMPREREQ, memprereq);diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.javaindex d17c05f10..b2829558e 100644--- a/source/de/anomic/yacy/yacyVersion.java+++ b/source/de/anomic/yacy/yacyVersion.java@@ -36,6 +36,8 @@ import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.TreeSet;+import java.util.regex.Matcher;+import java.util.regex.Pattern;import de.anomic.htmlFilter.htmlFilterContentScraper;import de.anomic.http.httpc;@@ -172,6 +174,8 @@ public final class yacyVersion implements Comparator, Comparable {public static final boolean shallRetrieveUpdateInfo() {// according to update properties, decide if we should retrieve update information+ // if true, the release that can be obtained is returned.+ // if false, null is returnedplasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();// check if update process allowes update retrieve@@ -187,21 +191,22 @@ public final class yacyVersion implements Comparator, Comparable {return true;}- public static final yacyVersion shallRetrieveReleaseAutomatically() {+ public static final yacyVersion rulebasedUpdateInfo() {// according to update properties, decide if we should retrieve update information// if true, the release that can be obtained is returned.// if false, null is returned-plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();- // check if update process allowes automatic update retrieve+ // check if update process allowes update retrieveString process = sb.getConfig("update.process", "manual");if (!process.equals("auto")) return null; // no, its a manual or guided process- // check if we have a release info- if ((latestReleases == null) || (latestReleases.size() == 0)) return null; // no info available+ // check if the last retrieve time is a minimum time ago+ long cycle = Math.max(1, sb.getConfigLong("update.cycle", 168)) * 24 * 60 * 60 * 1000;+ long timeLookup = sb.getConfigLong("update.time.lookup", System.currentTimeMillis());+ if (timeLookup + cycle > System.currentTimeMillis()) return null; // no we have recently made a lookup- // check if we know that there is a release that is more recent that that which we are using+ // check if we know that there is a release that is more recent than that which we are usingTreeSet[] releasess = yacyVersion.allReleases(true); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}boolean pro = new File(sb.getRootPath(), "libx").exists();yacyVersion latestmain = (yacyVersion) releasess[(pro) ? 0 : 2].first();@@ -249,12 +254,13 @@ public final class yacyVersion implements Comparator, Comparable {// {promainreleases, prodevreleases, stdmainreleases, stddevreleases}TreeSet[] latestRelease = (TreeSet[]) latestReleases.get(location);if (force ||- (latestRelease == null) ||+ (latestRelease == null) /*||((latestRelease[0].size() == 0) &&(latestRelease[1].size() == 0) &&(latestRelease[2].size() == 0) &&- (latestRelease[3].size() == 0) )) {+ (latestRelease[3].size() == 0) )*/) {latestRelease = allReleaseFrom(location);+ latestReleases.put(location, latestRelease);}return latestRelease;}@@ -388,4 +394,53 @@ public final class yacyVersion implements Comparator, Comparable {serverLog.logSevere("UPDATE", "update failed", e);}}++ /**+ * Converts combined version-string to a pretty string, e.g. "0.435/01818" or "dev/01818" (development version) or "dev/00000" (in case of wrong input)+ *+ * @param ver Combined version string matching regular expression: "\A(\d+\.\d{3})(\d{4}|\d{5})\z" <br>+ * (i.e.: start of input, 1 or more digits in front of decimal point, decimal point followed by 3 digits as major version, 4 or 5 digits for SVN-Version, end of input)+ * @return If the major version is < 0.11 - major version is separated from SVN-version by '/', e.g. "0.435/01818" <br>+ * If the major version is >= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>+ * "dev/00000" - If the input does not matcht the regular expression above+ */+ public static String combined2prettyVersion(String ver) {+ return combined2prettyVersion(ver, "");+ }+ public static String combined2prettyVersion(String ver, String computerName) {+ final Matcher matcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z").matcher(ver);++ if (!matcher.find()) {+ serverLog.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");+ return "dev/00000";+ }++ String mainversion = (Double.parseDouble(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));+ String revision = matcher.group(2);+ for(int i=revision.length();i<5;++i) revision += "0";+ return mainversion+"/"+revision;+ }++ /**+ * Combines the version of YaCy with the versionnumber from SVN to a+ * combined version+ *+ * @param version Current given version.+ * @param svn Current version given from SVN.+ * @return String with the combined version.+ */+ public static double versvn2combinedVersion(double v, int svn) {+ return (Math.rint((v*100000000.0) + ((double)svn))/100000000);+ }++ public static void main(String[] args) {+ float base = (float) 0.53;+ String blacklist = "....[123]";+ String test;+ for (int i = 0; i < 20; i++) {+ test = Float.toString(base + (((float) i) / 1000));+ System.out.println(test + " is " + ((test.matches(blacklist)) ? "blacklisted" : " not blacklisted"));+ }+ }+}diff --git a/source/yacy.java b/source/yacy.javaindex c857ed424..90e530a65 100644--- a/source/yacy.java+++ b/source/yacy.java@@ -160,44 +160,6 @@ public final class yacy {* until startup has finished*/private static serverSemaphore startupFinishedSync = new serverSemaphore(0);-- /**- * Converts combined version-string to a pretty string, e.g. "0.435/01818" or "dev/01818" (development version) or "dev/00000" (in case of wrong input)- *- * @param ver Combined version string matching regular expression: "\A(\d+\.\d{3})(\d{4}|\d{5})\z" <br>- * (i.e.: start of input, 1 or more digits in front of decimal point, decimal point followed by 3 digits as major version, 4 or 5 digits for SVN-Version, end of input)- * @return If the major version is < 0.11 - major version is separated from SVN-version by '/', e.g. "0.435/01818" <br>- * If the major version is >= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>- * "dev/00000" - If the input does not matcht the regular expression above- */- public static String combined2prettyVersion(String ver) {- return combined2prettyVersion(ver, "");- }- public static String combined2prettyVersion(String ver, String computerName) {- final Matcher matcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z").matcher(ver);-- if (!matcher.find()) {- serverLog.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");- return "dev/00000";- }-- String mainversion = (Double.parseDouble(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));- String revision = matcher.group(2);- for(int i=revision.length();i<5;++i) revision += "0";- return mainversion+"/"+revision;- }-- /**- * Combines the version of YaCy with the versionnumber from SVN to a- * combined version- *- * @param version Current given version.- * @param svn Current version given from SVN.- * @return String with the combined version.- */- public static double versvn2combinedVersion(double v, int svn) {- return (Math.rint((v*100000000.0) + ((double)svn))/100000000);- }/*** Starts up the whole application. Sets up all datastructures and starts@@ -294,7 +256,7 @@ public final class yacy {final String svrReleaseNr = matcher.group(1);try {try {version = Double.parseDouble(vString);} catch (NumberFormatException e) {version = (float) 0.1;}- version = versvn2combinedVersion(version, Integer.parseInt(svrReleaseNr));+ version = yacyVersion.versvn2combinedVersion(version, Integer.parseInt(svrReleaseNr));} catch (NumberFormatException e) {}sb.setConfig("svnRevision", svrReleaseNr);}@@ -305,7 +267,7 @@ public final class yacy {}sb.setConfig("version", Double.toString(version));- sb.setConfig("vString", combined2prettyVersion(Double.toString(version)));+ sb.setConfig("vString", yacyVersion.combined2prettyVersion(Double.toString(version)));sb.setConfig("vdate", vDATE);sb.setConfig("applicationRoot", homePath);sb.startupTime = startup;diff --git a/yacy.init b/yacy.initindex ad96d050b..828271248 100644--- a/yacy.init+++ b/yacy.init@@ -86,7 +86,7 @@ update.cycle = 168# a version number blacklist can restrict automatic or guided updates to a specific# range of version numbers. The restriction is done with a blacklist (standard regexpr)# It is recommended to set this list to low developer version numbers-update.blacklist = .\...[123]+update.blacklist = ....[123]# a update can also restricted with a concept property, which can decide if an# update is only valid if it either is a main release or any svn release including new development releases# Valid keywords are 'main' and 'any'