修复华为云存储报错
This commit is contained in:
@@ -6,7 +6,7 @@ return [
|
|||||||
'title' => 'Access Key',
|
'title' => 'Access Key',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => '',
|
'value' => 'HPUA3H63YULC0YUCFE5J',
|
||||||
'rule' => 'required',
|
'rule' => 'required',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||||
@@ -18,7 +18,7 @@ return [
|
|||||||
'title' => 'Secret Key',
|
'title' => 'Secret Key',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => '',
|
'value' => 'B2Obu8P3Er23EwzcoH8pPhbWBk0GOxpFrlwwRgSh',
|
||||||
'rule' => 'required',
|
'rule' => 'required',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
'tip' => '请前往华为云控制台->我的凭证->访问密钥中生成',
|
||||||
@@ -30,7 +30,7 @@ return [
|
|||||||
'title' => '存储桶名称',
|
'title' => '存储桶名称',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => 'yourbucket',
|
'value' => 'zhongyi542',
|
||||||
'rule' => 'required',
|
'rule' => 'required',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '存储桶名称',
|
'tip' => '存储桶名称',
|
||||||
@@ -54,7 +54,7 @@ return [
|
|||||||
'title' => '上传接口地址',
|
'title' => '上传接口地址',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => 'https://yourbucket.obs.cn-south-1.myhuaweicloud.com',
|
'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com',
|
||||||
'rule' => 'required;uploadurl',
|
'rule' => 'required;uploadurl',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '请使用存储桶->基本信息->访问域名的值,并在前面加上http://或https://',
|
'tip' => '请使用存储桶->基本信息->访问域名的值,并在前面加上http://或https://',
|
||||||
@@ -66,7 +66,7 @@ return [
|
|||||||
'title' => 'CDN地址',
|
'title' => 'CDN地址',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => 'https://yourbucket.obs.cn-south-1.myhuaweicloud.com',
|
'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com',
|
||||||
'rule' => 'required;cdnurl',
|
'rule' => 'required;cdnurl',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名',
|
'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名',
|
||||||
@@ -81,7 +81,7 @@ return [
|
|||||||
'client' => '客户端直传(速度快,无备份)',
|
'client' => '客户端直传(速度快,无备份)',
|
||||||
'server' => '服务器中转(占用服务器带宽,有备份)',
|
'server' => '服务器中转(占用服务器带宽,有备份)',
|
||||||
],
|
],
|
||||||
'value' => 'server',
|
'value' => 'client',
|
||||||
'rule' => '',
|
'rule' => '',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '',
|
'tip' => '',
|
||||||
@@ -96,7 +96,7 @@ return [
|
|||||||
1 => '备份(附件管理将产生2条记录)',
|
1 => '备份(附件管理将产生2条记录)',
|
||||||
0 => '不备份',
|
0 => '不备份',
|
||||||
],
|
],
|
||||||
'value' => '1',
|
'value' => '0',
|
||||||
'rule' => '',
|
'rule' => '',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '服务器中转模式下是否备份文件',
|
'tip' => '服务器中转模式下是否备份文件',
|
||||||
@@ -156,7 +156,7 @@ return [
|
|||||||
'title' => '多文件上传',
|
'title' => '多文件上传',
|
||||||
'type' => 'bool',
|
'type' => 'bool',
|
||||||
'content' => [],
|
'content' => [],
|
||||||
'value' => '0',
|
'value' => '1',
|
||||||
'rule' => 'required',
|
'rule' => 'required',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'tip' => '',
|
'tip' => '',
|
||||||
|
|||||||
@@ -28,17 +28,17 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
|||||||
{
|
{
|
||||||
protected $data;
|
protected $data;
|
||||||
|
|
||||||
public function __construct(array $data = [])
|
public function __construct(?array $data = [])
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function count()
|
public function count(): int
|
||||||
{
|
{
|
||||||
return count($this->data);
|
return count($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIterator()
|
public function getIterator(): \Traversable
|
||||||
{
|
{
|
||||||
return new \ArrayIterator($this->data);
|
return new \ArrayIterator($this->data);
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAll(array $keys = null)
|
public function getAll(?array $keys = null)
|
||||||
{
|
{
|
||||||
return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data;
|
return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
|||||||
return array_search($value, $this->data);
|
return array_search($value, $this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function replace(array $data)
|
public function replace(?array $data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map(\Closure $closure, array $context = [], $static = true)
|
public function map(\Closure $closure, ?array $context = [], $static = true)
|
||||||
{
|
{
|
||||||
$collection = $static ? new static() : new self();
|
$collection = $static ? new static() : new self();
|
||||||
foreach ($this as $key => $value) {
|
foreach ($this as $key => $value) {
|
||||||
@@ -170,22 +170,22 @@ class Model implements \ArrayAccess, \IteratorAggregate, \Countable, ToArrayInte
|
|||||||
return $collection;
|
return $collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset): bool
|
||||||
{
|
{
|
||||||
return isset($this->data[$offset]);
|
return isset($this->data[$offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset)
|
public function offsetGet($offset): mixed
|
||||||
{
|
{
|
||||||
return isset($this->data[$offset]) ? $this->data[$offset] : null;
|
return isset($this->data[$offset]) ? $this->data[$offset] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value): void
|
||||||
{
|
{
|
||||||
$this->data[$offset] = $value;
|
$this->data[$offset] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset): void
|
||||||
{
|
{
|
||||||
unset($this->data[$offset]);
|
unset($this->data[$offset]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
$this->maxHandles = $maxHandles;
|
$this->maxHandles = $maxHandles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(RequestInterface $request, array $options): EasyHandle
|
public function create(?RequestInterface $request, ?array $options): EasyHandle
|
||||||
{
|
{
|
||||||
if (isset($options['curl']['body_as_string'])) {
|
if (isset($options['curl']['body_as_string'])) {
|
||||||
$options['_body_as_string'] = $options['curl']['body_as_string'];
|
$options['_body_as_string'] = $options['curl']['body_as_string'];
|
||||||
@@ -85,7 +85,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function release(EasyHandle $easy): void
|
public function release(?EasyHandle $easy): void
|
||||||
{
|
{
|
||||||
$resource = $easy->handle;
|
$resource = $easy->handle;
|
||||||
unset($easy->handle);
|
unset($easy->handle);
|
||||||
@@ -102,7 +102,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefaultConf(EasyHandle $easy)
|
private function getDefaultConf(?EasyHandle $easy)
|
||||||
{
|
{
|
||||||
$conf = [
|
$conf = [
|
||||||
'_headers' => $easy->request->getHeaders(),
|
'_headers' => $easy->request->getHeaders(),
|
||||||
@@ -129,7 +129,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
return $conf;
|
return $conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyMethod(EasyHandle $easy, array &$conf)
|
private function applyMethod(?EasyHandle $easy, ?array &$conf)
|
||||||
{
|
{
|
||||||
$body = $easy->request->getBody();
|
$body = $easy->request->getBody();
|
||||||
$size = $body->getSize();
|
$size = $body->getSize();
|
||||||
@@ -155,7 +155,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyBody(RequestInterface $request, array $options, array &$conf)
|
private function applyBody(?RequestInterface $request, ?array $options, ?array &$conf)
|
||||||
{
|
{
|
||||||
$size = $request->hasHeader('Content-Length')
|
$size = $request->hasHeader('Content-Length')
|
||||||
? (int) $request->getHeaderLine('Content-Length')
|
? (int) $request->getHeaderLine('Content-Length')
|
||||||
@@ -209,7 +209,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyHeaders(EasyHandle $easy, array &$conf)
|
private function applyHeaders(?EasyHandle $easy, ?array &$conf)
|
||||||
{
|
{
|
||||||
foreach ($conf['_headers'] as $name => $values) {
|
foreach ($conf['_headers'] as $name => $values) {
|
||||||
foreach ($values as $value) {
|
foreach ($values as $value) {
|
||||||
@@ -223,7 +223,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removeHeader($name, array &$options)
|
private function removeHeader($name, ?array &$options)
|
||||||
{
|
{
|
||||||
foreach (array_keys($options['_headers']) as $key) {
|
foreach (array_keys($options['_headers']) as $key) {
|
||||||
if (!strcasecmp($key, $name)) {
|
if (!strcasecmp($key, $name)) {
|
||||||
@@ -233,7 +233,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyHandlerOptions(EasyHandle $easy, array &$conf)
|
private function applyHandlerOptions(?EasyHandle $easy, ?array &$conf)
|
||||||
{
|
{
|
||||||
$options = $easy->options;
|
$options = $easy->options;
|
||||||
if (isset($options['verify'])) {
|
if (isset($options['verify'])) {
|
||||||
@@ -381,7 +381,7 @@ class SdkCurlFactory implements CurlFactoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function createHeaderFn(EasyHandle $easy)
|
private function createHeaderFn(?EasyHandle $easy)
|
||||||
{
|
{
|
||||||
if (isset($easy->options['on_headers'])) {
|
if (isset($easy->options['on_headers'])) {
|
||||||
$onHeaders = $easy->options['on_headers'];
|
$onHeaders = $easy->options['on_headers'];
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SdkStreamHandler
|
|||||||
{
|
{
|
||||||
private $lastHeaders = [];
|
private $lastHeaders = [];
|
||||||
|
|
||||||
public function __invoke(RequestInterface $request, array $options)
|
public function __invoke(?RequestInterface $request, ?array $options)
|
||||||
{
|
{
|
||||||
if (isset($options['delay'])) {
|
if (isset($options['delay'])) {
|
||||||
usleep($options['delay'] * 1000);
|
usleep($options['delay'] * 1000);
|
||||||
@@ -77,10 +77,10 @@ class SdkStreamHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function invokeStats(
|
private function invokeStats(
|
||||||
array $options,
|
?array $options,
|
||||||
RequestInterface $request,
|
?RequestInterface $request,
|
||||||
$startTime,
|
$startTime,
|
||||||
ResponseInterface $response = null,
|
?ResponseInterface $response = null,
|
||||||
$error = null
|
$error = null
|
||||||
) {
|
) {
|
||||||
if (isset($options['on_stats'])) {
|
if (isset($options['on_stats'])) {
|
||||||
@@ -96,8 +96,8 @@ class SdkStreamHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function createResponse(
|
private function createResponse(
|
||||||
RequestInterface $request,
|
?RequestInterface $request,
|
||||||
array $options,
|
?array $options,
|
||||||
$stream,
|
$stream,
|
||||||
$startTime
|
$startTime
|
||||||
) {
|
) {
|
||||||
@@ -141,7 +141,7 @@ class SdkStreamHandler
|
|||||||
return new FulfilledPromise($response);
|
return new FulfilledPromise($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createSink(StreamInterface $stream, array $options)
|
private function createSink(StreamInterface $stream, ?array $options)
|
||||||
{
|
{
|
||||||
if (!empty($options['stream'])) {
|
if (!empty($options['stream'])) {
|
||||||
return $stream;
|
return $stream;
|
||||||
@@ -156,7 +156,7 @@ class SdkStreamHandler
|
|||||||
: \GuzzleHttp\Psr7\Utils::streamFor($sink);
|
: \GuzzleHttp\Psr7\Utils::streamFor($sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkDecode(array $options, array $headers, $stream)
|
private function checkDecode(?array $options, ?array $headers, $stream)
|
||||||
{
|
{
|
||||||
if (!empty($options['decode_content'])) {
|
if (!empty($options['decode_content'])) {
|
||||||
$normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
|
$normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
|
||||||
@@ -232,7 +232,7 @@ class SdkStreamHandler
|
|||||||
return $resource;
|
return $resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createStream(RequestInterface $request, array $options)
|
private function createStream(?RequestInterface $request, ?array $options)
|
||||||
{
|
{
|
||||||
static $methods;
|
static $methods;
|
||||||
if (!$methods) {
|
if (!$methods) {
|
||||||
@@ -309,7 +309,7 @@ class SdkStreamHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resolveHost(RequestInterface $request, array $options)
|
private function resolveHost(?RequestInterface $request, ?array $options)
|
||||||
{
|
{
|
||||||
$uri = $request->getUri();
|
$uri = $request->getUri();
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ class SdkStreamHandler
|
|||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefaultContext(RequestInterface $request)
|
private function getDefaultContext(?RequestInterface $request)
|
||||||
{
|
{
|
||||||
$headers = '';
|
$headers = '';
|
||||||
foreach ($request->getHeaders() as $name => $value) {
|
foreach ($request->getHeaders() as $name => $value) {
|
||||||
@@ -365,7 +365,7 @@ class SdkStreamHandler
|
|||||||
return $context;
|
return $context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_proxy(RequestInterface $request, &$options, $value, &$params)
|
private function add_proxy(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
$options['http']['proxy'] = $value;
|
$options['http']['proxy'] = $value;
|
||||||
@@ -384,14 +384,14 @@ class SdkStreamHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_timeout(RequestInterface $request, &$options, $value, &$params)
|
private function add_timeout(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
$options['http']['timeout'] = $value;
|
$options['http']['timeout'] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_verify(RequestInterface $request, &$options, $value, &$params)
|
private function add_verify(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
if ($value === true) {
|
if ($value === true) {
|
||||||
if (PHP_VERSION_ID < 50600) {
|
if (PHP_VERSION_ID < 50600) {
|
||||||
@@ -415,7 +415,7 @@ class SdkStreamHandler
|
|||||||
$options['ssl']['allow_self_signed'] = false;
|
$options['ssl']['allow_self_signed'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_cert(RequestInterface $request, &$options, $value, &$params)
|
private function add_cert(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$options['ssl']['passphrase'] = $value[1];
|
$options['ssl']['passphrase'] = $value[1];
|
||||||
@@ -429,7 +429,7 @@ class SdkStreamHandler
|
|||||||
$options['ssl']['local_cert'] = $value;
|
$options['ssl']['local_cert'] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_progress(RequestInterface $request, &$options, $value, &$params)
|
private function add_progress(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
$this->addNotification(
|
$this->addNotification(
|
||||||
$params,
|
$params,
|
||||||
@@ -441,7 +441,7 @@ class SdkStreamHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_debug(RequestInterface $request, &$options, $value, &$params)
|
private function add_debug(?RequestInterface $request, &$options, $value, &$params)
|
||||||
{
|
{
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
return;
|
return;
|
||||||
@@ -478,7 +478,7 @@ class SdkStreamHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addNotification(array &$params, callable $notify)
|
private function addNotification(?array &$params, callable $notify)
|
||||||
{
|
{
|
||||||
if (!isset($params['notification'])) {
|
if (!isset($params['notification'])) {
|
||||||
$params['notification'] = $notify;
|
$params['notification'] = $notify;
|
||||||
@@ -490,7 +490,7 @@ class SdkStreamHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function callArray(array $functions)
|
private function callArray(?array $functions)
|
||||||
{
|
{
|
||||||
return function () use ($functions) {
|
return function () use ($functions) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|||||||
Reference in New Issue
Block a user