45
45
use function get_resource_type ;
46
46
use function in_array ;
47
47
use function is_array ;
48
- use function is_bool ;
49
48
use function is_integer ;
50
49
use function is_object ;
51
50
use function is_resource ;
59
58
use function stream_copy_to_stream ;
60
59
use function stream_get_meta_data ;
61
60
use function stream_get_wrappers ;
62
- use function trigger_error ;
63
61
use function urlencode ;
64
62
65
- use const E_USER_DEPRECATED ;
66
-
67
63
/**
68
64
* Bucket provides a public API for interacting with the GridFS files and chunks
69
65
* collections.
@@ -88,8 +84,6 @@ class Bucket
88
84
89
85
private string $ bucketName ;
90
86
91
- private bool $ disableMD5 ;
92
-
93
87
private int $ chunkSizeBytes ;
94
88
95
89
private ReadConcern $ readConcern ;
@@ -111,9 +105,6 @@ class Bucket
111
105
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to
112
106
* 261120 (i.e. 255 KiB).
113
107
*
114
- * * disableMD5 (boolean): When true, no MD5 sum will be generated for
115
- * each stored file. Defaults to "false".
116
- *
117
108
* * readConcern (MongoDB\Driver\ReadConcern): Read concern.
118
109
*
119
110
* * readPreference (MongoDB\Driver\ReadPreference): Read preference.
@@ -129,14 +120,9 @@ class Bucket
129
120
*/
130
121
public function __construct (private Manager $ manager , private string $ databaseName , array $ options = [])
131
122
{
132
- if (isset ($ options ['disableMD5 ' ]) && $ options ['disableMD5 ' ] === false ) {
133
- @trigger_error ('Setting GridFS "disableMD5" option to "false" is deprecated since mongodb/mongodb 1.18 and will not be supported in version 2.0. ' , E_USER_DEPRECATED );
134
- }
135
-
136
123
$ options += [
137
124
'bucketName ' => self ::DEFAULT_BUCKET_NAME ,
138
125
'chunkSizeBytes ' => self ::DEFAULT_CHUNK_SIZE_BYTES ,
139
- 'disableMD5 ' => false ,
140
126
];
141
127
142
128
if (! is_string ($ options ['bucketName ' ])) {
@@ -155,10 +141,6 @@ public function __construct(private Manager $manager, private string $databaseNa
155
141
throw InvalidArgumentException::invalidType ('"codec" option ' , $ options ['codec ' ], DocumentCodec::class);
156
142
}
157
143
158
- if (! is_bool ($ options ['disableMD5 ' ])) {
159
- throw InvalidArgumentException::invalidType ('"disableMD5" option ' , $ options ['disableMD5 ' ], 'boolean ' );
160
- }
161
-
162
144
if (isset ($ options ['readConcern ' ]) && ! $ options ['readConcern ' ] instanceof ReadConcern) {
163
145
throw InvalidArgumentException::invalidType ('"readConcern" option ' , $ options ['readConcern ' ], ReadConcern::class);
164
146
}
@@ -182,7 +164,6 @@ public function __construct(private Manager $manager, private string $databaseNa
182
164
$ this ->bucketName = $ options ['bucketName ' ];
183
165
$ this ->chunkSizeBytes = $ options ['chunkSizeBytes ' ];
184
166
$ this ->codec = $ options ['codec ' ] ?? null ;
185
- $ this ->disableMD5 = $ options ['disableMD5 ' ];
186
167
$ this ->readConcern = $ options ['readConcern ' ] ?? $ this ->manager ->getReadConcern ();
187
168
$ this ->readPreference = $ options ['readPreference ' ] ?? $ this ->manager ->getReadPreference ();
188
169
$ this ->typeMap = $ options ['typeMap ' ] ?? self ::DEFAULT_TYPE_MAP ;
@@ -211,7 +192,6 @@ public function __debugInfo()
211
192
'bucketName ' => $ this ->bucketName ,
212
193
'codec ' => $ this ->codec ,
213
194
'databaseName ' => $ this ->databaseName ,
214
- 'disableMD5 ' => $ this ->disableMD5 ,
215
195
'manager ' => $ this ->manager ,
216
196
'chunkSizeBytes ' => $ this ->chunkSizeBytes ,
217
197
'readConcern ' => $ this ->readConcern ,
@@ -565,9 +545,6 @@ public function openDownloadStreamByName(string $filename, array $options = [])
565
545
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
566
546
* bucket's chunk size.
567
547
*
568
- * * disableMD5 (boolean): When true, no MD5 sum will be generated for
569
- * the stored file. Defaults to "false".
570
- *
571
548
* * metadata (document): User data for the "metadata" field of the files
572
549
* collection document.
573
550
*
@@ -579,7 +556,6 @@ public function openUploadStream(string $filename, array $options = [])
579
556
{
580
557
$ options += [
581
558
'chunkSizeBytes ' => $ this ->chunkSizeBytes ,
582
- 'disableMD5 ' => $ this ->disableMD5 ,
583
559
];
584
560
585
561
$ path = $ this ->createPathForUpload ();
@@ -658,9 +634,6 @@ public function rename(mixed $id, string $newFilename)
658
634
* * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the
659
635
* bucket's chunk size.
660
636
*
661
- * * disableMD5 (boolean): When true, no MD5 sum will be generated for
662
- * the stored file. Defaults to "false".
663
- *
664
637
* * metadata (document): User data for the "metadata" field of the files
665
638
* collection document.
666
639
*
@@ -792,9 +765,9 @@ private function registerStreamWrapper(): void
792
765
*
793
766
* @see StreamWrapper::setContextResolver()
794
767
*
795
- * @param string $path The full url provided to fopen(). It contains the filename.
796
- * gridfs://database_name/collection_name.files/file_name
797
- * @param array{revision?: int, chunkSizeBytes?: int, disableMD5?: bool } $context The options provided to fopen()
768
+ * @param string $path The full url provided to fopen(). It contains the filename.
769
+ * gridfs://database_name/collection_name.files/file_name
770
+ * @param array{revision?: int, chunkSizeBytes?: int} $context The options provided to fopen()
798
771
*
799
772
* @return array{collectionWrapper: CollectionWrapper, file: object}|array{collectionWrapper: CollectionWrapper, filename: string, options: array}
800
773
*
@@ -825,7 +798,6 @@ private function resolveStreamContext(string $path, string $mode, array $context
825
798
'filename ' => $ filename ,
826
799
'options ' => $ context + [
827
800
'chunkSizeBytes ' => $ this ->chunkSizeBytes ,
828
- 'disableMD5 ' => $ this ->disableMD5 ,
829
801
],
830
802
];
831
803
}
0 commit comments