From e17846571c41ea2eee6dcb48cac52b907504382e Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Jul 2020 15:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8B=E8=BD=BD=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=9C=B0=E5=9D=80=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/library/Compress.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/extend/catcher/library/Compress.php b/extend/catcher/library/Compress.php index 585f882..c7356c1 100644 --- a/extend/catcher/library/Compress.php +++ b/extend/catcher/library/Compress.php @@ -11,6 +11,8 @@ use function GuzzleHttp\Psr7\stream_for; class Compress { + protected $savePath; + public function __construct() { if (!extension_loaded('zip')) { @@ -62,7 +64,7 @@ class Compress { $response = Http::timeout(5) ->options([ - 'save_to' => stream_for(fopen(CatchAdmin::directory() . $moduleName .'.zip', 'w+')) + 'save_to' => stream_for(fopen($this->savePath, 'w+')) ]) ->get($remotePackageUrl); @@ -230,4 +232,19 @@ class Compress { return $backup = runtime_path('module' . DIRECTORY_SEPARATOR . 'backup_'.$moduleName); } + + /** + * 保存地址 + * + * @param $path + * @return $this + * @author JaguarJack + * @date 2020/7/11 + */ + public function savePath($path) + { + $this->savePath = $path; + + return $this; + } } \ No newline at end of file