提交 b41112ce 编写于 作者: K kohsuke

On Hudson installed as Windows service, Hudson can now upgrade itself when

    a new version is available.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@12913 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4b40c6fb
......@@ -140,6 +140,7 @@ public class UpdateCenter extends AbstractModelObject {
* Schedules a Hudson upgrade.
*/
public void doUpgrade(StaplerResponse rsp) throws IOException, ServletException {
requirePOST();
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
HudsonUpgradeJob job = new HudsonUpgradeJob();
if(!Lifecycle.get().canRewriteHudsonWar()) {
......@@ -282,6 +283,13 @@ public class UpdateCenter extends AbstractModelObject {
public boolean hasCoreUpdates() {
return core.isNewerThan(Hudson.VERSION);
}
/**
* Do we support upgrade?
*/
public boolean canUpgrade() {
return Lifecycle.get().canRewriteHudsonWar();
}
}
public static class Entry {
......
<!--
Entrance to the configuration page
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout title="${%Manage Hudson}" xmlns:local="local">
<d:taglib uri="local">
<!-- table to show a map -->
......@@ -34,7 +34,14 @@
</j:if>
<j:set var="ucData" value="${it.updateCenter.data}" />
<j:if test="${ucData.hasCoreUpdates()}">
<div class="warning">${%NewVersionAvailable(ucData.core.version,ucData.core.url)}</div>
<div class="warning">
<form method="post" action="${rootURL}/updateCenter/upgrade">
${%NewVersionAvailable(ucData.core.version,ucData.core.url)}
<j:if test="${ucData.canUpgrade()}">
<f:submit value="${%Or Upgrade Automatically}"/>
</j:if>
</form>
</div>
</j:if>
<table style="padding-left: 2em;">
<local:feature icon="setting.gif" href="configure" title="${%Configure System}">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册