|
MediaWiki
REL1_19
|
Static Public Member Functions | |
| static | contentTypeFromPath ($filename, $safe=true) |
| Determine the file type of a file based on the path. | |
| static | prepareForStream ($path, $info, $headers=array(), $sendErrors=true) |
| Call this function used in preparation before streaming a file. | |
| static | stream ($fname, $headers=array(), $sendErrors=true) |
| Stream a file to the browser, adding all the headings and fun stuff. | |
Public Attributes | |
| const | NOT_MODIFIED = 2 |
| const | READY_STREAM = 1 |
Definition at line 7 of file StreamFile.php.
| static StreamFile::contentTypeFromPath | ( | $ | filename, |
| $ | safe = true |
||
| ) | [static] |
Determine the file type of a file based on the path.
| $filename | string Storage path or file system path |
| $safe | bool Whether to do retroactive upload blacklist checks |
Definition at line 124 of file StreamFile.php.
References $ext, $wgCheckFileExtensions, $wgFileBlacklist, $wgFileExtensions, $wgMimeTypeBlacklist, $wgStrictFileExtensions, $wgTrivialMimeDetection, $wgVerifyMimeType, UploadBase\checkFileExtensionList(), MimeMagic\singleton(), and UploadBase\splitExtensions().
Referenced by SwiftFileBackend\doCreateInternal(), SwiftFileBackend\doStoreInternal(), and prepareForStream().


| static StreamFile::prepareForStream | ( | $ | path, |
| $ | info, | ||
| $ | headers = array(), |
||
| $ | sendErrors = true |
||
| ) | [static] |
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
| $path | string Storage path or file system path |
| $info | Array|false File stat info with 'mtime' and 'size' fields |
| $headers | Array Additional headers to send |
| $sendErrors | bool Send error messages if errors occur (like 404) |
Definition at line 49 of file StreamFile.php.
References $path, $wgLanguageCode, contentTypeFromPath(), echo, NOT_MODIFIED, READY_STREAM, wfResetOutputBuffers(), and wfTimestamp().
Referenced by stream(), and FileBackendStore\streamFile().


| static StreamFile::stream | ( | $ | fname, |
| $ | headers = array(), |
||
| $ | sendErrors = true |
||
| ) | [static] |
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.
| $fname | string Full name and path of the file to stream |
| $headers | array Any additional headers to send |
| $sendErrors | bool Send error messages if errors occur (like 404) |
Definition at line 21 of file StreamFile.php.
References $fname, $res, prepareForStream(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by MediaTransformOutput\streamFile(), and wfStreamFile().


| const StreamFile::NOT_MODIFIED = 2 |
Definition at line 9 of file StreamFile.php.
Referenced by prepareForStream(), and FileBackendStore\streamFile().
| const StreamFile::READY_STREAM = 1 |
Definition at line 8 of file StreamFile.php.
Referenced by prepareForStream(), and FileBackendStore\streamFile().