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

SCSI/ASPI

开发平台:

Others

  1. <%@ Page language="c#" Inherits="Discuz.Web.Admin.hotfix" Codebehind="hotfix.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.         var error = false;
  24.             print.appendChild(createDivElement("<b>正在准备升级......</b>"));
  25.             var inputarray = document.getElementsByTagName("input");
  26.         //for(var i = 0; i < inputarray.length; i++)
  27.         for(var i = 0; i < versionList.length; i++)
  28.         {
  29.             for(var j = 0 ; j < inputarray.length ; j++)
  30.             {
  31.                 if(inputarray[j].type == "checkbox" && inputarray[j].checked && inputarray[j].value == versionList[i]["version"])
  32.                 {
  33.                     var result = "";
  34.                     var link = "<br /><a href='" + versionList[i]["link"] + "' target='_blank' title='下载升级包'>请下载" + versionList[i]["versiondescription"] + "升级包手动进行升级</a>";
  35.                     print.appendChild(createDivElement("<b>正在下载升级" + versionList[i]["versiondescription"] + "所需的文件......</b><img id='downupgradefile" + i + "' src='../images/busy.gif' />"));
  36.                     result = getReturn('ajaxupgrade.aspx?op=downupgradefile&upgradetype=optional&ver=' + versionList[i]["version"]);
  37.                     if(result != "")
  38.                     {
  39.                         $("downupgradefile" + i).src = "../images/state1.gif";
  40.                         print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  41.                         error = true;
  42.                         break;
  43.                     }
  44.                     else
  45.                     {
  46.                         $("downupgradefile" + i).src = "../images/state2.gif";
  47.                     }
  48.                     print.appendChild(createDivElement("<b>正在下载" + versionList[i]["versiondescription"] + "升级包......</b><img id='downzip" + i + "' src='../images/busy.gif' />"));
  49.                     result = getReturn('ajaxupgrade.aspx?op=downzip&upgradetype=optional&ver=' + versionList[i]["version"]);
  50.                     if(result != "")
  51.                     {
  52.                         $("downzip" + i).src = "../images/state1.gif";
  53.                         print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  54.                         error = true;
  55.                         break;
  56.                     }
  57.                     else
  58.                     {
  59.                         $("downzip" + i).src = "../images/state2.gif";
  60.                     }
  61.                     print.appendChild(createDivElement("<b>正在解压缩" + versionList[i]["versiondescription"] + "升级包......</b><img id='unzip" + i + "' src='../images/busy.gif' />"));
  62.                     result = getReturn('ajaxupgrade.aspx?op=unzip&ver=' + versionList[i]["version"]);
  63.                     if(result != "")
  64.                     {
  65.                         $("unzip" + i).src = "../images/state1.gif";
  66.                         print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  67.                         error = true;
  68.                         break;
  69.                     }
  70.                     else
  71.                     {
  72.                         $("unzip" + i).src = "../images/state2.gif";
  73.                     }
  74.                     print.appendChild(createDivElement("<b>正在布署" + versionList[i]["versiondescription"] + "升级包文件......</b><img id='dispose" + i + "' src='../images/busy.gif' />"));
  75.                     result = getReturn('ajaxupgrade.aspx?op=dispose&ver=' + versionList[i]["version"]);
  76.                     if(result != "")
  77.                     {
  78.                         $("dispose" + i).src = "../images/state1.gif";
  79.                         print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  80.                         error = true;
  81.                         break;
  82.                     }
  83.                     else
  84.                     {
  85.                         $("dispose" + i).src = "../images/state2.gif";
  86.                     }
  87.                     print.appendChild(createDivElement("<b>正在升级" + versionList[i]["versiondescription"] + "版数据库......</b><img id='runsql" + i + "' src='../images/busy.gif' />"));
  88.                     result = getReturn('ajaxupgrade.aspx?op=runsql&step=1&ver=' + versionList[i]["version"] + "&optional=true");
  89.                     if(result != "")
  90.                     {
  91.                         $("runsql" + i).src = "../images/state1.gif";
  92.                         print.appendChild(createDivElement("<p style='padding:0px 0px 0px 20px;'>升级错误:" + result + link + "</p>"));
  93.                         error = true;
  94.                         break;
  95.                     }
  96.                     else
  97.                     {
  98.                         $("runsql" + i).src = "../images/state2.gif";
  99.                     }
  100.                 }
  101.             }
  102.         }
  103.         if(error)
  104.         {
  105.             print.appendChild(createDivElement("<b style='color:red'>升级失败!</b>"));
  106.         }
  107.         else
  108.         {
  109.             print.appendChild(createDivElement("<b style='color:green'>升级完毕!</b>"));
  110.             document.getElementById("update").style.display = "none";
  111.         }
  112.     }
  113. </script>
  114. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  115. </head>
  116. <body>
  117.     <form id="Form1" runat="server">
  118.     <uc1:PageInfo id="info1" runat="server" Icon="Information"
  119.         Text="您在进行升级之前,&lt;font color='red'&gt;建议备份您的数据库和程序&lt;/font&gt;。升级程序也会为您备份升级前的文件,其文件放置在论坛根目录下cache/upgradebackup目录中。"></uc1:PageInfo>
  120.         <table width="100%">
  121.             <tr>
  122.                 <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>
  123.             </tr>
  124.             <tr><td style="padding:10px 20px;"><asp:Label ID="info" runat="server" /></td></tr>
  125.             <tr>
  126.                 <td style="padding:10px 20px;">
  127.                     <div id="updateinfo" style="width:800px;height:230px;border: 1px solid rgb(219, 221, 211);padding:5px;overflow:auto;"></div>
  128.                 </td>
  129.             </tr>
  130.             <tr>
  131.                 <td style="padding:10px 20px;">
  132.                     <button<%= isNew?"":" disabled="true"" %> id="update" class="ManagerButton" type="button" onclick="updateversion()"><img src="../images/submit.gif" />立即升级</button>
  133.                 </td>
  134.             </tr>
  135.         </table>
  136.         </form>
  137. </body>
  138. </html>