Skip to content

Commit a5e7634

Browse files
committed
Merge pull request #50 from qiniu/develop
Release 6.1.3
2 parents bf6c493 + 030dc5e commit a5e7634

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## CHANGE LOG
22

3+
### v6.1.3
4+
5+
2013-10-09 issues [#50](https://github.com/qiniu/php-sdk/pull/50)
6+
7+
- 断点续上传使用mkfile
8+
- 修订文档
9+
- 消除测试用例并发问题
10+
311
### v6.1.2
412

513
2013-09-24 issue [#40](https://github.com/qiniu/php-sdk/pull/40)

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ SDK源码地址:<https://github.com/qiniu/php-sdk/tags>
145145
## 上传下载接口
146146

147147
<a name=upload></a>
148-
###1. 文件上传
148+
### 1. 文件上传
149149

150150
为了尽可能地改善终端用户的上传体验,七牛云存储首创了客户端直传功能。一般云存储的上传流程是:
151151

@@ -283,7 +283,7 @@ SDK源码地址:<https://github.com/qiniu/php-sdk/tags>
283283
//$baseUrl 就是您要访问资源的地址
284284
$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);
285285

286-
其中<domain>是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。
286+
其中\<domain\>是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。
287287

288288
**注意: key必须采用utf8编码,如使用非utf8编码访问七牛云存储将反馈错误**
289289

qiniu/resumable_io.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ function Qiniu_Rio_Mkblock($self, $host, $reader, $size) // => ($blkputRet, $err
5959
return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream');
6060
}
6161

62+
6263
function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $err)
6364
{
64-
$entry = $extra->Bucket . ':' . $key;
65-
$url = $host . '/rs-mkfile/' . Qiniu_Encode($entry) . '/fsize/' . $fsize;
66-
65+
$url = $host . '/mkfile/' . $fsize;
66+
if ($key !== null) {
67+
$url .= '/key/' . Qiniu_Encode($key);
68+
}
6769
if (!empty($extra->MimeType)) {
6870
$url .= '/mimeType/' . Qiniu_Encode($extra->MimeType);
6971
}
@@ -74,7 +76,7 @@ function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $e
7476
}
7577
$body = implode(',', $ctxs);
7678

77-
return Qiniu_Client_CallWithForm($self, $url, $body, 'text/plain');
79+
return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream');
7880
}
7981

8082
// ----------------------------------------------------------
@@ -107,22 +109,21 @@ function Qiniu_Rio_Put($upToken, $key, $body, $fsize, $putExtra) // => ($putRet,
107109
$self = new Qiniu_Rio_UploadClient($upToken);
108110

109111
$progresses = array();
110-
$host = $QINIU_UP_HOST;
111112
$uploaded = 0;
112113
while ($uploaded < $fsize) {
113114
if ($fsize < $uploaded + QINIU_RIO_BLOCK_SIZE) {
114115
$bsize = $fsize - $uploaded;
115116
} else {
116117
$bsize = QINIU_RIO_BLOCK_SIZE;
117118
}
118-
list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $host, $body, $bsize);
119+
list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $QINIU_UP_HOST, $body, $bsize);
119120
$host = $blkputRet['host'];
120121
$uploaded += $bsize;
121122
$progresses []= $blkputRet;
122123
}
123124

124125
$putExtra->Progresses = $progresses;
125-
return Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $putExtra);
126+
return Qiniu_Rio_Mkfile($self, $QINIU_UP_HOST, $key, $fsize, $putExtra);
126127
}
127128

128129
function Qiniu_Rio_PutFile($upToken, $key, $localFile, $putExtra) // => ($putRet, $err)

tests/bootstrap.php

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
$tid = getenv("TRAVIS_JOB_NUMBER");
1111
if (!empty($tid)) {
12+
$pid = getmypid();
1213
$tid = strstr($tid, ".");
14+
$tid .= "." . $pid;
1315
}
1416

1517
function initKeys() {

0 commit comments

Comments
 (0)