Skip to content

Commit

Permalink
Preparations for automatic Languagefile upgrade on new YaCy Version.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@352 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Jun 30, 2005
1 parent 664bcec commit 129929b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
7 changes: 7 additions & 0 deletions htroot/Language_p.java
Expand Up @@ -101,6 +101,13 @@ private static boolean changeLang(serverSwitch env, String langPath, String lang

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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion htroot/Status.html
Expand Up @@ -34,7 +34,7 @@ <h2>System, Index and Peer Status</h2>
#(/protection)#
</td></tr>
<tr class="TableCellLight"><td>System version</td><td>
#[version]##(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#
#[version]# (SVN #[svnRevision]#)#(versioncomment)#:: - the latest public version is #[latestVersion]#. Click here to <a href="http://www.yacy.net/yacy/Download.html">download</a> it.#(/versioncomment)#
</td></tr>
<tr class="TableCellDark"><td>Proxy host</td><td>#[host]#:#[port]#</td></tr>
<tr class="TableCellLight"><td>Port forwarding host</td><td>#(portForwarding)#not used::#[host]#:#[port]# (#(status)#broken::connected#(/status)#)#(/portForwarding)#</td></tr>
Expand Down
1 change: 1 addition & 0 deletions htroot/Status.java
Expand Up @@ -78,6 +78,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
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
Expand Down
25 changes: 13 additions & 12 deletions source/yacy.java
Expand Up @@ -153,7 +153,6 @@ private static void startup(String homePath) {
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 {
Expand All @@ -163,20 +162,22 @@ private static void startup(String homePath) {
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);
Expand Down

0 comments on commit 129929b

Please sign in to comment.