Skip to content

Commit ded8945

Browse files
committed
rewrite the code
1 parent a57e3de commit ded8945

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

examples/put_bucktSourceConfig.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
1313

1414
$body = array(
15+
//回源配置的空间名
1516
"bucket" => $bucket,
1617
"sources" => array(
1718
array(
18-
"addr" => "http://www.qiniu.com",
19+
"addr" => "http://www.qiniu.com", //回源地址
20+
// "weight"=> "<Weight>", //权重
21+
// "backup"=> "<Backup>" //是否备用回源
1922
),
2023
),
2124
);

src/Qiniu/Storage/BucketManager.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ public function buckets($shared = true)
5656

5757
public function listbuckets(
5858
$region = null,
59-
$global = 'false',
6059
$line = 'false',
6160
$shared = 'false'
6261
) {
63-
$path = '/v3/buckets?region=' . $region . '&global=' . $global . '&line=' . $line . '&shared=' . $share;
62+
$path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $share;
6463
$info = $this->ucPost($path);
6564
return $info;
6665
}
@@ -118,15 +117,14 @@ public function bucketInfo($bucket)
118117
* 获取指定zone的空间信息列表
119118
* 在Region 未指定且Global 不为 true 时(包含未指定的情况,下同),返回用户的所有空间。
120119
* 在指定了 region 参数且 global 不为 true 时,只列举非全局空间。
121-
* 在指定了global为 true 时,返回所有全局空间,忽略region 参数
122120
* shared 不指定shared参数或指定shared为rw或false时,返回包含具有读写权限空间,
123121
* 指定shared为rd或true时,返回包含具有读权限空间。
124122
* fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。
125123
* @return string[] 包含空间信息
126124
*/
127-
public function bucketInfos($region = null, $global = 'false', $shared = 'false', $fs = 'false')
125+
public function bucketInfos($region = null, $shared = 'false', $fs = 'false')
128126
{
129-
$path = '/v2/bucketInfos?region=' . $region . '&global=' . $global . '&shared=' . $shared . '&fs=' . $fs;
127+
$path = '/v2/bucketInfos?region=' . $region . '&shared=' . $shared . '&fs=' . $fs;
130128
$info = $this->ucPost($path);
131129
return $info;
132130
}
@@ -560,7 +558,7 @@ public function getCorsRules($bucket)
560558
* 主备源会分开计算.
561559
* Backup 是否备用回源,回源优先尝试主源
562560
*/
563-
public function putBucktSourceConfig($params)
561+
public function putBucktSourceConfig(array $params)
564562
{
565563
$path = '/mirrorConfig/set';
566564
$data = json_encode($params);
@@ -571,7 +569,7 @@ public function putBucktSourceConfig($params)
571569
/**
572570
* 获取空间回源配置
573571
*/
574-
public function getBucktSourceConfig($params)
572+
public function getBucktSourceConfig(array $params)
575573
{
576574
$path = '/mirrorConfig/get';
577575
$data = json_encode($params);

0 commit comments

Comments
 (0)