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.

85 lines
2.6 KiB

  1. {extend name="public/base" /}
  2. {block name="title"}数据库备份{/block}
  3. {block name="content"}
  4. <h2 class="sub-header">数据库备份 <small class="badge"><?php echo count($list); ?></small></h2>
  5. <form name="listarc"><div class="table-responsive"><table class="table table-striped table-hover">
  6. <thead><tr>
  7. <th>选择</th>
  8. <th>表名</th>
  9. <th>数据量</th>
  10. <th>数据大小</th>
  11. <th>创建时间</th>
  12. <th>备份状态</th>
  13. <th>操作</th>
  14. </tr></thead>
  15. <tbody>
  16. <?php $backup_path = ROOT_PATH . 'database_backup' . DIRECTORY_SEPARATOR; if ($list) { foreach ($list as $k=>$v) { ?><tr>
  17. <td><input name="arcID" type="checkbox" value="<?php echo $v["name"]; ?>" class="np"></td>
  18. <td><?php echo $v["name"]; ?></td>
  19. <td><?php echo $v["rows"]; ?></td>
  20. <td>{$v.data_length|format_bytes}</td>
  21. <td><?php echo $v["create_time"]; ?></td>
  22. <td><?php $filename = $backup_path . $v["name"] . '.sql'; if (file_exists($filename)) { echo '<font color="green">已备份</font>'; } else { echo '<font color="red">未备份</font>'; } ?></td>
  23. <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>
  24. </tr><?php } } ?>
  25. <tr>
  26. <td colspan="8">
  27. <a href="javascript:selAll('arcID')" class="coolbg">反选</a>&nbsp;
  28. <a href="javascript:backup_database()" class="coolbg">立即备份</a>&nbsp;
  29. <a href="javascript:optimize()" class="coolbg">优化表</a>&nbsp;
  30. <a href="javascript:repair()" class="coolbg">修复表</a>&nbsp;
  31. <!-- <a href="javascript:recovery()" class="coolbg">数据还原</a> -->
  32. </td>
  33. </tr>
  34. </tbody></table></div><!-- 表格结束 --></form><!-- 表单结束 -->
  35. <script>
  36. //备份数据库
  37. function backup_database()
  38. {
  39. var checkvalue = getItems();
  40. if (checkvalue=='') {
  41. alert('请选择要备份的表');
  42. return;
  43. }
  44. if (confirm("确定要执行此操作吗")) {
  45. location = "{:url('tables_backup')}?tables=" + checkvalue;
  46. }
  47. }
  48. //优化表
  49. function optimize()
  50. {
  51. var checkvalue = getItems();
  52. if (checkvalue=='') {
  53. alert('请选择要优化的表');
  54. return;
  55. }
  56. location = "{:url('optimize')}?tables=" + checkvalue;
  57. }
  58. //修复表
  59. function repair()
  60. {
  61. var checkvalue = getItems();
  62. if (checkvalue == '') {
  63. alert('请选择要修复的表');
  64. return;
  65. }
  66. location = "{:url('repair')}?tables=" + checkvalue;
  67. }
  68. //数据还原
  69. function recovery()
  70. {
  71. var checkvalue = getItems();
  72. if (checkvalue=='') {
  73. alert('请选择要还原的表');
  74. return;
  75. }
  76. if (confirm("确定要执行此操作吗")) {
  77. location = "{:url('export')}?tables=" + checkvalue;
  78. }
  79. }
  80. </script>
  81. {/block}