Parcourir la source

Remove DEFAULT_CHUNK_SIZE constant

Andreas Braun il y a 10 ans
Parent
commit
f8f49069c7

+ 3 - 3
lib/Mongo/MongoGridFS.php

@@ -15,8 +15,6 @@
 
 class MongoGridFS extends MongoCollection
 {
-    const DEFAULT_CHUNK_SIZE = 262144; // 256 kb
-
     const ASCENDING = 1;
     const DESCENDING = -1;
 
@@ -45,6 +43,8 @@ class MongoGridFS extends MongoCollection
 
     private $prefix;
 
+    private $defaultChunkSize = 261120;
+
     /**
      * Files as stored across two collections, the first containing file meta
      * information, the second containing chunks of the actual file. By default,
@@ -427,7 +427,7 @@ class MongoGridFS extends MongoCollection
         $record += [
             '_id' => new MongoId(),
             'uploadDate' => new MongoDate(),
-            'chunkSize' => self::DEFAULT_CHUNK_SIZE,
+            'chunkSize' => $this->defaultChunkSize,
         ];
 
         $result = $this->insert($record, $options);

+ 1 - 1
tests/Alcaeus/MongoDbAdapter/MongoGridFSCursorTest.php

@@ -19,7 +19,7 @@ class MongoGridFSCursorTest extends TestCase
 
             $this->assertArraySubset([
                 'filename' => 'foo.txt',
-                'chunkSize' => \MongoGridFS::DEFAULT_CHUNK_SIZE,
+                'chunkSize' => 261120,
                 'length' => 3,
                 'md5' => 'acbd18db4cc2f85cedef654fccc4a4d8'
             ], $value->file);