144 lines
4.9 KiB
HTML
144 lines
4.9 KiB
HTML
<include file="Inc:header"/>
|
|
<style>
|
|
.table-bordered .icon-ok{ color:#468847}
|
|
.table-bordered .icon-remove{ color:#ff0000}
|
|
</style>
|
|
<div class="container-fluid">
|
|
<div class="main_head">
|
|
<div class="main_tab" style="width:30%; margin-top:10px;">
|
|
<a class="btn" onclick="set_optimize()">优化表</a>
|
|
<a class="btn" onclick="set_repair()">修复表</a>
|
|
<a class="btn" onclick="set_bake()">立即备份</a>
|
|
</div>
|
|
<div class="main_add" style="width:70%;">
|
|
<a class="btn btn-inverse {:check_user_node('Database/recovery')?'':'none'}" href="{:U('Database/recovery')}" style="margin-left:10px;">数据恢复</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="text-align:right; float:right"></div>
|
|
|
|
<div class="row-fluid">
|
|
<div class="span12">
|
|
<div class="widget-box">
|
|
<div class="widget-content nopadding">
|
|
<form method="post" action="__SELF__" onsubmit="return save_form2(this);" class="modelIndex">
|
|
|
|
|
|
|
|
|
|
|
|
<table class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th width="5%"> <input type="checkbox" value="0" class="checkall" /></th>
|
|
<th width="40%" style="text-align:left;">表名</th>
|
|
<th width="10%" style="text-align:left;">数据量</th>
|
|
<th width="10%" style="text-align:left;">数据大小</th>
|
|
<th width="10%">类型</th>
|
|
<th width="10%">编码</th>
|
|
<th width="20%">备注</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<foreach name="data" item="v" >
|
|
<tr>
|
|
<td style="text-align: center;"><input type="checkbox" name="tables[]" class="chekboxs" value="{$v.name}"/></td>
|
|
<td class="tab-title"><a href="{:U('show_field',array('table'=>$v[name]))}" class="iframe2" target="_blank">{$v.name}</a></td>
|
|
<td>{$v.rows}</td>
|
|
<td>{$v.data_length|format_bytes}</td>
|
|
<td class="center">{$v.engine}</td>
|
|
<td class="center">{$v.collation}</td>
|
|
<td class="center">{$v[comment]?$v[comment]:"-"}</td>
|
|
</tr>
|
|
</foreach>
|
|
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<include file="Inc/footer"/>
|
|
<script>
|
|
|
|
//优化表
|
|
function set_optimize(){
|
|
$("form").attr("action","{:U('optimize')}");
|
|
save_form($("form"),function(){
|
|
layer.msg("优化表成功!");
|
|
});
|
|
}
|
|
//修复表
|
|
function set_repair(){
|
|
$("form").attr("action","{:U('optimize')}");
|
|
save_form($("form"),function(){
|
|
layer.msg("修复表成功!");
|
|
});
|
|
}
|
|
|
|
//备份表
|
|
function set_bake(){
|
|
if(confirm("在数据备份的时候不能刷新或者关闭浏览器,否则备份的数据不完整")==true){
|
|
$("form").attr("action","{:U('Start_DoBak')}");
|
|
save_form($("form"),function(data){
|
|
//开始备份
|
|
$("form").attr("action","{:U('Ebak_BakExe')}");
|
|
//进度条初始化
|
|
var progress='<div class="bakeing"><div class="progress progress-striped active"><div class="bar" id="database_bar" style="width:1%;">1%</div></div></div>';
|
|
$("body").append(progress);
|
|
$(".bakeing").show();
|
|
$("body").css("overflow","hidden");
|
|
window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
|
|
//初始化成功,下面开始备份数据
|
|
var param={
|
|
"s":0,
|
|
"p":0,
|
|
"t":0,
|
|
};
|
|
setTimeout
|
|
backup(param);
|
|
});
|
|
}
|
|
|
|
}
|
|
//
|
|
function backup(param){
|
|
$.get($("form").attr("action"), param, function(result){
|
|
if(result.status){
|
|
var data=result.info;
|
|
//备份进度
|
|
$("#database_bar").html(data.progress+"%");
|
|
$("#database_bar").css("width",data.progress+"%");
|
|
//
|
|
if(data.bake_end==1){
|
|
layer.msg("备份完成,正在前往查看的路上...",function(){
|
|
location.href="{:U('recovery')}";
|
|
});
|
|
window.onbeforeunload = function(){ return null }
|
|
return;
|
|
}else{
|
|
backup(data);
|
|
}
|
|
}
|
|
}, "json");
|
|
}
|
|
$(function(){
|
|
//分类窗口
|
|
$(".iframe2").click(function(){
|
|
var url=$(this).attr("href");
|
|
var index=layer.open({
|
|
type: 2,
|
|
area: ["70%","80%"],
|
|
fixed: false, //不固定
|
|
maxmin: true,
|
|
content: [url]
|
|
});
|
|
return false;
|
|
});
|
|
})
|
|
</script> |