MediaWiki master
|
Functions related to the output of file content. More...
Public Member Functions | |
__construct ( $path, array $params=[]) | |
stream ( $headers=[], $sendErrors=true, $optHeaders=[], $flags=0) | |
Stream a file to the browser, adding all the headings and fun stuff. | |
Static Public Member Functions | |
static | parseRange ( $range, $size) |
Convert a Range header value to an absolute (start, end) range tuple. | |
static | preprocessHeaders ( $headers) |
Takes HTTP headers in a name => value format and converts them to the weird format expected by stream(). | |
static | send404Message ( $fname, $flags=0) |
Send out a standard 404 message for a file. | |
Public Attributes | |
const | STREAM_ALLOW_OB = 2 |
const | STREAM_HEADLESS = 1 |
Static Protected Member Functions | |
static | contentTypeFromPath ( $filename) |
Determine the file type of a file based on the path. | |
static | resetOutputBuffers () |
Protected Attributes | |
callable | $headerFunc |
callable | $obResetFunc |
string | $path |
callable | $streamMimeFunc |
Functions related to the output of file content.
Definition at line 34 of file HTTPFileStreamer.php.
Wikimedia\FileBackend\HTTPFileStreamer::__construct | ( | $path, | |
array | $params = [] ) |
string | $path | Local filesystem path to a file |
array | $params | Options map, which includes:
|
Definition at line 77 of file HTTPFileStreamer.php.
References $params, and Wikimedia\FileBackend\HTTPFileStreamer\$path.
|
staticprotected |
Determine the file type of a file based on the path.
string | $filename | Storage path or file system path |
Definition at line 282 of file HTTPFileStreamer.php.
|
static |
Convert a Range header value to an absolute (start, end) range tuple.
string | $range | Range header value |
int | $size | File size |
Definition at line 239 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\HTTPFileStreamer\stream().
|
static |
Takes HTTP headers in a name => value format and converts them to the weird format expected by stream().
string[] | $headers |
Definition at line 56 of file HTTPFileStreamer.php.
References $header.
Referenced by MediaWiki\FileRepo\AuthenticatedFileEntryPoint\execute().
|
staticprotected |
Definition at line 266 of file HTTPFileStreamer.php.
|
static |
Send out a standard 404 message for a file.
string | $fname | Full name and path of the file to stream |
int | $flags | Bitfield of STREAM_* constants |
Definition at line 215 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\FileBackendStore\doStreamFile(), Wikimedia\FileBackend\SwiftFileBackend\doStreamFile(), and Wikimedia\FileBackend\HTTPFileStreamer\stream().
Wikimedia\FileBackend\HTTPFileStreamer::stream | ( | $headers = [], | |
$sendErrors = true, | |||
$optHeaders = [], | |||
$flags = 0 ) |
Stream a file to the browser, adding all the headings and fun stuff.
Headers sent include: Content-type, Content-Length, Last-Modified, and Content-Disposition.
array | $headers | Any additional headers to send if the file exists |
bool | $sendErrors | Send error messages if errors occur (like 404) |
array | $optHeaders | HTTP request header map (e.g. "range") (use lowercase keys) |
int | $flags | Bitfield of STREAM_* constants |
Definition at line 100 of file HTTPFileStreamer.php.
References $header, Wikimedia\FileBackend\HTTPFileStreamer\$headerFunc, Wikimedia\FileBackend\HTTPFileStreamer\parseRange(), Wikimedia\FileBackend\HTTPFileStreamer\send404Message(), and Wikimedia\FileBackend\HTTPFileStreamer\STREAM_HEADLESS.
Referenced by MediaTransformOutput\streamFileWithStatus().
|
protected |
Definition at line 42 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\HTTPFileStreamer\stream().
|
protected |
Definition at line 38 of file HTTPFileStreamer.php.
|
protected |
Definition at line 36 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\HTTPFileStreamer\__construct().
|
protected |
Definition at line 40 of file HTTPFileStreamer.php.
const Wikimedia\FileBackend\HTTPFileStreamer::STREAM_ALLOW_OB = 2 |
Definition at line 47 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\FileBackendStore\doStreamFile().
const Wikimedia\FileBackend\HTTPFileStreamer::STREAM_HEADLESS = 1 |
Definition at line 45 of file HTTPFileStreamer.php.
Referenced by Wikimedia\FileBackend\FileBackendStore\doStreamFile(), Wikimedia\FileBackend\SwiftFileBackend\doStreamFile(), and Wikimedia\FileBackend\HTTPFileStreamer\stream().