From 30b98aeae3721b86fcd9af7f177bda3e3ea5e8ec Mon Sep 17 00:00:00 2001 From: HITSword Date: Thu, 9 Jan 2020 19:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmysql=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E5=AD=97=E6=AE=B5index=E9=97=AE=E9=A2=98=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: HITSword --- hyproxy-cli.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hyproxy-cli.php b/hyproxy-cli.php index ae36e35..5fe42a9 100644 --- a/hyproxy-cli.php +++ b/hyproxy-cli.php @@ -304,12 +304,17 @@ $backup_path = _HYPROXY . 'baks' . DS . $bak_name; if (file_exists($backup_path)) { $backup = file_get_contents($backup_path); + $list = json_decode($backup, true); + //修复mysql保留字段index问题导致无法写入 + foreach ($list as &$row) { + $row['`index`'] = $row['index']; + unset($row['index']); + } global $medoo; $table = 'module_hyproxy'; $medoo->delete($table, null); $medoo->query("alter table $table auto_increment=1"); $medoo->insert($table, json_decode($backup, true)); - print_r($backup); hyproxy_make(); return "[OK] Proxy restore success\n"; } else {