diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ea1e3f1..fc6b2735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## CHANGE LOG +### v6.1.3 + +2013-10-09 issues [#50](https://github.com/qiniu/php-sdk/pull/50) + +- 断点续上传使用mkfile +- 修订文档 +- 消除测试用例并发问题 + ### v6.1.2 2013-09-24 issue [#40](https://github.com/qiniu/php-sdk/pull/40) diff --git a/docs/README.md b/docs/README.md index 81014336..4d950e13 100644 --- a/docs/README.md +++ b/docs/README.md @@ -145,7 +145,7 @@ SDK源码地址: ## 上传下载接口 -###1. 文件上传 +### 1. 文件上传 为了尽可能地改善终端用户的上传体验,七牛云存储首创了客户端直传功能。一般云存储的上传流程是: @@ -283,7 +283,7 @@ SDK源码地址: //$baseUrl 就是您要访问资源的地址 $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key); -其中是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。 +其中\是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。 **注意: key必须采用utf8编码,如使用非utf8编码访问七牛云存储将反馈错误** diff --git a/qiniu/resumable_io.php b/qiniu/resumable_io.php index 7e477a73..33491ad6 100644 --- a/qiniu/resumable_io.php +++ b/qiniu/resumable_io.php @@ -59,11 +59,13 @@ function Qiniu_Rio_Mkblock($self, $host, $reader, $size) // => ($blkputRet, $err return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream'); } + function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $err) { - $entry = $extra->Bucket . ':' . $key; - $url = $host . '/rs-mkfile/' . Qiniu_Encode($entry) . '/fsize/' . $fsize; - + $url = $host . '/mkfile/' . $fsize; + if ($key !== null) { + $url .= '/key/' . Qiniu_Encode($key); + } if (!empty($extra->MimeType)) { $url .= '/mimeType/' . Qiniu_Encode($extra->MimeType); } @@ -74,7 +76,7 @@ function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $e } $body = implode(',', $ctxs); - return Qiniu_Client_CallWithForm($self, $url, $body, 'text/plain'); + return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream'); } // ---------------------------------------------------------- @@ -107,7 +109,6 @@ function Qiniu_Rio_Put($upToken, $key, $body, $fsize, $putExtra) // => ($putRet, $self = new Qiniu_Rio_UploadClient($upToken); $progresses = array(); - $host = $QINIU_UP_HOST; $uploaded = 0; while ($uploaded < $fsize) { if ($fsize < $uploaded + QINIU_RIO_BLOCK_SIZE) { @@ -115,14 +116,14 @@ function Qiniu_Rio_Put($upToken, $key, $body, $fsize, $putExtra) // => ($putRet, } else { $bsize = QINIU_RIO_BLOCK_SIZE; } - list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $host, $body, $bsize); + list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $QINIU_UP_HOST, $body, $bsize); $host = $blkputRet['host']; $uploaded += $bsize; $progresses []= $blkputRet; } $putExtra->Progresses = $progresses; - return Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $putExtra); + return Qiniu_Rio_Mkfile($self, $QINIU_UP_HOST, $key, $fsize, $putExtra); } function Qiniu_Rio_PutFile($upToken, $key, $localFile, $putExtra) // => ($putRet, $err) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3757bfac..014fc851 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,7 +9,9 @@ $tid = getenv("TRAVIS_JOB_NUMBER"); if (!empty($tid)) { + $pid = getmypid(); $tid = strstr($tid, "."); + $tid .= "." . $pid; } function initKeys() {