|
MediaWiki
1.23.0
|
Functions related to the output of file content. More...
Static Public Member Functions | |
| static | contentTypeFromPath ( $filename, $safe=true) |
| Determine the file type of a file based on the path. More... | |
| static | prepareForStream ( $path, $info, $headers=array(), $sendErrors=true) |
| Call this function used in preparation before streaming a file. More... | |
| static | stream ( $fname, $headers=array(), $sendErrors=true) |
| Stream a file to the browser, adding all the headings and fun stuff. More... | |
Public Attributes | |
| const | NOT_MODIFIED = 2 |
| const | READY_STREAM = 1 |
Functions related to the output of file content.
Definition at line 26 of file StreamFile.php.
|
static |
Determine the file type of a file based on the path.
| string | $filename | Storage path or file system path |
| bool | $safe | Whether to do retroactive upload blacklist checks |
Definition at line 151 of file StreamFile.php.
References $ext, $type, $wgFileExtensions, $wgTrivialMimeDetection, UploadBase\checkFileExtensionList(), global, list, and UploadBase\splitExtensions().
Referenced by FileBackendStore\__construct(), and prepareForStream().
Call this function used in preparation before streaming a file.
This function does the following: (a) sends Last-Modified, Content-type, and Content-Disposition headers (b) cancels any PHP output buffering and automatic gzipping of output (c) sends Content-Length header based on HTTP_IF_MODIFIED_SINCE check
| string | $path | Storage path or file system path |
| array | bool | $info | File stat info with 'mtime' and 'size' fields |
| array | $headers | Additional headers to send |
| bool | $sendErrors | Send error messages if errors occur (like 404) |
Definition at line 81 of file StreamFile.php.
References $path, $type, as, contentTypeFromPath(), NOT_MODIFIED, READY_STREAM, TS_RFC2822, TS_UNIX, wfResetOutputBuffers(), and wfTimestamp().
Referenced by stream(), and FileBackendStore\streamFile().
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.
| string | $fname | Full name and path of the file to stream |
| array | $headers | Any additional headers to send |
| bool | $sendErrors | Send error messages if errors occur (like 404) |
| MWException |
Definition at line 41 of file StreamFile.php.
References $fname, $ok, $res, FileBackend\isStoragePath(), prepareForStream(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by MediaTransformOutput\streamFile().
| const StreamFile::NOT_MODIFIED = 2 |
Definition at line 28 of file StreamFile.php.
Referenced by prepareForStream(), and FileBackendStore\streamFile().
| const StreamFile::READY_STREAM = 1 |
Definition at line 27 of file StreamFile.php.
Referenced by prepareForStream(), and FileBackendStore\streamFile().