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
Show 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
...
@@ -17,16 +17,11 @@ interface: phpmethod
operation
:
~
operation
:
~
optional
:
true
optional
:
true
---
---
arg_name
:
option
source
:
name
:
disableMD5
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
type
:
boolean
ref
:
disableMD5
description
:
|
post
:
|
Whether to disable automatic MD5 generation when storing files.
.. versionadded: 1.4
Defaults to ``false``.
interface
:
phpmethod
operation
:
~
optional
:
true
---
---
source
:
source
:
file
:
apiargs-common-option.yaml
file
:
apiargs-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-construct-option.yaml
View file @
331c3fbb
...
@@ -17,16 +17,11 @@ interface: phpmethod
...
@@ -17,16 +17,11 @@ interface: phpmethod
operation
:
~
operation
:
~
optional
:
true
optional
:
true
---
---
arg_name
:
option
source
:
name
:
disableMD5
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
type
:
boolean
ref
:
disableMD5
description
:
|
post
:
|
Whether to disable automatic MD5 generation when storing files.
.. versionadded: 1.4
Defaults to ``false``.
interface
:
phpmethod
operation
:
~
optional
:
true
---
---
source
:
source
:
file
:
apiargs-common-option.yaml
file
:
apiargs-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-openUploadStream-option.yaml
View file @
331c3fbb
...
@@ -9,6 +9,8 @@ source:
...
@@ -9,6 +9,8 @@ source:
source
:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
---
source
:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
...
...
docs/includes/apiargs-MongoDBGridFSBucket-method-uploadFromStream-option.yaml
View file @
331c3fbb
...
@@ -9,6 +9,8 @@ source:
...
@@ -9,6 +9,8 @@ source:
source
:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
ref
:
disableMD5
ref
:
disableMD5
post
:
|
.. versionadded: 1.4
---
---
source
:
source
:
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
file
:
apiargs-MongoDBGridFSBucket-common-option.yaml
...
...
src/GridFS/Bucket.php
View file @
331c3fbb
...
@@ -90,6 +90,7 @@ class Bucket
...
@@ -90,6 +90,7 @@ class Bucket
$options
+=
[
$options
+=
[
'bucketName'
=>
self
::
$defaultBucketName
,
'bucketName'
=>
self
::
$defaultBucketName
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'disableMD5'
=>
false
,
];
];
if
(
isset
(
$options
[
'bucketName'
])
&&
!
is_string
(
$options
[
'bucketName'
]))
{
if
(
isset
(
$options
[
'bucketName'
])
&&
!
is_string
(
$options
[
'bucketName'
]))
{
...
@@ -128,7 +129,7 @@ class Bucket
...
@@ -128,7 +129,7 @@ class Bucket
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
bucketName
=
$options
[
'bucketName'
];
$this
->
bucketName
=
$options
[
'bucketName'
];
$this
->
chunkSizeBytes
=
$options
[
'chunkSizeBytes'
];
$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
->
readConcern
=
isset
(
$options
[
'readConcern'
])
?
$options
[
'readConcern'
]
:
$this
->
manager
->
getReadConcern
();
$this
->
readPreference
=
isset
(
$options
[
'readPreference'
])
?
$options
[
'readPreference'
]
:
$this
->
manager
->
getReadPreference
();
$this
->
readPreference
=
isset
(
$options
[
'readPreference'
])
?
$options
[
'readPreference'
]
:
$this
->
manager
->
getReadPreference
();
$this
->
typeMap
=
isset
(
$options
[
'typeMap'
])
?
$options
[
'typeMap'
]
:
self
::
$defaultTypeMap
;
$this
->
typeMap
=
isset
(
$options
[
'typeMap'
])
?
$options
[
'typeMap'
]
:
self
::
$defaultTypeMap
;
...
@@ -545,6 +546,9 @@ class Bucket
...
@@ -545,6 +546,9 @@ class Bucket
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
* bucket's chunk size.
* 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
* * metadata (document): User data for the "metadata" field of the files
* collection document.
* collection document.
*
*
...
...
src/GridFS/WritableStream.php
View file @
331c3fbb
...
@@ -76,6 +76,7 @@ class WritableStream
...
@@ -76,6 +76,7 @@ class WritableStream
$options
+=
[
$options
+=
[
'_id'
=>
new
ObjectId
,
'_id'
=>
new
ObjectId
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'chunkSizeBytes'
=>
self
::
$defaultChunkSizeBytes
,
'disableMD5'
=>
false
,
];
];
if
(
isset
(
$options
[
'aliases'
])
&&
!
\MongoDB\is_string_array
(
$options
[
'aliases'
]))
{
if
(
isset
(
$options
[
'aliases'
])
&&
!
\MongoDB\is_string_array
(
$options
[
'aliases'
]))
{
...
@@ -104,7 +105,7 @@ class WritableStream
...
@@ -104,7 +105,7 @@ class WritableStream
$this
->
chunkSize
=
$options
[
'chunkSizeBytes'
];
$this
->
chunkSize
=
$options
[
'chunkSizeBytes'
];
$this
->
collectionWrapper
=
$collectionWrapper
;
$this
->
collectionWrapper
=
$collectionWrapper
;
$this
->
disableMD5
=
isset
(
$options
[
'disableMD5'
])
?
$options
[
'disableMD5'
]
:
false
;
$this
->
disableMD5
=
$options
[
'disableMD5'
]
;
if
(
!
$this
->
disableMD5
)
{
if
(
!
$this
->
disableMD5
)
{
$this
->
hashCtx
=
hash_init
(
'md5'
);
$this
->
hashCtx
=
hash_init
(
'md5'
);
...
@@ -235,8 +236,7 @@ class WritableStream
...
@@ -235,8 +236,7 @@ class WritableStream
$this
->
file
[
'uploadDate'
]
=
new
UTCDateTime
;
$this
->
file
[
'uploadDate'
]
=
new
UTCDateTime
;
if
(
!
$this
->
disableMD5
)
{
if
(
!
$this
->
disableMD5
)
{
$md5
=
hash_final
(
$this
->
hashCtx
);
$this
->
file
[
'md5'
]
=
hash_final
(
$this
->
hashCtx
);
$this
->
file
[
'md5'
]
=
$md5
;
}
}
try
{
try
{
...
...
tests/GridFS/BucketFunctionalTest.php
View file @
331c3fbb
...
@@ -54,6 +54,10 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -54,6 +54,10 @@ class BucketFunctionalTest extends FunctionalTestCase
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
}
}
foreach
(
$this
->
getInvalidBooleanValues
()
as
$value
)
{
$options
[][]
=
[
'disableMD5'
=>
$value
];
}
foreach
(
$this
->
getInvalidReadConcernValues
()
as
$value
)
{
foreach
(
$this
->
getInvalidReadConcernValues
()
as
$value
)
{
$options
[][]
=
[
'readConcern'
=>
$value
];
$options
[][]
=
[
'readConcern'
=>
$value
];
}
}
...
...
tests/GridFS/WritableStreamFunctionalTest.php
View file @
331c3fbb
...
@@ -49,6 +49,10 @@ class WritableStreamFunctionalTest extends FunctionalTestCase
...
@@ -49,6 +49,10 @@ class WritableStreamFunctionalTest extends FunctionalTestCase
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
$options
[][]
=
[
'chunkSizeBytes'
=>
$value
];
}
}
foreach
(
$this
->
getInvalidBooleanValues
()
as
$value
)
{
$options
[][]
=
[
'disableMD5'
=>
$value
];
}
foreach
(
$this
->
getInvalidDocumentValues
()
as
$value
)
{
foreach
(
$this
->
getInvalidDocumentValues
()
as
$value
)
{
$options
[][]
=
[
'metadata'
=>
$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