Upgrade.jsp
38.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.general.MathUtil,weaver.general.GCONST,weaver.general.StaticObj, weaver.system.SysUpgradeCominfo"%>
<%@ page import="weaver.systeminfo.*" %>
<%@ page import="weaver.file.*"%>
<%@ page import="java.net.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.lang.reflect.Field" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.system.UpgradeLoginControl" %>
<html>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="BaseBean" class="weaver.general.BaseBean" scope="page" />
<jsp:useBean id="suc" class="weaver.system.SysUpgradeCominfo" scope="page" />
<link rel="stylesheet" type="text/css" href="/css/Weaver_wev8.css">
<link rel="stylesheet" href="/js/jquery-clockpicker/assets/css/bootstrap.min_wev8.css">
<script src="/js/jquery-clockpicker/assets/js/jquery.min_wev8.js"></script>
<script src="/js/jquery-clockpicker/assets/js/bootstrap.min_wev8.js"></script>
<script type="text/javascript" src="/js/ecology8/lang/weaver_lang_7_wev8.js"></script>
<style type="text/css">
.btnclass {
margin-top:20px!important;
margin-left:0px!important;
margin-bottom:10px;
width:200px;
height:30px;
}
.btnclass {
border:0px;cursor:pointer;
background-color:#558ED5;
color:white;
}
.updating {
font-family:"Microsoft YaHei"!important;
margin:0px 0 0 0!important;
}
#imagediv {
float:left;
}
.updatingnew {
font-family:"Microsoft YaHei"!important;
border:1px solid #DBDBDB;
margin:0px 0 0 0!important;
width:49.7%;
position:relative;
}
.divleft {
float:left;
}
.divright{
float:right;
}
.imagediv {
text-align:center;
}
.divmargin {
margin-top:20px!important;
}
.content {
margin-left:15px;
margin-right:15px;
margin-top:10px;
}
#pro {
float:left
}
.tips{
width:100%;
font-weight:bold;
background-color:#FFFFE0;
border-radius:15px;
height:20px;
}
.operationmsg {
background-color:rgb(255, 243, 220);
border:1px solid;
border-color:rgb(255, 204, 0);
border-radius:3px;
height:200px;
overflow:auto;
width:40%;
margin: 0 auto;
margin-top:20px;
}
.continuebtn{
color:#FFFFFF;
font-size: 14px;
height: 40px;
width: 170px;
background-color:rgb(76, 177, 252);
border: none;
border-radius: 2px;
cursor: pointer;
}
.continuebtn2{
color:#FFFFFF;
font-size: 14px;
height: 40px;
width: 170px;
background-color:rgb(138, 182, 214);
border: none;
border-radius: 2px;
cursor: pointer;
}
.sqlerrormsg {
height:160px;
width:40%;
margin:0 auto;
margin-top:10px;
}
.divmid {
margin: 0 auto;
text-align:center
}
.executesqlmsg {
height:160px;
width:40%;
margin:0 auto;
margin-top:10px;
}
.msgstyle1 {
font-family: 微软雅黑;
font-style: normal;
font-size: 15px;
text-align: center;
line-height: normal;
margin-top:20px;
}
.msgstyle2{
color: #999999;
text-align: center;
font-family: 微软雅黑;
font-style: normal;
font-size: 12px;
margin-top:10px;
}
.msgnote1 {
color:#FF9200;
margin-left:20px;
}
.msgnote2 {
color:#868686;
margin-left:20px;
margin-top:0px;
margin-bottom:0px;
}
html,body{height:100%}
</style>
<script type="text/javascript">
var diag = null;
var timeout = null;
var counter = null;
var countertime = 10;
$(document).ready(function(){
});
function adminLogDialog() {
if(timeout != null) {
clearTimeout(timeout);
}
$("#myModal").modal({backdrop: 'static', keyboard: false});
}
function myrefresh(){
window.location.href="/wui/index.html";
}
function counterFun(id,backupFun){
if(countertime > 0){
var initVal = $("#"+id).val();
var reg = new RegExp('\\(.*S\\)');
if(initVal.match(reg)){
initVal = initVal.replace(reg, "("+countertime+"S)");
$("#"+id).val(initVal);
} else {
$("#"+id).val(initVal+"("+countertime+"S)");
}
$("#"+id).removeClass("continuebtn");
$("#"+id).addClass("continuebtn2");
countertime--;
} else {
$("#"+id).removeClass("continuebtn2");
$("#"+id).addClass("continuebtn");
//删除计数器
clearInterval(counter);
//重置计数器
countertime = 10;
//根据函数名得到函数类型
var func=eval(backupFun);
//创建函数对象,并调用
new func();
}
}
</script>
<body style="height:100%;width:100%;">
<jsp:include page="upgradeCheck.jsp"/>
<div id="viewdiv" style="margin:0 auto!important;width:100%!important;height:100%!important;position:relative;">
<div class="titleclass" style="margin:0 auto;width:80%;font-size:16px;color:white;height:30px;line-height:30px;"> </div>
<%
//免登录
String checklevel = request.getParameter("checklevel");
if("0".equals(checklevel)) {
request.getSession(true).setAttribute("weaver_uadminLogin","1") ;
}
//判断resin版本
//防止低版本覆盖高版本升级工具之后 找不到isHigherResin3变量报错
try {
Class<?> classInstance=null;
classInstance=Class.forName("weaver.system.SysUpgradeCominfo");
Field field = classInstance.getField("isHigherResin3");
Boolean isHigherResin3 = (Boolean)field.get(classInstance);
//field = classInstance.getField("checkClusterMain");
//Boolean checkClusterMain = (Boolean)field.get(classInstance);
//判断resin版本
if(isHigherResin3 != true) {
response.sendRedirect("/login/UpgradeMessage.jsp?error=resin");
return;
}
//判断升级前的数据库字符集
field = classInstance.getField("rightDBCharset");
Boolean rightDBCharset = (Boolean)field.get(classInstance);
if(rightDBCharset != true) {
response.sendRedirect("/login/UpgradeMessage.jsp?error=dbcharset");
return;
}
//判断是否非集群 或者集群主节点 --与安全补丁包冲突,不在页面拦截 只在日志输出
/* if(checkClusterMain != true) {
response.sendRedirect("/login/UpgradeMessage.jsp?error=clustermain");
return;
} */
//判断数据库版本
//数据库版本过低(SQLServer2000),无法升级逻辑无法执行,也无法登录系统;请先升级数据库版本。
field = classInstance.getField("checkDBVersion");
Boolean checkDBVersion = (Boolean)field.get(classInstance);
if(checkDBVersion != true) {
response.sendRedirect("/login/UpgradeMessage.jsp?error=dbversion");
return;
}
}catch(Exception e) {
}
boolean adminDoLogin = false;
String adminlogin = (String)request.getSession(true).getAttribute("weaver_uadminLogin") ;
if(adminlogin == null || !"1".equals(adminlogin) || "null".equals(adminlogin)) {
adminDoLogin = false;
} else {
adminDoLogin = true;
}
int pagestatus = 999;
int status = 999;
int checklev = 1;
int checkadmin=1;
int skipsqlerror = 1;
Properties prop = new Properties();
FileInputStream fis = new FileInputStream(GCONST.getRootPath() +"WEB-INF"+ File.separatorChar
+ "prop" + File.separatorChar+"ecologyupdate.properties");
prop.load(fis);
checklev=Util.getIntValue(prop.getProperty("checklevel"),1);
fis = new FileInputStream(GCONST.getRootPath() +"WEB-INF"+ File.separatorChar
+ "prop" + File.separatorChar+"upgradesetting.properties");
prop.load(fis);
skipsqlerror = Util.getIntValue(prop.getProperty("skipsqlerror"),1);
checkadmin=Util.getIntValue(prop.getProperty("checkadmin"),1);
//重新赋值一次 开始
//if(SysUpgradeCominfo.pStatus != pagestatus) {
// SysUpgradeCominfo.pStatus = pagestatus;
//}
//if(SysUpgradeCominfo.status != status) {
// SysUpgradeCominfo.status = status;
//}
//重新赋值一次 结束
String hostaddr = suc.hostaddr;
String returnval = "";
HashMap<String,String> infomap = suc.getUpgadeInfoMap();
String errormsg = infomap.get("errormsg");//脚本报错信息
String executesql = infomap.get("executesql");//正在执行的脚本
String dburl = infomap.get("dburl");//数据库地址
String dbname = Util.null2String(infomap.get("dbname"));//数据库名称
String currentfile = infomap.get("currentfile");//已执行脚本数量
String totalfile = infomap.get("totalfile");//脚本总数
String runningfilename = infomap.get("runningfilename");//正在执行的脚本
String percent = infomap.get("percent");//脚本执行进度
String threadruning = infomap.get("threadruning"); //脚本线程是否在执行
String continueflag = infomap.get("continueflag");//是否点击继续
String upgradepackage = infomap.get("upgradepackage");//是否点击继续
String deployMonitor = ""+SysUpgradeCominfo.deployMonitor;//是否部署运维平台
String forwardurl = "http://"+hostaddr+":9081";
String upgradetype = ""+SysUpgradeCominfo.upgradetype;
pagestatus=Util.getIntValue(infomap.get("pagestatus"),0);
status=Util.getIntValue(infomap.get("status"),0);
String skipnote = "";
String dbmsg ="";
/* if(rs.getDBType().toLowerCase().equals("oracle"))
dbmsg="当前系统的数据库地址:"+dburl+","+dbname.replace("用户名","用户名")+",请确认是否正确";
else*/
dbmsg="当前系统的数据库地址:"+dburl+dbname+",请确认是否正确";
if(dbname == null || "".equals(dbname)) {
if(dburl != null && !"".equals(dburl)) {
dbmsg = "当前系统的数据库地址:"+dburl+",请确认是否正确";
} else {
dbmsg = "请确认数据库地址是否正确";
}
}
String sqlmsg = "";
if(!"".equals(runningfilename)) {
sqlmsg = "正在执行"+runningfilename+",共"+totalfile+"个,已执行"+currentfile+"个";
}
if(errormsg != null) {
errormsg = errormsg.replace("<br>","\r\n");
errormsg = errormsg.replace("java.sql.SQLException:","");
errormsg = errormsg.replace("ORA-","MSG-");
}
//跳包
String tablestr = "";
if(2 == pagestatus) {
String ecologyuplistsql = "";
String dbtype = rs2.getDBType();
if(dbtype.equalsIgnoreCase("MYSQL")) {
ecologyuplistsql = "select * from ecologyuplist where id in (select min(id) as id from ecologyuplist group by label ) order by label desc limit 0,5";
} else if(dbtype.equalsIgnoreCase("ORACLE")) {
ecologyuplistsql = "select * from (select * from ecologyuplist WHERE id in (select min(id) as id from ecologyuplist group by label ) order by label desc) where ROWNUM<= 5";
} else {
ecologyuplistsql = "select TOP 5 * from ecologyuplist where id in (select min(id) as id from ecologyuplist group by label ) order by label desc";
}
rs2.execute(ecologyuplistsql);
while(rs2.next()) {
tablestr = tablestr + "<tr>";
tablestr = tablestr + "<td style=\"text-align:left\">"+rs2.getString("label")+"</td>";
tablestr = tablestr + "<td style=\"text-align:left\">"+rs2.getString("versionNo")+"</td>";
tablestr = tablestr + "</tr>";
}
%>
<%if(adminDoLogin) { %>
<div style="margin:0 auto;width:80%">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/error.png"><br/><br/>
<span class="msgstyle1" style="">升级跳包,升级终止。 <a href="javascript:openPackageInfo()">请点击此处查看详情</a></span>
<br/>
</div>
<br/>
<div class="operationmsg" style="height:100px!important;font-size: 12px;color:#FF9200;width:550px;">
<img src="/wui/theme/ecologyBasic/skins/default/rightbox/userlog_warning_wev8.gif" style="width:20px;vertical-align:middle;line-height:30px!important;"></img>
<span style="color:#FF9200;line-height:30px!important;vertical-align:middle;">请检查并确认上述遗漏包是否属于误报或可忽略,如果可以忽略,请点击“继续”按钮继续升级。</span><br>
<span style="width:20px;vertical-align:middle;line-height:30px!important;"> </span>
<span style="color:#FF9200;line-height:30px!important;vertical-align:middle;">如果遗漏包不可忽略,请关闭页面取消此次升级,并依次覆盖遗漏包文件,重新升级。</span><br>
<span style="width:20px;vertical-align:middle;line-height:30px!important;"> </span>
<span style="color:#FF9200;line-height:30px!important;vertical-align:middle;">切勿直接使用其他客户的补丁包进行升级!</span>
</div>
<div class="divmid continuebtn divmargin" style=""><input class="continuebtn" type="button" onclick="operationConfirm(1,'请确定您已检查升级的跳包的情况,确认后将继续进行升级');" value="继续" style="width:100%;height:100%"></div></div>
</div>
</div>
<%} else {%>
<div class="divcenter" style="margin:0 auto;width:80%">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
系统正在更新,请稍后登录
</p>
</div>
<div <div class="divmid">
<a href="javascript:adminLogDialog()" style="color:#4D7AD8;">管理员请点击这里进行升级操作</a>
</div>
</div>
<%}%>
<%} else {//非跳包
if(0 == status) {//系统正常
%>
<%if(adminDoLogin) { %>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.gif"><br/><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
升级中...
</p>
</div>
<%} else { %>
<div class="divcenter" style="margin:0 auto;width:80%">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
系统正在更新,请稍后登录
</p>
</div>
<div <div class="divmid">
<a href="javascript:adminLogDialog()" style="color:#4D7AD8;">管理员请点击这里进行升级操作</a>
</div>
</div>
<%} %>
<%} else if(1 == status) {//脚本报错
%>
<%if(adminDoLogin) { %>
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/error.png"><br/><br/>
<span class="msgstyle1" style="">升级不成功,升级脚本错误</span>
<br/>
</div>
<div class="msgstyle2" style="text-align:center;">错误详情(<a href="javascript:showSQLError()"><%=infomap.get("errorlog") %></a>)如下:</div>
<div class="sqlerrormsg" style="">
<textarea style="width:99%;height:100%;overflow:auto"><%=errormsg %></textarea>
</div>
<div class="operationmsg" style="line-height: 20px">
<div style="margin:0 auto;line-height:20px;height:20px!important;margin-top:5px;margin-bottom:5px;">
<img src="/wui/theme/ecologyBasic/skins/default/rightbox/userlog_warning_wev8.gif" style="width:20px;vertical-align:middle;"></img>
<span style="color:#FF9200;line-height:20px!important;vertical-align:middle;font-weight:bold">错误处理:</span>
</div>
<%if("true".equals(deployMonitor)&&"0".equals(upgradetype)){ %>
<span class="msgnote1">可以使用运维平台升级,<a href="javascript:forward2Monitor();" style="color:rgb(0, 0, 255)" type="button">点击这里切换至运维平台</a></span><br>
<%} %>
<span class="msgnote1">请检查脚本,如果脚本是以下报错,则可忽略错误,<a id="conbtn" href="javascript:operationConfirm(2,'请确认您已经查看错误日志,已核实该SQL语句可以直接跳过');" style="color:rgb(0, 0, 255)" type="button">点击这里继续执行</a></span><br>
<span class="msgnote1">1、数据库中已存在这个表或视图;</span><br>
<span class="msgnote1">2、数据库中字段已存在;</span><br>
<p class="msgnote2">如果不是以上情况,请确认错误是否可忽略;如果不能忽略,请将错误的脚本手动修改完成后,手动在数据库中执行,并将该SQL脚本拷贝到“/ecology/data”目录下,完成后重启服务继续升级。</p>
<p class="msgnote2">如果忽略了某些错误,使脚本继续执行,请将该脚本提交到泛微项目/客服人员,由泛微技术部进行审核确认。</p>
</div>
<%} else {%>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/error.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
升级不成功,升级脚本错误
</p>
</div>
<div class="divmid">
<a href="javascript:adminLogDialog()" style="color:#4D7AD8;">管理员请点击这里查看详细情况</a>
</div>
</div>
<%}%>
<%} else if(2 == status) {
if(2 == pagestatus) {//跳包%>
<% } else {//正在升级%>
<%if(adminDoLogin) { %>
<%if("true".equals(threadruning) && !"".equals(runningfilename)){ %>
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.gif"><br/><br/>
<span class="msgstyle1" style="color:#7ed321;font-size:20px;font-weight:bold;"><%=percent %></span>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;"><%=sqlmsg %></p>
</div>
<%if(executesql != null && !"".equals(executesql)){ %>
<div class="msgstyle2" style="text-align:center;">正在执行的sql语句</div>
<div class="executesqlmsg" style="">
<textarea style="width:99%;height:100%;overflow:auto"><%=executesql %></textarea>
</div>
<%} %>
<%} else {%>
<%if(!"true".equals(continueflag)) { %>
<div style="margin:0 auto;width:80%">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/error.png"><br/><br/>
<span class="msgstyle1" style="">升级过程中服务器异常中止或者重启了Resin服务,请停止服务,并手动修改/WEB-INF/prop/Upgrade.properties的status值为0。<br>也可点击“继续”按钮进行升级。</span>
</div>
<div class="divmid continuebtn divmargin" style=""><input class="continuebtn" type="button" onclick="operationConfirm(5,'重置Upgrade.properties状态');" value="继续" style="width:100%;height:100%"></div></div>
</div>
</div>
<%} else {%>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.gif"><br/><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
升级中...
</p>
</div>
<%}%>
<%}%>
<%} else {%>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.png"><br/><br/>
<%if("true".equals(threadruning)){ %>
<span class="msgstyle1" style="color:#7ed321;font-size:20px;font-weight:bold;"><%=percent %></span><br>
<%} %>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
系统正在更新,请稍后登录
</p>
</div>
<div <div class="divmid">
<a href="javascript:adminLogDialog()" style="color:#4D7AD8;">管理员请点击这里查看详细情况</a>
</div>
</div>
<%}%>
<%
}
} else if(4 == status) {//数据库地址确认页面
%>
<%if(adminDoLogin) { %>
<script type="text/javascript">
$(document).ready(function(){
$("#dbconfirm").attr("disabled","disabled");
counter = setInterval("counterFun('dbconfirm','confirmDone1')",1000);
});
function confirmDone1() {
$("#dbconfirm").attr("disabled",false);
$("#dbconfirm").val("继续");
}
</script>
<div style="margin:0 auto;width:80%;vertical-align:middle;text-align: center;">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
<%=dbmsg %>
<br>
如果错误请修改后重启服务,如果正确请点击“继续”进行升级
</p>
<div class="operationmsg" style="height:120px!important;font-size: 12px;color:#FF9200;width:500px;">
<span class="msgnote1" style="float:left;">
<img src="/wui/theme/ecologyBasic/skins/default/rightbox/userlog_warning_wev8.gif" style="width:20px;vertical-align:middle;line-height:30px!important;"></img>
<span style="width:20px;vertical-align:left;line-height:30px!important;">重要提示</span>
</span><br><br>
<span class="msgnote1" style="float:left;text-align: left;">1.请确认Ecology应用和数据库已备份(停止ecology服务的情况下备份)!</span><br>
<span class="msgnote1" style="float:left;text-align: left;">2.如果数据库连接错误,将导致脚本执行到其他数据库,请认真检查!</span><br>
<span class="msgnote1" style="float:left;text-align: left;">3.请确认补丁包已经在测试环境测试通过(特别是版本/KB升级补丁包)!</span>
<span class="msgnote1" style="float:left;text-align: left;">4.升级完成后请先使用管理员账号登录,确认升级信息!</span>
</div>
<div class="divmid continuebtn divmargin" style=""><input class="continuebtn" id="dbconfirm" onclick="backupComfirm()" type="button" value="继续" style="width:100%;height:100%"></div></div>
</div>
<%} else {%>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
系统正在更新,请稍后登录
</p>
</div>
<div <div class="divmid">
<a href="javascript:adminLogDialog()" style="color:#4D7AD8;">管理员请点击这里进行升级操作</a>
</div>
</div>
<%}%>
<%
} else if(3 == status){
%>
<div class="divcenter" style="margin:0 auto;width:80%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/error.png"><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
升级不成功,请联系供应商
</p>
</div>
</div>
<%
} else {%>
<div class="divcenter" style="margin:0 auto;width:80%;height:100%;display:none">
<div class=updating style="text-align:center;font-size:20px;"><img src="/wui/theme/ecology9/image/upgrade/upgrading.gif"><br/><br/>
<p style="font-size:14px;font-family: 微软雅黑;font-weight: 400;font-style: normal;">
升级中...
</p>
<br/>
</div>
<%}
}
//判断是否存在脚本,如果脚本不存在了,自动还原文件状态
if(0!=status || 0!=pagestatus) {
boolean isSQLexists = suc.isSQLExists();
if(!isSQLexists) {
suc.ChangeProp("0","",0,0,"","");
}
}
%>
</div>
<script type="text/javascript" src="/js/rsa/jsencrypt.js"></script>
<script type="text/javascript" src="/js/rsa/rsa.js"></script>
<script type='text/javascript'>
function adminLogDialog() {
if(timeout != null) {
clearTimeout(timeout);
}
if("<%=checkadmin%>"==0){
window.location.href = "Upgrade.jsp?checklevel=0";
return;
}
$("#myModal").modal({backdrop: 'static', keyboard: false});
}
var checklevel = "<%=checklev%>";
var pstatus = "<%=pagestatus%>";
var skipsqlerror = "<%=skipsqlerror%>";
var status = "<%=status%>";
var time = 5000;
var canloginchoice=10;
if(pstatus=="2"&&checklevel!="0") {
$("#conbtn").css("display","none");
$(".conmessage").css("display","none");
}
//脚本报错不控制显示继续按钮
if(status==1 && skipsqlerror == 0) {
$("#conbtn").css("display","none");
}
if(status==1) {
time = 10000;//指定10秒刷新一次
} else if(status==4) {
time = 10000000;//指定10000秒刷新一次
}
var URL = "/login/UpgradeAdminLoginOperation.jsp?requesttype=1&time="+new Date()+"";
var isconn = false;
var showdialog = false;
/* if("0" != status) {
try {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",URL, false);
xmlhttp.send(null);
var result = xmlhttp.status;
if(result==200) {
isconn = true;
var response_flag = xmlhttp.responseText;
if(response_flag!='0') {
var flag_msg = '';
if(response_flag=='1') {
$("#myModal").modal();
showdialog = true;
//return false;
} else if(response_flag=='2') {
flag_msg = 'error';
}
}
}
} catch(e) {
}
}
if(!showdialog) {
timeout = setTimeout('myrefresh()',time);
} */
timeout = setTimeout('myrefresh()',time);
function checkall(){
var i=0;
var j=0;
var errMessage="";
if(form1_login.username.value=="") {
errMessage=errMessage+"请输入用户名";i=i+1;
}
if(form1_login.password.value=="") {
if(i <= 0) {
if(errMessage != "") {
errMessage=errMessage+"、密码\n";
} else {
errMessage=errMessage+"请输入密码\n";
}
}
j=j+1;
}
if(i>0) {
$("#msg_show").html(errMessage);
form1_login.username.focus();
return false ;
} else if(j>0){
$("#msg_show").html(errMessage);
form1_login.password.focus();
return false ;
}
//提交
var tusername = form1_login.username.value;
var tpassword = form1_login.password.value;
var timestamp=new Date().getTime();
<%
BaseBean bean=new BaseBean();
String isrsaopen = Util.null2String(bean.getPropValue("openRSA","isrsaopen"));
if("1".equals(isrsaopen)){
%>
tpassword=__RSAEcrypt__.rsa_data_encrypt(tpassword);
<%}%>
$("#msg_show").html("正在验证,请稍等...");
$.ajax({
url:"/login/UpgradeAdminLoginOperation.jsp?v="+timestamp,
type:"post",
datatype:"json",
data:{
username:tusername,
password:tpassword
},
success:function(data){
var obj=JSON.parse(data);
var loginstatus=obj.loginstatus;
var flag=obj.flag;
var count=obj.count;
var choices=obj.canloginchoice;
if(choices>0){
canloginchoice=choices;
}
if(loginstatus==2){
checkall_callback(flag);
}else{
checkall_callback1(flag,count);
}
}
});
}
//ajax验证用户登录回调函数原先的逻辑
function checkall_callback(databack){
var message = databack;//后台返回的信息
if(message == "0") {
parent.window.location.reload();
} else if(message == "2"){
$("#msg_show").html("该账号无权限!");
}else {//表示用户名或密码不正确
$("#msg_show").html("账号或密码不正确!");
}
}
//ajax验证用户登录回调函数
function checkall_callback1(flag,count){
var message = flag;//后台返回的信息
var logincount=count;
if(logincount==undefined){
logincount=canloginchoice;
}
if(message == "0") {
parent.window.location.reload();
} else if(message == "2"){
$("#msg_show").html("该账号无权限!");
} else if(message == "4"){
$("#msg_show").html("账户已被锁定,请联系管理员进行解锁");
$("#username").attr("disabled",true);
$("#password").attr("disabled",true);
$("#get_focus").attr("disabled",true);
}else {//表示用户名或密码不正确
var canlogin=canloginchoice-logincount;
if(canlogin<=0){
canlogin=1;
}
if(canlogin>=canloginchoice){
canlogin=canloginchoice-1;
}
$("#msg_show").html("账号或密码不正确!还剩"+canlogin+"次机会");
}
}
//确认信息
function operationConfirm(fun1,msg) {
$("#divmsg").html(msg);
var clicktag = 0;
$("#confirmbtn").bind("click", function(e) {
if (clicktag == 0) {
clicktag = 1;
if("1" == fun1) {
continueExcute(1);
} else if("2" == fun1) {
continueExcute(2);
} else if("3" == fun1) {
continueExcute(3);
} else if("4" == fun1) {
continueExcute(4);
} else {
continueExcute(fun1);
}
setTimeout(function() {
clicktag = 0;
}, 500);
} else {
alert("请勿频繁点击!");
}
})
if(timeout != null) {
clearTimeout(timeout);
}
$("#confirmModal").modal();
}
//取消按钮
function cancelbtn() {
$("#confirmModal").modal('hide');
//window.location.reload();
}
function backupComfirm() {
$("#confirmModal").modal("hide");
$("#backupModal").modal();
}
function backupCheck() {
var allchecked = true;
var backupItems = $("input[name='backupitem']");
var backupCheckedItems = $("input[name='backupitem']:checked");
if(backupItems.length != backupCheckedItems.length) {
allchecked = false;
}
/*backupItems.each(function(){
console.log($(this).attr("checked"));
if($(this).attr("checked") == true || $(this).attr("checked") == "checked") {
} else {
allchecked = false;
return false;
}
});*/
if(allchecked) {
operationConfirm(4,'确认已检查数据库/应用已备份、数据库连接地址正确,开始执行脚本?');
} else {
$("#modalMsg").html("部分数据库信息未确认,请确认!");
$("#msgModal").modal();
}
}
//跳转到运维平台
function forward2Monitor() {
window.open("<%=forwardurl%>");
<%
SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat hm = new SimpleDateFormat("HH:mm");
Date now = new Date();
String createdate = ymd.format(now);
String createtime = hm.format(now);
rs.execute("select * from monitorguidelog");
if(rs.next()) {
rs.execute("update monitorguidelog set createdate='"+createdate+"',createtime='"+createtime+"',status='1'");
} else {
rs.execute("insert into monitorguidelog(createdate,createtime,status) values ('"+createdate+"','"+createtime+"','1')");
}
%>
}
$(document).ready(function(){
setPosition();
<%
OrderProperties prop1=new OrderProperties();
String filepath1=GCONST.getRootPath() +"WEB-INF"+ File.separatorChar+ "prop" + File.separatorChar+"upgradeloginsetting.properties";
prop1.load(filepath1);
String loginstatus=Util.null2String(prop1.getProperty("loginstatus"));
String canloginchoice=Util.null2String(prop1.getProperty("canloginchoice"));
if(canloginchoice.equals("")){
prop1.put("canloginchoice","10");
prop1.put("loginstatus","0");
loginstatus="0";
prop1.store(prop1,filepath1);
}else{
%>
canloginchoice=<%=canloginchoice%>
<%
}
if("".equals(loginstatus)){
}else if("1".equals(loginstatus)){
%>
$("#msg_show").text("账户已被锁定,请联系管理员进行解锁");
$("#username").attr("disabled",true);
$("#password").attr("disabled",true);
$("#get_focus").attr("disabled",true);
<%
}
%>
<%if(adminDoLogin) { %>
if(pstatus=="2") {
$("#conbtn").css("display","none");
$(".conmessage").css("display","none");
openPackageInfo();
}
<%}%>
});
$(window).resize(function(){
setPosition();
});
function setPosition() {
//var elediv = $(".divcenter");
//$(".divcenter").css("top", ($(document).height() - elediv.height()) / 2 + $(document).scrollTop() + "px");
//$(".divcenter").css("left", ($(document).width() - elediv.width()) / 2 + $(document).scrollLeft() + "px");
//$(".divcenter").css("position","absolute");
$(".divcenter").css("display","");
}
function closeloginpanel() {
window.location.reload();
}
function openPackageInfo() {
if(timeout != null) {
clearTimeout(timeout);
}
$("#packageModal").modal();
}
//取消按钮
function packageInfo_cancelbtn() {
$("#packageModal").modal('hide');
//window.location.reload();
}
function backup_cancelbtn(){
$("#backupModal").modal('hide');
}
function msgConfirm() {
$("#msgModal").modal("hide");
}
function msgCancel() {
$("#msgModal").modal("hide");
}
</script>
<!-- 模态框(Modal) -->
<center>
<form method="post" action="" class="form-horizontal" role="form" id="form1_login">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" style="width: 600px;">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="closeloginpanel()">
×
</button>
<div class="modal-header text-left">
<span class="glyphicon glyphicon-cog"></span>系统管理员登录
</div>
<div class="modal-body">
<div class="operationmsg" style="height:32px!important;font-size: 12px;color:#FF9200;width:400px;margin-top:0px!important;margin-bottom:20px!important;">
<img src="/wui/theme/ecologyBasic/skins/default/rightbox/userlog_warning_wev8.gif" style="width:20px;vertical-align:middle;line-height:30px!important;"></img>
<span style="color:#FF9200;line-height:30px!important;vertical-align:middle;" id="msg_show">请输入管理员账号信息登录后查看,非管理员不可操作</span><br>
</div>
<div class="form-group">
<label class="col-xs-offset-1 col-xs-2 control-label" for="username">用户名</label>
<div class="col-xs-7"><input class="form-control" name="username" type="text" id="username"></div>
</div>
<div class="form-group">
<label class="col-xs-offset-1 col-xs-2 control-label" for="password">密 码</label>
<div class="col-xs-7"><input class="form-control" name="password" id="password" type="password" style="width:100%;" onkeydown="if(event.keyCode == 13){checkall();}"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="get_focus" class="btn btn-primary" onclick="checkall()">确 定</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
</form>
</center>
<center>
<div class="modal fade" id="backupModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" style="width: 600px;">
<div class="modal-content" style="height: 280px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="backup_cancelbtn()">
×
</button>
<div class="modal-header text-left">
<span class="glyphicon glyphicon-warning-sign"></span> 重要提示
</div>
<div style="height: 150px;margin-left: 10px;margin-right: 15px">
<span class="msgnote1" style="float:left;text-align: left;"><input type="checkbox" name="backupitem">1.请确认Ecology应用和数据库已备份(停止ecology服务的情况下备份)!</span><br>
<span class="msgnote1" style="float:left;text-align: left;"><input type="checkbox" name="backupitem">2.<%=dbmsg %>!</span>
<span class="msgnote1" style="float:left;text-align: left;"><input type="checkbox" name="backupitem">3.如果数据库连接错误,将导致脚本执行到其他数据库,请认真检查!</span><br>
<span class="msgnote1" style="float:left;text-align: left;"><input type="checkbox" name="backupitem">4.请确认补丁包已经在测试环境测试通过(特别是版本/KB升级补丁包)!</span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="backupCheck()">确 定</button>
</div>
</div>
</div>
</div>
</center>
<center>
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" style="width: 600px;">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="cancelbtn()">
×
</button>
<div class="modal-header text-left">
<span class="glyphicon glyphicon-cog"></span>提示信息
</div>
<div class="modal-body">
<div id="divmsg"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="confirmbtn" >确 定</button>
<button type="button" class="btn btn-primary" onclick="cancelbtn()" >取 消</button>
</div>
</div>
</div>
</div>
</center>
<center>
<div class="modal fade" id="packageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" style="width: 600px;">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="packageInfo_cancelbtn()">
×
</button>
<div class="modal-header text-left">
<span class="glyphicon glyphicon-floppy-disk"></span> 补丁包信息
</div>
<div class="operationmsg" style="font-size: 12px;color:#FF9200;width:550px;text-align:left;height:240px;margin-bottom:20px;padding-left:5px">
<span style="font-size:12px;color:red;font-weight:bold;">此次升级出现跳包,升级终止。正在升级的补丁包编号:</span>
<span style="font-size:15px;color:#1C86EE;"><%=upgradepackage %></span><br>
<span style="color:#FF9200;line-height:30px!important;vertical-align:middle;">
<span style="font-weight:bold;font-size:12px;">跳/漏包处理方法:</span><br>
1.检查近期升级的5个补丁包编号是否连续;<br>
2.检查当前升级的补丁包编号与历史升级最大补丁包编号是否连续;<br>
3.停止服务,打上遗漏的补丁包;<br>
4.修改Upgrade.properties的STATUS=0,PAGESTATUS=0;再重启服务,查看升级页面直至不再出现跳包提示;<br>
<b>5.如果遗漏包属于误报或可忽略,请点击升级信息页面的“继续”按钮继续升级。</b><br>
</span>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="text-align:left">历史升级记录</div>
<table class="table">
<thead>
<tr>
<th>补丁包编号</th>
<th>补丁包名称</th>
</tr>
</thead>
<tbody id="">
<%=tablestr %>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="packageInfo_cancelbtn()">确 定</button>
</div>
</div>
</div>
</div>
</center>
<center>
<div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" style="width: 600px;">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="msgCancel()">
×
</button>
<div class="modal-header text-left">
<span class="glyphicon glyphicon-cog"></span>提示信息
</div>
<div class="modal-body">
<div id="modalMsg"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="msgConfirm()" >确 定</button>
</div>
</div>
</div>
</div>
</center>
</body>
</html>