onlineupgrade.aspx
上传用户:wenllgg125
上传日期:2020-04-09
资源大小:7277k
文件大小:7k
源码类别:

SCSI/ASPI

开发平台:

Others

  1. <%@ Page language="c#" Inherits="Discuz.Web.Admin.onlineupgrade" Codebehind="onlineupgrade.aspx.cs" %>
  2. <%@ Register TagPrefix="uc1" TagName="PageInfo" Src="../UserControls/PageInfo.ascx" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html>
  5. <head>
  6. <title>在线升级</title>
  7. <link href="../styles/dntmanager.css" type="text/css" rel="stylesheet" />
  8. <script type="text/javascript" src="../js/common.js"></script>
  9. <script type="text/javascript">
  10.     function createDivElement(innerHTML,idName,idValue)
  11.     {
  12.         var divElement = document.createElement("div");
  13.         divElement.innerHTML = innerHTML;
  14.         if(idName != undefined)
  15.         {
  16.             divElement.setAttribute(idName,idValue);
  17.         }
  18.         return divElement;
  19.     }
  20.     function updateversion()
  21.     {
  22.         var print = $("updateinfo");
  23.         print.innerHTML = "";
  24.         var error = false;
  25.         print.appendChild(createDivElement("<b>正在准备升级......</b>"));
  26.         for(var i = 0; i < versionList.length; i++)
  27.         {
  28.             var result = "";
  29.             var link = "<br /><a href='" + versionList[i]["link"] + "' target='_blank' title='下载升级包'>请下载" + versionList[i]["versiondescription"] + "升级包手动进行升级</a>";
  30.             print.appendChild(createDivElement("<b>正在下载升级" + versionList[i]["versiondescription"] + "所需的文件......</b><img id='downupgradefile" + i + "' src='../images/busy.gif' />"));
  31.             result = getReturn('ajaxupgrade.aspx?op=downupgradefile&upgradetype=required&ver=' + versionList[i]["version"]);
  32.             if(result != "")
  33.             {
  34.                 $("downupgradefile" + i).src = "../images/state1.gif";
  35.                 print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  36.                 error = true;
  37.                 break;
  38.             }
  39.             else
  40.             {
  41.                 $("downupgradefile" + i).src = "../images/state2.gif";
  42.             }
  43.             print.appendChild(createDivElement("<b>正在下载" + versionList[i]["versiondescription"] + "升级包......</b><img id='downzip" + i + "' src='../images/busy.gif' />"));
  44.             result = getReturn('ajaxupgrade.aspx?op=downzip&upgradetype=required&ver=' + versionList[i]["version"]);
  45.             if(result != "")
  46.             {
  47.                 $("downzip" + i).src = "../images/state1.gif";
  48.                 print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  49.                 error = true;
  50.                 break;
  51.             }
  52.             else
  53.             {
  54.                 $("downzip" + i).src = "../images/state2.gif";
  55.             }
  56.             print.appendChild(createDivElement("<b>正在解压缩" + versionList[i]["versiondescription"] + "升级包......</b><img id='unzip" + i + "' src='../images/busy.gif' />"));
  57.             result = getReturn('ajaxupgrade.aspx?op=unzip&ver=' + versionList[i]["version"]);
  58.             if(result != "")
  59.             {
  60.                 $("unzip" + i).src = "../images/state1.gif";
  61.                 print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  62.                 error = true;
  63.                 break;
  64.             }
  65.             else
  66.             {
  67.                 $("unzip" + i).src = "../images/state2.gif";
  68.             }
  69.             print.appendChild(createDivElement("<b>正在布署" + versionList[i]["versiondescription"] + "升级包文件......</b><img id='dispose" + i + "' src='../images/busy.gif' />"));
  70.             result = getReturn('ajaxupgrade.aspx?op=dispose&ver=' + versionList[i]["version"]);
  71.             if(result != "")
  72.             {
  73.                 $("dispose" + i).src = "../images/state1.gif";
  74.                 print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  75.                 error = true;
  76.                 break;
  77.             }
  78.             else
  79.             {
  80.                 $("dispose" + i).src = "../images/state2.gif";
  81.             }
  82.             print.appendChild(createDivElement("<b>正在升级" + versionList[i]["versiondescription"] + "版数据库......</b><img id='runsql" + i + "' src='../images/busy.gif' />"));
  83.             result = getReturn('ajaxupgrade.aspx?op=runsql&step=1&ver=' + versionList[i]["version"]);
  84.             if(result != "")
  85.             {
  86.                 $("runsql" + i).src = "../images/state1.gif";
  87.                 print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  88.                 error = true;
  89.                 break;
  90.             }
  91.             else
  92.             {
  93.                 $("runsql" + i).src = "../images/state2.gif";
  94.             }
  95.         }
  96.         if(error)
  97.         {
  98.             print.appendChild(createDivElement("<b style='color:red'>升级失败!</b>"));
  99.         }
  100.         else
  101.         {
  102.             print.appendChild(createDivElement("<b style='color:green'>升级完毕!</b>"));
  103.             document.getElementById("update").style.display = "none";
  104.         }
  105.     }
  106. </script>
  107. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  108. </head>
  109. <body>
  110.     <form id="Form1" runat="server">
  111.     <uc1:PageInfo id="info1" runat="server" Icon="Information"
  112.         Text="您在进行升级之前,&lt;font color='red'&gt;建议备份您的数据库和程序&lt;/font&gt;。升级程序也会为您备份升级前的文件,其文件放置在论坛根目录下cache/upgradebackup目录中。"></uc1:PageInfo>
  113.         <table width="100%">
  114.             <tr>
  115.                 <td style="background:url(../images/update.gif) no-repeat 20px 50%; font-weight:bold; text-indent:80px; height:60px;border-bottom:1px dashed #CCC;">你可以随时检查并更新到最新版本!</td>
  116.             </tr>
  117.             <tr><td style="padding:10px 20px;"><asp:Label ID="info" runat="server" /></td></tr>
  118.             <tr>
  119.                 <td style="padding:10px 20px;">
  120.                     <div id="updateinfo" style="width:800px;height:230px;border: 1px solid rgb(219, 221, 211);padding:5px;overflow:auto;"></div>
  121.                 </td>
  122.             </tr>
  123.             <tr>
  124.                 <td style="padding:10px 20px;">
  125.                     <button<%= isNew?"":" disabled="true"" %> id="update" class="ManagerButton" type="button" onclick="updateversion()"><img src="../images/submit.gif" />立即升级</button>&nbsp;&nbsp;
  126.                     <button id="hotfix" class="ManagerButton" type="button" onclick="window.location='hotfix.aspx'"><img src="../images/submit.gif" />补丁升级</button>
  127.                 </td>
  128.             </tr>
  129.         </table>
  130.         </form>
  131. </body>
  132. </html>