新增下载保存地址方法
This commit is contained in:
parent
359381fec6
commit
e17846571c
@ -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 <njphper@gmail.com>
|
||||
* @date 2020/7/11
|
||||
*/
|
||||
public function savePath($path)
|
||||
{
|
||||
$this->savePath = $path;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user