|
Moodle PHP Documentation 4.1
Moodle 4.1.19+ (Build: 20250711) (5f47dc23ffc)
|
Public Member Functions | |
| __construct (Manager $manager, string $databaseName, array $options=[]) | |
| Constructs a GridFS bucket. | |
| __debugInfo () | |
| Return internal properties for debugging purposes. | |
| delete ($id) | |
| Delete a file from the GridFS bucket. | |
| downloadToStream ($id, $destination) | |
| Writes the contents of a GridFS file to a writable stream. | |
| downloadToStreamByName (string $filename, $destination, array $options=[]) | |
| Writes the contents of a GridFS file, which is selected by name and revision, to a writable stream. | |
| drop () | |
| Drops the files and chunks collections associated with this GridFS bucket. | |
| find ($filter=[], array $options=[]) | |
| Finds documents from the GridFS bucket's files collection matching the query. | |
| findOne ($filter=[], array $options=[]) | |
| Finds a single document from the GridFS bucket's files collection matching the query. | |
| getBucketName () | |
| Return the bucket name. | |
| getChunksCollection () | |
| Return the chunks collection. | |
| getChunkSizeBytes () | |
| Return the chunk size in bytes. | |
| getDatabaseName () | |
| Return the database name. | |
| getFileDocumentForStream ($stream) | |
| Gets the file document of the GridFS file associated with a stream. | |
| getFileIdForStream ($stream) | |
| Gets the file document's ID of the GridFS file associated with a stream. | |
| getFilesCollection () | |
| Return the files collection. | |
| getReadConcern () | |
| Return the read concern for this GridFS bucket. | |
| getReadPreference () | |
| Return the read preference for this GridFS bucket. | |
| getTypeMap () | |
| Return the type map for this GridFS bucket. | |
| getWriteConcern () | |
| Return the write concern for this GridFS bucket. | |
| openDownloadStream ($id) | |
| Opens a readable stream for reading a GridFS file. | |
| openDownloadStreamByName (string $filename, array $options=[]) | |
| Opens a readable stream stream to read a GridFS file, which is selected by name and revision. | |
| openUploadStream (string $filename, array $options=[]) | |
| Opens a writable stream for writing a GridFS file. | |
| rename ($id, string $newFilename) | |
| Renames the GridFS file with the specified ID. | |
| uploadFromStream (string $filename, $source, array $options=[]) | |
| Writes the contents of a readable stream to a GridFS file. | |
| MongoDB\GridFS\Bucket::__construct | ( | Manager | $manager, |
| string | $databaseName, | ||
| array | $options = [] ) |
Constructs a GridFS bucket.
Supported options:
| Manager | $manager | Manager instance from the driver |
| string | $databaseName | Database name |
| array | $options | Bucket options |
| InvalidArgumentException | for parameter/option parsing errors |
| MongoDB\GridFS\Bucket::__debugInfo | ( | ) |
Return internal properties for debugging purposes.
| array |
| MongoDB\GridFS\Bucket::delete | ( | $id | ) |
Delete a file from the GridFS bucket.
If the files collection document is not found, this method will still attempt to delete orphaned chunks.
| mixed | $id | File ID |
| FileNotFoundException | if no file could be selected |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::downloadToStream | ( | $id, | |
| $destination ) |
Writes the contents of a GridFS file to a writable stream.
| mixed | $id | File ID |
| resource | $destination | Writable Stream |
| FileNotFoundException | if no file could be selected |
| InvalidArgumentException | if $destination is not a stream |
| StreamException | if the file could not be uploaded |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::downloadToStreamByName | ( | string | $filename, |
| $destination, | |||
| array | $options = [] ) |
Writes the contents of a GridFS file, which is selected by name and revision, to a writable stream.
Supported options:
Revision numbers are defined as follows:
| string | $filename | Filename |
| resource | $destination | Writable Stream |
| array | $options | Download options |
| FileNotFoundException | if no file could be selected |
| InvalidArgumentException | if $destination is not a stream |
| StreamException | if the file could not be uploaded |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::drop | ( | ) |
Drops the files and chunks collections associated with this GridFS bucket.
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::find | ( | $filter = [], | |
| array | $options = [] ) |
Finds documents from the GridFS bucket's files collection matching the query.
| array | object | $filter | Query by which to filter documents |
| array | $options | Additional options |
| Cursor |
| UnsupportedException | if options are not supported by the selected server |
| InvalidArgumentException | for parameter/option parsing errors |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::findOne | ( | $filter = [], | |
| array | $options = [] ) |
Finds a single document from the GridFS bucket's files collection matching the query.
| array | object | $filter | Query by which to filter documents |
| array | $options | Additional options |
| array|object|null |
| UnsupportedException | if options are not supported by the selected server |
| InvalidArgumentException | for parameter/option parsing errors |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::getBucketName | ( | ) |
Return the bucket name.
| string |
| MongoDB\GridFS\Bucket::getChunksCollection | ( | ) |
Return the chunks collection.
| Collection |
| MongoDB\GridFS\Bucket::getChunkSizeBytes | ( | ) |
Return the chunk size in bytes.
| integer |
| MongoDB\GridFS\Bucket::getDatabaseName | ( | ) |
Return the database name.
| string |
| MongoDB\GridFS\Bucket::getFileDocumentForStream | ( | $stream | ) |
Gets the file document of the GridFS file associated with a stream.
| resource | $stream | GridFS stream |
| array|object |
| InvalidArgumentException | if $stream is not a GridFS stream |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::getFileIdForStream | ( | $stream | ) |
Gets the file document's ID of the GridFS file associated with a stream.
| resource | $stream | GridFS stream |
| mixed |
| CorruptFileException | if the file "_id" field does not exist |
| InvalidArgumentException | if $stream is not a GridFS stream |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::getFilesCollection | ( | ) |
Return the files collection.
| Collection |
| MongoDB\GridFS\Bucket::getReadConcern | ( | ) |
Return the read concern for this GridFS bucket.
| ReadConcern |
| MongoDB\GridFS\Bucket::getReadPreference | ( | ) |
Return the read preference for this GridFS bucket.
| ReadPreference |
| MongoDB\GridFS\Bucket::getTypeMap | ( | ) |
Return the type map for this GridFS bucket.
| array |
| MongoDB\GridFS\Bucket::getWriteConcern | ( | ) |
Return the write concern for this GridFS bucket.
| WriteConcern |
| MongoDB\GridFS\Bucket::openDownloadStream | ( | $id | ) |
Opens a readable stream for reading a GridFS file.
| mixed | $id | File ID |
| resource |
| FileNotFoundException | if no file could be selected |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::openDownloadStreamByName | ( | string | $filename, |
| array | $options = [] ) |
Opens a readable stream stream to read a GridFS file, which is selected by name and revision.
Supported options:
Revision numbers are defined as follows:
| string | $filename | Filename |
| array | $options | Download options |
| resource |
| FileNotFoundException | if no file could be selected |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::openUploadStream | ( | string | $filename, |
| array | $options = [] ) |
Opens a writable stream for writing a GridFS file.
Supported options:
| string | $filename | Filename |
| array | $options | Upload options |
| resource |
| MongoDB\GridFS\Bucket::rename | ( | $id, | |
| string | $newFilename ) |
Renames the GridFS file with the specified ID.
| mixed | $id | File ID |
| string | $newFilename | New filename |
| FileNotFoundException | if no file could be selected |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |
| MongoDB\GridFS\Bucket::uploadFromStream | ( | string | $filename, |
| $source, | |||
| array | $options = [] ) |
Writes the contents of a readable stream to a GridFS file.
Supported options:
| string | $filename | Filename |
| resource | $source | Readable stream |
| array | $options | Stream options |
| mixed | ID of the newly created GridFS file |
| InvalidArgumentException | if $source is not a GridFS stream |
| StreamException | if the file could not be uploaded |
| DriverRuntimeException | for other driver errors (e.g. connection errors) |