From 3393eae7e72dea58970a99866859ceadc16e6c89 Mon Sep 17 00:00:00 2001 From: "iyuu.cn" <367013672@qq.com> Date: Tue, 18 Feb 2020 16:01:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=81=9A=E7=A7=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A4=87=E4=BB=BD=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BE=BF?= =?UTF-8?q?=E4=BA=8E=E7=B4=A7=E6=80=A5=E6=81=A2=E5=A4=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AutoReseed.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/AutoReseed.php b/app/AutoReseed.php index 7dc1dab..8362e9a 100644 --- a/app/AutoReseed.php +++ b/app/AutoReseed.php @@ -67,6 +67,7 @@ class AutoReseed public static function init() { global $configALL; + self::backup('config', $configALL); self::$curl = new Curl(); self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); @@ -272,6 +273,7 @@ class AutoReseed // 失败 continue; } + self::backup('clients_'.$k, $hashArray); // 此处需要优化大于一万条做种时,应分批上传 $infohash_Dir = $hashArray['hashString']; unset($hashArray['hashString']); @@ -740,4 +742,14 @@ class AutoReseed 'torrent_id'=> $torrent_id, ); } + /** + * 备份功能 + */ + private static function backup($key = '',$array = []){ + $json = json_encode($array, JSON_UNESCAPED_UNICODE); + $myfile = ROOT_PATH.DS.'config'.DS.$key.'.json'; + $file_pointer = @fopen($myfile, "w"); + $worldsnum = @fwrite($file_pointer, $json); + @fclose($file_pointer); + } }