<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" href="{{ kg['tpl_url'] }}style/mysql_dump.css">
<script src="{{ kg['tpl_url'] }}script/jquery.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{ kg['tpl_url'] }}script/mysql_dump.js"></script>
</head>
<body data-type="generalComponents">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				数据库镜像管理
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				<li class="am-active">数据库备份及还原</li>
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span>&nbsp;数据库备份及还原
					</div>
					<div class="tpl-portlet-input tpl-fz-ml am-no-margintop ">
						<div class="portlet-input input-small input-inline">
							<div class="input-icon right am-fr">
								<div class="am-btn-group am-btn-group-xs">
								{% if sql_list %}
									<a class="am-btn am-btn-default am-btn-primary" href="mysql_dump?action=backup"><span class="am-icon-refresh"></span>&nbsp;备份数据库</a>
									<a class="am-btn am-btn-default am-btn-warning" href="mysql_dump?action=check"><span class="am-icon-search"></span>&nbsp;检查数据库</a>
									<a class="am-btn am-btn-default am-btn-success" href="mysql_dump?action=optimize"><span class="am-icon-line-chart"></span>&nbsp;优化数据库</a>
									<a class="am-btn am-btn-default am-btn-danger" href="mysql_dump?action=repair"><span class="am-icon-wrench"></span>&nbsp;修复数据库</a>
									<a class="am-btn am-btn-default am-btn-secondary" href="mysql_dump?action=analyze"><span class="am-icon-filter"></span>&nbsp;分析数据库</a>
								{% else %}
									<a class="am-btn am-btn-default am-btn-success" href="mysql_dump"><span class="am-icon-reply"></span>&nbsp;&nbsp;返&nbsp;&nbsp;回</a>
									<a class="am-btn am-btn-default am-btn-primary" href="mysql_dump?action=backup"><span class="am-icon-database"></span>&nbsp;备份数据库</a>
								{% endif %}
								</div>
							</div>
							<div class="am-cf"></div>
						</div>
					</div>
				</div>
				<div class="am-g">
					<div class="am-u-sm-12 ngALL-AFenyeFu-marginT ngco-No-paddingR">
						<form class="am-form">
							{% if sql_list %}
							<!-- 显示备份文件列表数据 -->
							<table class="am-table am-table-striped am-table-hover table-main ngco-Esz-mgibdr">
								<thead>
									<tr>
										<th>备份文件ID</th>
										<th>文件大小</th>
										<th>文件来源</th>
										<th>备份时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									{% for row in sql_list %}
									<tr>
										<td>{{ row["id"] }}</td>
										<td>{{ row["size"] }}</td>
										<td>{{ row["source"] }}</td>
										<td>{{ row["time"] }}</td>
										<td>
											<!-- <div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<a target="_blank" href="../api/admin_process?action=download&name={{ row["name"] }}&code={{ row["code"] }}" class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only spl-js-download">
														<span class="am-icon-download"></span>&nbsp;下载备份
													</a>
													<a href="mysql_dump?action=revert&file={{row["file"]}}" class="am-btn am-btn-default am-btn-xs am-text-danger spl-js-cog">
														<span class="am-icon-repeat"></span>&nbsp;还原数据库
													</a>
													<a href="mysql_dump?action=del&file={{ row["file"] }}" class="am-btn am-btn-default am-btn-xs am-text-success spl-js-trash">
														<span class="am-icon-trash-o"></span>&nbsp;删除备份
													</a>
												</div>
											</div> -->
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<a target="_blank" href="../api/admin_process?action=download&name={{ row["name"] }}&code={{ row["code"] }}" class="am-btn am-btn-default am-btn-xs am-edit-bright am-text-secondary spl-js-download">
														<span class="am-icon-download"></span>&nbsp;下载备份
													</a>
													<a href="mysql_dump?action=revert&file={{row["file"]}}" class="am-btn am-btn-default am-btn-xs am-text-danger ngro-Jclick-shanchubi spl-js-cog">
														<span class="am-icon-repeat"></span>&nbsp;还原数据库
													</a>
													<a href="mysql_dump?action=del&file={{ row["file"] }}" class="am-btn am-btn-default am-btn-xs am-son-bright spl-js-trash">
														<span class="am-icon-trash-o"></span>&nbsp;删除备份
													</a>
												</div>
											</div>
										</td>
									</tr>
									{% endfor %}
								</tbody>

							</table>
							{% if not sql_list %}<div class="no-data"><ul>没有相关数据</ul></div>{% endif %}
							<!-- 分页 -->
							<div class="am-cf">
								<div class="am-fr">
									{% if page_data['total_page'] > 1 %}
									{{ page_html }}
									{% endif %}
								</div>
							</div>
							<!-- 分页end -->
							{% else %}
							<!-- 显示数据库检测/修复结果列表据 -->
							<div class="sql-backups sql-inspect">
								<ul class="sql-title">
									<li class="sql-table">TABLE</li>
									<li>OP</li>
									<li>MSG TYPE</li>
									<li>MSG TEXT</li>
								</ul>
								{% for row in check_list %}
								<ul class="sql-content">
									<li class="sql-table">{{ row["Table"] }}</li>
									<li>{{ row["Op"] }}</li>
									<li>{{ row["Msg_type"] }}</li>
									<li>{{ row["Msg_text"] }}</li>
								</ul>
								{% endfor %}
							</div>
							{% endif %}
							<div class="am-alert am-alert-warning">
								<h4><i class="am-icon-warning"></i>&nbsp;数据库镜像操作说明：</h4>
								<ul>
									<li>1、数据库恢复请谨慎，这将覆盖当前数据库，建议由专业人员进行操作。</li>
									<li>2、备份只对数据库（库名："<span class="col-039">{{ dbname }}</span>"）中当前项目数据和结构（前缀名为&nbsp;"<span class="col-039">{{ prefix }}</span>"&nbsp;的表）进行备份。如果您的数据库中有多个项目，其它项目数据表不会被备份。</li>
									<li>3、备份后的数据可以进行恢复操作或通过 phpMyAdmin 等MySQL管理工具导入。</li>
									<li>4、本功能只适用于对一般中小型数据库进行备份/恢复操作，大型数据库请采用专业的 MySQL 管理工具进行备份/还原操作。</li>
									<li>5、当前数据库备份文件保存路径：&nbsp;<span class="col-039">{{ kg["server"]["ROOT_PATH"] }}backup/mysql/</span></li>
								</ul>
							</div>
						</form>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		
		</div><!-- /.scrollbar-wrap -->
	</div>
</body>
</html>
