|
|
|
@ -9,7 +9,7 @@
|
|
|
|
|
// $LastChangedBy$
|
|
|
|
|
//
|
|
|
|
|
// LICENSE
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
@ -26,6 +26,7 @@
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.NavigableSet;
|
|
|
|
|
import java.util.Set;
|
|
|
|
@ -40,7 +41,6 @@ import net.yacy.peers.operation.yacyBuildProperties;
|
|
|
|
|
import net.yacy.peers.operation.yacyRelease;
|
|
|
|
|
import net.yacy.peers.operation.yacyVersion;
|
|
|
|
|
import net.yacy.search.Switchboard;
|
|
|
|
|
|
|
|
|
|
import de.anomic.server.serverObjects;
|
|
|
|
|
import de.anomic.server.serverSwitch;
|
|
|
|
|
|
|
|
|
@ -62,12 +62,12 @@ public class ConfigUpdate_p {
|
|
|
|
|
} else {
|
|
|
|
|
prop.put("candeploy", "0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prop.put("candeploy_configCommit", "0");
|
|
|
|
|
prop.put("candeploy_autoUpdate", "0");
|
|
|
|
|
prop.put("candeploy_downloadsAvailable", "0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (post != null) {
|
|
|
|
|
// check if update is supposed to be installed and a release is defined
|
|
|
|
|
if (post.containsKey("update") && !post.get("releaseinstall", "").isEmpty()) {
|
|
|
|
@ -77,16 +77,16 @@ public class ConfigUpdate_p {
|
|
|
|
|
prop.put("candeploy", "2"); // display nothing else
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("downloadRelease")) {
|
|
|
|
|
// download a release
|
|
|
|
|
final String release = post.get("releasedownload", "");
|
|
|
|
|
if (!release.isEmpty()) {
|
|
|
|
|
try {
|
|
|
|
|
yacyRelease versionToDownload = new yacyRelease(new DigestURI(release));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// replace this version with version which contains public key
|
|
|
|
|
yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
|
|
|
|
|
final yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
|
|
|
|
|
final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev;
|
|
|
|
|
for (final yacyRelease rel : mostReleases) {
|
|
|
|
|
if (rel.equals(versionToDownload)) {
|
|
|
|
@ -101,7 +101,7 @@ public class ConfigUpdate_p {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("checkRelease")) {
|
|
|
|
|
yacyRelease.allReleases(true, false);
|
|
|
|
|
}
|
|
|
|
@ -117,7 +117,7 @@ public class ConfigUpdate_p {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("autoUpdate")) {
|
|
|
|
|
final yacyRelease updateVersion = yacyRelease.rulebasedUpdateInfo(true);
|
|
|
|
|
if (updateVersion == null) {
|
|
|
|
@ -142,7 +142,7 @@ public class ConfigUpdate_p {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("configSubmit")) {
|
|
|
|
|
prop.put("candeploy_configCommit", "1");
|
|
|
|
|
sb.setConfig("update.process", ("manual".equals(post.get("updateMode", "manual"))) ? "manual" : "auto");
|
|
|
|
@ -152,7 +152,7 @@ public class ConfigUpdate_p {
|
|
|
|
|
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles", false)) ? "1" : "0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// version information
|
|
|
|
|
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
|
|
|
|
|
prop.putHTML("candeploy_versionpp", versionstring);
|
|
|
|
@ -163,18 +163,18 @@ public class ConfigUpdate_p {
|
|
|
|
|
thisVersion = (float) (Math.round(thisVersion*1000.0)/1000.0);
|
|
|
|
|
} catch (final NumberFormatException e) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// list downloaded releases
|
|
|
|
|
final File[] downloadedFiles = sb.releasePath.listFiles();
|
|
|
|
|
// list can be null if RELEASE directory has been deleted manually
|
|
|
|
|
final int downloadedFilesNum = (downloadedFiles == null) ? 0 : downloadedFiles.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prop.put("candeploy_deployenabled", (downloadedFilesNum == 0) ? "0" : ((devenvironment) ? "1" : "2")); // prevent that a developer-version is over-deployed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>();
|
|
|
|
|
for (final File downloaded : downloadedFiles) {
|
|
|
|
|
try {
|
|
|
|
|
yacyRelease release = new yacyRelease(downloaded);
|
|
|
|
|
final yacyRelease release = new yacyRelease(downloaded);
|
|
|
|
|
downloadedReleases.add(release);
|
|
|
|
|
} catch (final RuntimeException e) {
|
|
|
|
|
// not a valid release
|
|
|
|
@ -186,11 +186,11 @@ public class ConfigUpdate_p {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// latest downloaded release
|
|
|
|
|
yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
|
|
|
|
|
final yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
|
|
|
|
|
// check if there are any downloaded releases and if there are enable the update buttons
|
|
|
|
|
prop.put("candeploy_downloadsAvailable", (downloadedReleases.isEmpty()) ? "0" : "1");
|
|
|
|
|
prop.put("candeploy_deployenabled_buttonsActive", (downloadedReleases.isEmpty() || devenvironment) ? "0" : "1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int relcount = 0;
|
|
|
|
|
for(final yacyRelease release : downloadedReleases) {
|
|
|
|
|
prop.put("candeploy_downloadedreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
|
|
|
|
@ -204,29 +204,28 @@ public class ConfigUpdate_p {
|
|
|
|
|
// list remotely available releases
|
|
|
|
|
final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false);
|
|
|
|
|
relcount = 0;
|
|
|
|
|
|
|
|
|
|
// main
|
|
|
|
|
|
|
|
|
|
final ArrayList<yacyRelease> rlist = new ArrayList<yacyRelease>();
|
|
|
|
|
final Set<yacyRelease> remoteDevReleases = releasess.dev;
|
|
|
|
|
remoteDevReleases.removeAll(downloadedReleases);
|
|
|
|
|
for (final yacyRelease release : remoteDevReleases) {
|
|
|
|
|
rlist.add(release);
|
|
|
|
|
}
|
|
|
|
|
final Set<yacyRelease> remoteMainReleases = releasess.main;
|
|
|
|
|
remoteMainReleases.removeAll(downloadedReleases);
|
|
|
|
|
for (final yacyRelease release : remoteMainReleases) {
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_selected", "0");
|
|
|
|
|
relcount++;
|
|
|
|
|
rlist.add(release);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// dev
|
|
|
|
|
dflt = (releasess.dev.isEmpty()) ? null : releasess.dev.last();
|
|
|
|
|
final Set<yacyRelease> remoteDevReleases = releasess.dev;
|
|
|
|
|
remoteDevReleases.removeAll(downloadedReleases);
|
|
|
|
|
for (final yacyRelease release : remoteDevReleases) {
|
|
|
|
|
yacyRelease release;
|
|
|
|
|
for (int i = rlist.size() - 1; i >= 0; i--) {
|
|
|
|
|
release = rlist.get(i);
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? "1" : "0");
|
|
|
|
|
prop.put("candeploy_availreleases_" + relcount + "_selected", (relcount == 0) ? "1" : "0");
|
|
|
|
|
relcount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop.put("candeploy_availreleases", relcount);
|
|
|
|
|
|
|
|
|
|
// properties for automated system update
|
|
|
|
@ -243,7 +242,7 @@ public class ConfigUpdate_p {
|
|
|
|
|
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());
|
|
|
|
|
prop.put("candeploy_onlySignedFiles", ("1".equals(sb.getConfig("update.onlySignedFiles", "1"))) ? "1" : "0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if ((adminaccess) && (yacyVersion.latestRelease >= (thisVersion+0.01))) { // only new Versions(not new SVN)
|
|
|
|
|
if ((yacyVersion.latestMainRelease != null) ||
|
|
|
|
@ -257,12 +256,12 @@ public class ConfigUpdate_p {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
prop.put("hintVersionAvailable", 1); // for testing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prop.putASIS("hintVersionDownload_versionResMain", (yacyVersion.latestMainRelease == null) ? "-" : yacyVersion.latestMainRelease.toAnchor());
|
|
|
|
|
prop.putASIS("hintVersionDownload_versionResDev", (yacyVersion.latestDevRelease == null) ? "-" : yacyVersion.latestDevRelease.toAnchor());
|
|
|
|
|
prop.put("hintVersionAvailable_latestVersion", Float.toString(yacyVersion.latestRelease));
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|