Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
eab912fe
Commit
eab912fe
authored
Jan 12, 2017
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-250: GridFS stat should report chunk size in blksize field
parent
ddd2c3e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
StreamWrapper.php
src/GridFS/StreamWrapper.php
+6
-0
StreamWrapperFunctionalTest.php
tests/GridFS/StreamWrapperFunctionalTest.php
+5
-1
No files found.
src/GridFS/StreamWrapper.php
View file @
eab912fe
...
...
@@ -150,6 +150,12 @@ class StreamWrapper
:
0100222
;
// S_IFREG & S_IWUSR & S_IWGRP & S_IWOTH
$stat
[
7
]
=
$stat
[
'size'
]
=
$this
->
stream
->
getSize
();
$file
=
$this
->
stream
->
getFile
();
if
(
isset
(
$file
->
chunkSize
)
&&
is_integer
(
$file
->
chunkSize
))
{
$stat
[
11
]
=
$stat
[
'blksize'
]
=
$file
->
chunkSize
;
}
return
$stat
;
}
...
...
tests/GridFS/StreamWrapperFunctionalTest.php
View file @
eab912fe
...
...
@@ -58,6 +58,8 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
0100444
,
$stat
[
'mode'
]);
$this
->
assertSame
(
10
,
$stat
[
7
]);
$this
->
assertSame
(
10
,
$stat
[
'size'
]);
$this
->
assertSame
(
4
,
$stat
[
11
]);
$this
->
assertSame
(
4
,
$stat
[
'blksize'
]);
}
public
function
testReadableStreamWrite
()
...
...
@@ -97,13 +99,15 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
public
function
testWritableStreamStat
()
{
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
);
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
,
[
'chunkSizeBytes'
=>
1024
]
);
$stat
=
fstat
(
$stream
);
$this
->
assertSame
(
0100222
,
$stat
[
2
]);
$this
->
assertSame
(
0100222
,
$stat
[
'mode'
]);
$this
->
assertSame
(
0
,
$stat
[
7
]);
$this
->
assertSame
(
0
,
$stat
[
'size'
]);
$this
->
assertSame
(
1024
,
$stat
[
11
]);
$this
->
assertSame
(
1024
,
$stat
[
'blksize'
]);
$this
->
assertSame
(
6
,
fwrite
(
$stream
,
'foobar'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment