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
bc98d9cc
Commit
bc98d9cc
authored
Jan 12, 2017
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-248: GridFS should report file mode using stat(2) bits
parent
a6fd0be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
StreamWrapper.php
src/GridFS/StreamWrapper.php
+3
-1
StreamWrapperFunctionalTest.php
tests/GridFS/StreamWrapperFunctionalTest.php
+18
-0
No files found.
src/GridFS/StreamWrapper.php
View file @
bc98d9cc
...
@@ -145,7 +145,9 @@ class StreamWrapper
...
@@ -145,7 +145,9 @@ class StreamWrapper
{
{
$stat
=
$this
->
getStatTemplate
();
$stat
=
$this
->
getStatTemplate
();
$stat
[
2
]
=
$stat
[
'mode'
]
=
$this
->
mode
;
$stat
[
2
]
=
$stat
[
'mode'
]
=
$this
->
stream
instanceof
ReadableStream
?
0100444
// S_IFREG & S_IRUSR & S_IRGRP & S_IROTH
:
0100222
;
// S_IFREG & S_IWUSR & S_IWGRP & S_IWOTH
$stat
[
7
]
=
$stat
[
'size'
]
=
$this
->
stream
->
getSize
();
$stat
[
7
]
=
$stat
[
'size'
]
=
$this
->
stream
->
getSize
();
return
$stat
;
return
$stat
;
...
...
tests/GridFS/StreamWrapperFunctionalTest.php
View file @
bc98d9cc
...
@@ -49,6 +49,15 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
...
@@ -49,6 +49,15 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
''
,
fread
(
$stream
,
3
));
$this
->
assertSame
(
''
,
fread
(
$stream
,
3
));
}
}
public
function
testReadableStreamStat
()
{
$stream
=
$this
->
bucket
->
openDownloadStream
(
'length-10'
);
$stat
=
fstat
(
$stream
);
$this
->
assertSame
(
0100444
,
$stat
[
2
]);
$this
->
assertSame
(
0100444
,
$stat
[
'mode'
]);
}
public
function
testReadableStreamWrite
()
public
function
testReadableStreamWrite
()
{
{
$stream
=
$this
->
bucket
->
openDownloadStream
(
'length-10'
);
$stream
=
$this
->
bucket
->
openDownloadStream
(
'length-10'
);
...
@@ -84,6 +93,15 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
...
@@ -84,6 +93,15 @@ class StreamWrapperFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
''
,
fread
(
$stream
,
8192
));
$this
->
assertSame
(
''
,
fread
(
$stream
,
8192
));
}
}
public
function
testWritableStreamStat
()
{
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
);
$stat
=
fstat
(
$stream
);
$this
->
assertSame
(
0100222
,
$stat
[
2
]);
$this
->
assertSame
(
0100222
,
$stat
[
'mode'
]);
}
public
function
testWritableStreamWrite
()
public
function
testWritableStreamWrite
()
{
{
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
);
$stream
=
$this
->
bucket
->
openUploadStream
(
'filename'
);
...
...
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