Skip to content

Commit 3730921

Browse files
committed
add move/copy force param
1 parent 915c93f commit 3730921

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Qiniu/Storage/BucketManager.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ public function rename($bucket, $oldname, $newname)
135135
* @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error
136136
* @link http://developer.qiniu.com/docs/v6/api/reference/rs/copy.html
137137
*/
138-
public function copy($from_bucket, $from_key, $to_bucket, $to_key)
138+
public function copy($from_bucket, $from_key, $to_bucket, $to_key, $force = flase)
139139
{
140140
$from = \Qiniu\entry($from_bucket, $from_key);
141141
$to = \Qiniu\entry($to_bucket, $to_key);
142142
$path = '/copy/' . $from . '/' . $to;
143+
if ($force) {
144+
$path .= '/force/true';
145+
}
143146
list(, $error) = $this->rsPost($path);
144147
return $error;
145148
}
@@ -155,11 +158,14 @@ public function copy($from_bucket, $from_key, $to_bucket, $to_key)
155158
* @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error
156159
* @link http://developer.qiniu.com/docs/v6/api/reference/rs/move.html
157160
*/
158-
public function move($from_bucket, $from_key, $to_bucket, $to_key)
161+
public function move($from_bucket, $from_key, $to_bucket, $to_key, $force = flase)
159162
{
160163
$from = \Qiniu\entry($from_bucket, $from_key);
161164
$to = \Qiniu\entry($to_bucket, $to_key);
162165
$path = '/move/' . $from . '/' . $to;
166+
if ($force) {
167+
$path .= '/force/true';
168+
}
163169
list(, $error) = $this->rsPost($path);
164170
return $error;
165171
}

0 commit comments

Comments
 (0)