Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 39 and 311]

(no description)

File Size: 343 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

StreamWrapper:: (15 methods):
  __destruct()
  getFile()
  register()
  stream_close()
  stream_eof()
  stream_open()
  stream_read()
  stream_seek()
  stream_stat()
  stream_tell()
  stream_write()
  getStatTemplate()
  initProtocol()
  initReadableStream()
  initWritableStream()


Class: StreamWrapper  - X-Ref

Stream wrapper for reading and writing a GridFS file.

__destruct()   X-Ref
No description

getFile()   X-Ref
Return the stream's file document.

return: stdClass

register($protocol = 'gridfs')   X-Ref
Register the GridFS stream wrapper.

param: string $protocol Protocol to use for stream_wrapper_register()

stream_close()   X-Ref
Closes the stream.


stream_eof()   X-Ref
Returns whether the file pointer is at the end of the stream.

return: boolean

stream_open($path, $mode, $options, &$openedPath)   X-Ref
Opens the stream.

param: string  $path       Path to the file resource
param: string  $mode       Mode used to open the file (only "r" and "w" are supported)
param: integer $options    Additional flags set by the streams API
param: string  $openedPath Not used
return: boolean

stream_read($length)   X-Ref
Read bytes from the stream.

Note: this method may return a string smaller than the requested length
if data is not available to be read.

param: integer $length Number of bytes to read
return: string

stream_seek($offset, $whence = SEEK_SET)   X-Ref
Return the current position of the stream.

param: integer $offset Stream offset to seek to
param: integer $whence One of SEEK_SET, SEEK_CUR, or SEEK_END
return: boolean True if the position was updated and false otherwise

stream_stat()   X-Ref
Return information about the stream.

return: array

stream_tell()   X-Ref
Return the current position of the stream.

return: integer The current position of the stream

stream_write($data)   X-Ref
Write bytes to the stream.

param: string $data Data to write
return: integer The number of bytes written

getStatTemplate()   X-Ref
Returns a stat template with default values.

return: array

initProtocol($path)   X-Ref
Initialize the protocol from the given path.

param: string $path

initReadableStream()   X-Ref
Initialize the internal stream for reading.

return: boolean

initWritableStream()   X-Ref
Initialize the internal stream for writing.

return: boolean