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
331c3fbb
Commit
331c3fbb
authored
Jun 22, 2018
by
Derick Rethans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates due to Jeremy's review
parent
110eb842
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
24 deletions
+30
-24
apiargs-MongoDBDatabase-method-selectGridFSBucket-option.yaml
...rgs-MongoDBDatabase-method-selectGridFSBucket-option.yaml
+5
-10
apiargs-MongoDBGridFSBucket-method-construct-option.yaml
.../apiargs-MongoDBGridFSBucket-method-construct-option.yaml
+5
-10
apiargs-MongoDBGridFSBucket-method-openUploadStream-option.yaml
...s-MongoDBGridFSBucket-method-openUploadStream-option.yaml
+2
-0
apiargs-MongoDBGridFSBucket-method-uploadFromStream-option.yaml
...s-MongoDBGridFSBucket-method-uploadFromStream-option.yaml
+2
-0
Bucket.php
src/GridFS/Bucket.php
+5
-1
WritableStream.php
src/GridFS/WritableStream.php
+3
-3
BucketFunctionalTest.php
tests/GridFS/BucketFunctionalTest.php
+4
-0
WritableStreamFunctionalTest.php
tests/GridFS/WritableStreamFunctionalTest.php
+4
-0
No files found.
docs/includes/apiargs-MongoDBDatabase-method-selectGridFSBucket-option.yaml
View file @
331c3fbb
...
...
@@ -17,16 +17,11 @@ interface: phpmethod
operation
:
~
optional
:
true
---
arg_name
:
option
name
:
disableMD5
type
:
boolean
description
:
|
Whether to disable automatic MD5 generation when storing files.
Defaults to ``false``.
interface
:
phpmethod
operation
:
~
optional
:
true
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
source
:
file
:
apiargs-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-construct-option.yaml
View file @
331c3fbb
...
...
@@ -17,16 +17,11 @@ interface: phpmethod
operation
:
~
optional
:
true
---
arg_name
:
option
name
:
disableMD5
type
:
boolean
description
:
|
Whether to disable automatic MD5 generation when storing files.
Defaults to ``false``.
interface
:
phpmethod
operation
:
~
optional
:
true
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
source
:
file
:
apiargs-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-openUploadStream-option.yaml
View file @
331c3fbb
...
...
@@ -9,6 +9,8 @@ source:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-uploadFromStream-option.yaml
View file @
331c3fbb
...
...
@@ -9,6 +9,8 @@ source:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
...
...
src/GridFS/Bucket.php
View file @
331c3fbb
...
...
@@ -90,6 +90,7 @@ class Bucket
$options
+=
[
'bucketName'
=>
self
::
$defaultBucketName
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'disableMD5'
=>
false
,
];
if
(
isset
(
$options
[
'bucketName'
])
&&
!
is_string
(
$options
[
'bucketName'
]))
{
...
...
@@ -128,7 +129,7 @@ class Bucket
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
bucketName
=
$options
[
'bucketName'
];
$this
->
chunkSizeBytes
=
$options
[
'chunkSizeBytes'
];
$this
->
disableMD5
=
isset
(
$options
[
'disableMD5'
])
?
$options
[
'disableMD5'
]
:
false
;
$this
->
disableMD5
=
$options
[
'disableMD5'
]
;
$this
->
readConcern
=
isset
(
$options
[
'readConcern'
])
?
$options
[
'readConcern'
]
:
$this
->
manager
->
getReadConcern
();
$this
->
readPreference
=
isset
(
$options
[
'readPreference'
])
?
$options
[
'readPreference'
]
:
$this
->
manager
->
getReadPreference
();
$this
->
typeMap
=
isset
(
$options
[
'typeMap'
])
?
$options
[
'typeMap'
]
:
self
::
$defaultTypeMap
;
...
...
@@ -545,6 +546,9 @@ class Bucket
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
* bucket's chunk size.
*
* * disableMD5 (boolean): When true, no MD5 sum will be generated for
* the stored file. Defaults to "false".
*
* * metadata (document): User data for the "metadata" field of the files
* collection document.
*
...
...
src/GridFS/WritableStream.php
View file @
331c3fbb
...
...
@@ -76,6 +76,7 @@ class WritableStream
$options
+=
[
'_id'
=>
new
ObjectId
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'disableMD5'
=>
false
,
];
if
(
isset
(
$options
[
'aliases'
])
&&
!
\MongoDB\is_string_array
(
$options
[
'aliases'
]))
{
...
...
@@ -104,7 +105,7 @@ class WritableStream
$this
->
chunkSize
=
$options
[
'chunkSizeBytes'
];
$this
->
collectionWrapper
=
$collectionWrapper
;
$this
->
disableMD5
=
isset
(
$options
[
'disableMD5'
])
?
$options
[
'disableMD5'
]
:
false
;
$this
->
disableMD5
=
$options
[
'disableMD5'
]
;
if
(
!
$this
->
disableMD5
)
{
$this
->
hashCtx
=
hash_init
(
'md5'
);
...
...
@@ -235,8 +236,7 @@ class WritableStream
$this
->
file
[
'uploadDate'
]
=
new
UTCDateTime
;
if
(
!
$this
->
disableMD5
)
{
$md5
=
hash_final
(
$this
->
hashCtx
);
$this
->
file
[
'md5'
]
=
$md5
;
$this
->
file
[
'md5'
]
=
hash_final
(
$this
->
hashCtx
);
}
try
{
...
...
tests/GridFS/BucketFunctionalTest.php
View file @
331c3fbb
...
...
@@ -54,6 +54,10 @@ class BucketFunctionalTest extends FunctionalTestCase
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
}
foreach
(
$this
->
getInvalidBooleanValues
()
as
$value
)
{
$options
[][]
=
[
'disableMD5'
=>
$value
];
}
foreach
(
$this
->
getInvalidReadConcernValues
()
as
$value
)
{
$options
[][]
=
[
'readConcern'
=>
$value
];
}
...
...
tests/GridFS/WritableStreamFunctionalTest.php
View file @
331c3fbb
...
...
@@ -49,6 +49,10 @@ class WritableStreamFunctionalTest extends FunctionalTestCase
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
}
foreach
(
$this
->
getInvalidBooleanValues
()
as
$value
)
{
$options
[][]
=
[
'disableMD5'
=>
$value
];
}
foreach
(
$this
->
getInvalidDocumentValues
()
as
$value
)
{
$options
[][]
=
[
'metadata'
=>
$value
];
}
...
...
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