diff --git a/src/main/java/org/olat/core/dispatcher/impl/StaticMediaDispatcher.java b/src/main/java/org/olat/core/dispatcher/impl/StaticMediaDispatcher.java index 15c3c16e89860c7adfffb51f2650785743aa58d1..5293c2c9647840e5660a69f7fe98d61d892e7eaf 100644 --- a/src/main/java/org/olat/core/dispatcher/impl/StaticMediaDispatcher.java +++ b/src/main/java/org/olat/core/dispatcher/impl/StaticMediaDispatcher.java @@ -22,6 +22,7 @@ package org.olat.core.dispatcher.impl; import org.olat.core.gui.render.StringOutput; import org.olat.core.helpers.Settings; import org.olat.core.logging.LogDelegator; +import org.olat.core.util.StringHelper; import org.olat.core.util.WebappHelper; /** @@ -98,7 +99,11 @@ public class StaticMediaDispatcher extends LogDelegator { // Add version to make URL change after new release and force browser to // load new static files if (addVersionID) { - target.append(Settings.getBuildIdentifier()); + if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) { + target.append(WebappHelper.getRevisionNumber()).append(":").append(WebappHelper.getChangeSet()); + } else { + target.append(Settings.getBuildIdentifier()); + } } else { target.append(NOVERSION); } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java index c0fd3f4e6bc821805a05e8d9d42d7104e02d79bc..c1905f1a4e79d5cbcdc692e62896189fd21f13db 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java @@ -758,7 +758,6 @@ public class RichTextConfiguration implements Disposable { for (Map.Entry<String, String> entry : copyNonValues.entrySet()) { tinyMenuSb.append(entry.getKey()).append(": ").append(entry.getValue()).append(",\n"); } - System.out.println(tinyMenuSb); out.append(tinyMenuSb); } diff --git a/src/main/java/org/olat/core/helpers/Settings.java b/src/main/java/org/olat/core/helpers/Settings.java index c76122b3a4c23f079b620f87d7effd0eb0583c4c..45e35c869a469e18fc5e6b96e2863094f137b326 100644 --- a/src/main/java/org/olat/core/helpers/Settings.java +++ b/src/main/java/org/olat/core/helpers/Settings.java @@ -137,7 +137,6 @@ public class Settings implements Initializable, Destroyable, GenericEventListene repoRevision = repoRev; } - //fxdiff: get the mercurial changeset Information from the time this release had been built public static String getRepoRevision(){ return repoRevision; } diff --git a/src/main/java/org/olat/core/servlets/StaticServlet.java b/src/main/java/org/olat/core/servlets/StaticServlet.java index 20ee8a9ee8a88a77d4efba25df8579c196d5566b..8126618cfe63b8e003d970b4aebd9bdda19d4feb 100644 --- a/src/main/java/org/olat/core/servlets/StaticServlet.java +++ b/src/main/java/org/olat/core/servlets/StaticServlet.java @@ -33,6 +33,7 @@ import org.olat.core.gui.media.ServletUtil; import org.olat.core.helpers.Settings; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; +import org.olat.core.util.StringHelper; import org.olat.core.util.WebappHelper; /** @@ -82,7 +83,12 @@ public class StaticServlet extends HttpServlet { staticRelPath = pathInfo.substring(NOVERSION.length() + 1, pathInfo.length()); } else { // version provided - remove it - String version = Settings.getBuildIdentifier(); + String version; + if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) { + version = WebappHelper.getRevisionNumber() + ":" + WebappHelper.getChangeSet(); + } else { + version = Settings.getBuildIdentifier(); + } int start = version.length() + 1; int end = pathInfo.length(); if(start <= end) { diff --git a/src/main/java/org/olat/restapi/system/SystemWebService.java b/src/main/java/org/olat/restapi/system/SystemWebService.java index fcd516831d337d8873614ce202daa595d546fa8a..87b3c37f17dd3fe0770affb4e3a6c1a460e35799 100644 --- a/src/main/java/org/olat/restapi/system/SystemWebService.java +++ b/src/main/java/org/olat/restapi/system/SystemWebService.java @@ -35,6 +35,7 @@ import javax.ws.rs.core.Response; import org.olat.core.CoreSpringFactory; import org.olat.core.helpers.Settings; +import org.olat.core.util.StringHelper; import org.olat.core.util.WebappHelper; import org.olat.restapi.system.vo.EnvironmentInformationsVO; import org.olat.restapi.system.vo.ReleaseInfosVO; @@ -104,7 +105,14 @@ public class SystemWebService { } ReleaseInfosVO version = new ReleaseInfosVO(); - version.setBuildVersion(Settings.getBuildIdentifier()); + if(StringHelper.containsNonWhitespace(WebappHelper.getRevisionNumber())) { + String v = WebappHelper.getRevisionNumber() + ":" + WebappHelper.getChangeSet(); + version.setBuildVersion(v); + version.setRepoRevision(v); + } else { + version.setBuildVersion(Settings.getBuildIdentifier()); + version.setRepoRevision(Settings.getRepoRevision()); + } version.setOlatVersion(Settings.getVersion()); version.setInstanceID(WebappHelper.getInstanceId()); return Response.ok(version).build(); diff --git a/src/main/java/org/olat/restapi/system/vo/Examples.java b/src/main/java/org/olat/restapi/system/vo/Examples.java index dbb17b80d6730c988291ec1ea7392a77190b8f06..1f00ea50f2072025db4f89d3b797439e00d49a65 100644 --- a/src/main/java/org/olat/restapi/system/vo/Examples.java +++ b/src/main/java/org/olat/restapi/system/vo/Examples.java @@ -132,10 +132,5 @@ public class Examples { SAMPLE_RELEASEVO.setBuildVersion(""); SAMPLE_RELEASEVO.setOlatVersion(""); SAMPLE_RELEASEVO.setRepoRevision(""); - SAMPLE_RELEASEVO.setAllowAutoPatch(true); - SAMPLE_RELEASEVO.setAllowAutoUpdate(false); - SAMPLE_RELEASEVO.setPatchAvailable(true); - SAMPLE_RELEASEVO.setUpdateAvailable(false); - SAMPLE_RELEASEVO.setUpgradeAvailable(false); } } diff --git a/src/main/java/org/olat/restapi/system/vo/ReleaseInfosVO.java b/src/main/java/org/olat/restapi/system/vo/ReleaseInfosVO.java index 524f412ab0baddf9b8212843aab748ff9b93de60..85ee692d6d0bd9a4f78d24ee6072e384b005332c 100644 --- a/src/main/java/org/olat/restapi/system/vo/ReleaseInfosVO.java +++ b/src/main/java/org/olat/restapi/system/vo/ReleaseInfosVO.java @@ -45,34 +45,10 @@ public class ReleaseInfosVO { private String repoRevision; @XmlAttribute(name="instanceID",required=true) private String instanceID; - @XmlAttribute(name="allowAutoPatch", required=false) - private boolean allowAutoPatch; - @XmlAttribute(name="patchAvailable", required=false) - private boolean patchAvailable; - @XmlAttribute(name="allowAutoUpdate", required=false) - private boolean allowAutoUpdate; - @XmlAttribute(name="updateAvailable", required=false) - private boolean updateAvailable; - @XmlAttribute(name="upgradeAvailable", required=false) - private boolean upgradeAvailable; - public ReleaseInfosVO() { //make JAXB happy } - - public ReleaseInfosVO(String buildVersion, String olatVersion, String repoRevision,String instanceID, boolean allowAutoPatch, boolean patchAvailable, - boolean allowAutoUpdate, boolean updateAvailable, boolean upgradeAvailable) { - this.buildVersion = buildVersion; - this.olatVersion = olatVersion; - this.repoRevision = repoRevision; - this.instanceID = instanceID; - this.allowAutoPatch = allowAutoPatch; - this.allowAutoUpdate = allowAutoUpdate; - this.patchAvailable = patchAvailable; - this.updateAvailable = updateAvailable; - this.upgradeAvailable = upgradeAvailable; - } public String getBuildVersion() { return buildVersion; @@ -105,44 +81,4 @@ public class ReleaseInfosVO { public void setRepoRevision(String repoRevision) { this.repoRevision = repoRevision; } - - public boolean isAllowAutoPatch() { - return allowAutoPatch; - } - - public void setAllowAutoPatch(boolean allowAutoPatch) { - this.allowAutoPatch = allowAutoPatch; - } - - public boolean isPatchAvailable() { - return patchAvailable; - } - - public void setPatchAvailable(boolean patchAvailable) { - this.patchAvailable = patchAvailable; - } - - public boolean isAllowAutoUpdate() { - return allowAutoUpdate; - } - - public void setAllowAutoUpdate(boolean allowAutoUpdate) { - this.allowAutoUpdate = allowAutoUpdate; - } - - public boolean isUpdateAvailable() { - return updateAvailable; - } - - public void setUpdateAvailable(boolean updateAvailable) { - this.updateAvailable = updateAvailable; - } - - public boolean isUpgradeAvailable() { - return upgradeAvailable; - } - - public void setUpgradeAvailable(boolean upgradeAvailable) { - this.upgradeAvailable = upgradeAvailable; - } } \ No newline at end of file diff --git a/src/test/java/org/olat/restapi/SystemTest.java b/src/test/java/org/olat/restapi/SystemTest.java index bf00cdb5d6b6eb668c41d70d53cb3c2a060b3729..240f821dc0759f3e2cd0a00d42f22fb156c0bd3e 100644 --- a/src/test/java/org/olat/restapi/SystemTest.java +++ b/src/test/java/org/olat/restapi/SystemTest.java @@ -316,7 +316,7 @@ public class SystemTest extends OlatJerseyTestCase { } @Test - public void testUpdate() throws IOException, URISyntaxException { + public void testReleaseInfos() throws IOException, URISyntaxException { RestConnection conn = new RestConnection(); assertTrue(conn.login("administrator", "openolat")); @@ -324,8 +324,10 @@ public class SystemTest extends OlatJerseyTestCase { ReleaseInfosVO versionInfos = conn.get(systemUri, ReleaseInfosVO.class); assertNotNull(versionInfos); + assertNotNull(versionInfos.getInstanceID()); assertNotNull(versionInfos.getBuildVersion()); assertNotNull(versionInfos.getOlatVersion()); + assertNotNull(versionInfos.getRepoRevision()); conn.shutdown(); }