Skip to content

Commit

Permalink
Deprecate setting GridFS disableMD5 to false explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jan 3, 2024
1 parent 92e0a10 commit 83c0083
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Parameters
- boolean
- Whether to disable automatic MD5 generation when storing files.

Defaults to ``false``.
Defaults to ``false``. Only ``true`` will be supported in 2.0.

.. versionadded: 1.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Parameters
- boolean
- Whether to disable automatic MD5 generation when storing files.

Defaults to ``false``.
Defaults to ``false``. Only ``true`` will be supported in 2.0.

.. versionadded: 1.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Parameters
- boolean
- Whether to disable automatic MD5 generation when storing files.

Defaults to ``false``.
Defaults to ``false``. Only ``true`` will be supported in 2.0.

.. versionadded: 1.4

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBGridFSBucket__construct.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Parameters
- boolean
- Whether to disable automatic MD5 generation when storing files.

Defaults to ``false``.
Defaults to ``false``. Only ``true`` will be supported in 2.0.

.. versionadded: 1.4

Expand Down
5 changes: 5 additions & 0 deletions src/GridFS/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
use function stream_copy_to_stream;
use function stream_get_meta_data;
use function stream_get_wrappers;
use function trigger_deprecation;
use function urlencode;

/**
Expand Down Expand Up @@ -132,6 +133,10 @@ class Bucket
*/
public function __construct(Manager $manager, string $databaseName, array $options = [])
{
if (isset($options['disableMD5']) && $options['disableMD5'] === false) {
trigger_deprecation('mongodb/mongodb', '1.10', 'Setting GridFS "disableMD5" option to "false" is deprecated and will not be supported in version 2.0.');
}

$options += [
'bucketName' => self::DEFAULT_BUCKET_NAME,
'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES,
Expand Down

0 comments on commit 83c0083

Please sign in to comment.