Skip to content

Commit 042d447

Browse files
committed
Merge pull request #169 from longbai/resume_file_close
move file close outof resume
2 parents 81e70f0 + fc48e6a commit 042d447

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/Qiniu/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
final class Config
55
{
6-
const SDK_VER = '7.0.6';
6+
const SDK_VER = '7.0.7';
77

88
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改
99

src/Qiniu/Storage/ResumeUploader.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public function upload()
6767
$blockSize = $this->blockSize($uploaded);
6868
$data = fread($this->inputStream, $blockSize);
6969
if ($data === false) {
70-
fclose($this->inputStream);
7170
throw new \Exception("file read failed", 1);
7271
}
7372
$crc = \Qiniu\crc32_data($data);
@@ -85,13 +84,11 @@ public function upload()
8584
}
8685

8786
if (! $response->ok() || !isset($ret['crc32'])|| $crc != $ret['crc32']) {
88-
fclose($this->inputStream);
8987
return array(null, new Error($this->currentUrl, $response));
9088
}
9189
array_push($this->contexts, $ret['ctx']);
9290
$uploaded += $blockSize;
9391
}
94-
fclose($this->inputStream);
9592
return $this->makeFile();
9693
}
9794

src/Qiniu/Storage/UploadManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ public function putFile(
118118
$mime,
119119
$this->config
120120
);
121-
return $up->upload();
121+
$ret = $up->upload();
122+
fclose($file);
123+
return $ret;
122124
}
123125

124126
public static function trimParams($params)

tests/Qiniu/Tests/ResumeUpTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function test4ML()
3434
public function test4ML2()
3535
{
3636
$key = 'resumePutFile4ML';
37-
$zone = new Zone('http://up.fake.com', 'http://up.qiniu.com');
37+
$zone = new Zone('http://up.fake.qiniu.com', 'http://up.qiniu.com');
3838
$cfg = new Config($zone);
3939
$upManager = new UploadManager($cfg);
4040
$token = $this->auth->uploadToken($this->bucketName, $key);

0 commit comments

Comments
 (0)