You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

86 lines
2.6 KiB

{extend name="public/base" /}
{block name="title"}数据库备份{/block}
{block name="content"}
<h2 class="sub-header">数据库备份 <small class="badge"><?php echo count($list); ?></small></h2>
<form name="listarc"><div class="table-responsive"><table class="table table-striped table-hover">
<thead><tr>
<th>选择</th>
<th>表名</th>
<th>数据量</th>
<th>数据大小</th>
<th>创建时间</th>
<th>备份状态</th>
<th>操作</th>
</tr></thead>
<tbody>
<?php $backup_path = ROOT_PATH . 'database_backup' . DIRECTORY_SEPARATOR; if ($list) { foreach ($list as $k=>$v) { ?><tr>
<td><input name="arcID" type="checkbox" value="<?php echo $v["name"]; ?>" class="np"></td>
<td><?php echo $v["name"]; ?></td>
<td><?php echo $v["rows"]; ?></td>
<td>{$v.data_length|format_bytes}</td>
<td><?php echo $v["create_time"]; ?></td>
<td><?php $filename = $backup_path . $v["name"] . '.sql'; if (file_exists($filename)) { echo '<font color="green">已备份</font>'; } else { echo '<font color="red">未备份</font>'; } ?></td>
<td><a href="{:url('optimize')}?tables=<?php echo $v["name"]; ?>">优化表</a> <a href="{:url('repair')}?tables=<?php echo $v["name"]; ?>">修复表</a> <a href="{:url('tables_backup')}?tables=<?php echo $v["name"]; ?>">备份</a> </td>
</tr><?php } } ?>
<tr>
<td colspan="8">
<a href="javascript:selAll('arcID')" class="coolbg">反选</a>&nbsp;
<a href="javascript:backup_database()" class="coolbg">立即备份</a>&nbsp;
<a href="javascript:optimize()" class="coolbg">优化表</a>&nbsp;
<a href="javascript:repair()" class="coolbg">修复表</a>&nbsp;
<!-- <a href="javascript:recovery()" class="coolbg">数据还原</a> -->
</td>
</tr>
</tbody></table></div><!-- 表格结束 --></form><!-- 表单结束 -->
<script>
//备份数据库
function backup_database()
{
var checkvalue = getItems();
if (checkvalue=='') {
alert('请选择要备份的表');
return;
}
if (confirm("确定要执行此操作吗")) {
location = "{:url('tables_backup')}?tables=" + checkvalue;
}
}
//优化表
function optimize()
{
var checkvalue = getItems();
if (checkvalue=='') {
alert('请选择要优化的表');
return;
}
location = "{:url('optimize')}?tables=" + checkvalue;
}
//修复表
function repair()
{
var checkvalue = getItems();
if (checkvalue == '') {
alert('请选择要修复的表');
return;
}
location = "{:url('repair')}?tables=" + checkvalue;
}
//数据还原
function recovery()
{
var checkvalue = getItems();
if (checkvalue=='') {
alert('请选择要还原的表');
return;
}
if (confirm("确定要执行此操作吗")) {
location = "{:url('export')}?tables=" + checkvalue;
}
}
</script>
{/block}