新增做种列表备份功能,便于紧急恢复。

master
iyuu.cn 5 years ago
parent 06c00f88dc
commit 3393eae7e7
  1. 12
      app/AutoReseed.php

@ -67,6 +67,7 @@ class AutoReseed
public static function init() public static function init()
{ {
global $configALL; global $configALL;
self::backup('config', $configALL);
self::$curl = new Curl(); self::$curl = new Curl();
self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false);
@ -272,6 +273,7 @@ class AutoReseed
// 失败 // 失败
continue; continue;
} }
self::backup('clients_'.$k, $hashArray);
// 此处需要优化大于一万条做种时,应分批上传 // 此处需要优化大于一万条做种时,应分批上传
$infohash_Dir = $hashArray['hashString']; $infohash_Dir = $hashArray['hashString'];
unset($hashArray['hashString']); unset($hashArray['hashString']);
@ -740,4 +742,14 @@ class AutoReseed
'torrent_id'=> $torrent_id, '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);
}
} }

Loading…
Cancel
Save