From 129929b3967c34b8e39c9b65e0ed4dd26f3ea57b Mon Sep 17 00:00:00 2001 From: allo Date: Thu, 30 Jun 2005 19:39:19 +0000 Subject: [PATCH] Preparations for automatic Languagefile upgrade on new YaCy Version. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@352 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Language_p.java | 7 +++++++ htroot/Status.html | 2 +- htroot/Status.java | 1 + source/yacy.java | 25 +++++++++++++------------ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/htroot/Language_p.java b/htroot/Language_p.java index a3e84d295..dda5cf7e0 100644 --- a/htroot/Language_p.java +++ b/htroot/Language_p.java @@ -101,6 +101,13 @@ public class Language_p { if(translator.translateFiles(sourceDir, destDir, translationFile, "html")){ env.setConfig("htLocaleSelection", lang.substring(0,lang.length()-4)); + try{ + BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(new File(destDir, "version")))); + bw.write(env.getConfig("svnRevision", "Error getting Version")); + bw.close(); + }catch(IOException e){ + //Error + } return true; } } diff --git a/htroot/Status.html b/htroot/Status.html index 68db2bb21..e7eea28ed 100644 --- a/htroot/Status.html +++ b/htroot/Status.html @@ -34,7 +34,7 @@ Your settings are protected by a password. #(/protection)# System version -#[version]##(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to download it.#(/versioncomment)# +#[version]# (SVN #[svnRevision]#)#(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to download it.#(/versioncomment)# Proxy host#[host]#:#[port]# Port forwarding host#(portForwarding)#not used::#[host]#:#[port]# (#(status)#broken::connected#(/status)#)#(/portForwarding)# diff --git a/htroot/Status.java b/htroot/Status.java index e65e5bedc..84e5b0f29 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -78,6 +78,7 @@ public class Status { prop.put("protection", 1);//protected // version information + prop.put("svnRevision", env.getConfig("svnRevision", "")); if ((yacyCore.latestVersion == null) || (yacyCore.latestVersion.length() < 3) || (yacyCore.latestVersion.equals(env.getConfig("version","")))) prop.put("versioncomment", 0);//no commet else diff --git a/source/yacy.java b/source/yacy.java index 69cdaed4b..2963bb889 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -153,7 +153,6 @@ public final class yacy { sb.setConfig("parseableExt", "html,htm,txt,php,shtml,asp"); // if we are running an SVN version, we try to detect the used svn revision now ... - if (vString.equals("@" + "REPL_VERSION" + "@")) { Properties buildProp = new Properties(); File buildPropFile = null; try { @@ -163,20 +162,22 @@ public final class yacy { System.err.println("ERROR: " + buildPropFile.toString() + " not found in settings path"); } - try { - if (buildProp.containsKey("releaseNr")) { - // this normally looks like this: $Revision: 181 $ - String svnReleaseNrStr = buildProp.getProperty("releaseNr"); - Pattern pattern = Pattern.compile("\\$Revision:\\s(.*)\\s\\$",Pattern.DOTALL+Pattern.CASE_INSENSITIVE); - Matcher matcher = pattern.matcher(svnReleaseNrStr); - if (matcher.find()) { - String svrReleaseNr = matcher.group(1); + try { + if (buildProp.containsKey("releaseNr")) { + // this normally looks like this: $Revision: 181 $ + String svnReleaseNrStr = buildProp.getProperty("releaseNr"); + Pattern pattern = Pattern.compile("\\$Revision:\\s(.*)\\s\\$",Pattern.DOTALL+Pattern.CASE_INSENSITIVE); + Matcher matcher = pattern.matcher(svnReleaseNrStr); + if (matcher.find()) { + String svrReleaseNr = matcher.group(1); + if (vString.equals("@" + "REPL_VERSION" + "@")) { vString = "SVN " + svrReleaseNr; - } + } + sb.setConfig("svnRevision", svrReleaseNr); } - } catch (Exception e) { - System.err.println("Unable to determine the currently used SVN revision number."); } + } catch (Exception e) { + System.err.println("Unable to determine the currently used SVN revision number."); } sb.setConfig("version", vString);