|
MediaWiki
REL1_23
|
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. | |
| 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 |
Functions related to the output of file content.
Definition at line 26 of file StreamFile.php.
| static StreamFile::contentTypeFromPath | ( | $ | filename, |
| $ | safe = true |
||
| ) | [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, $wgFileExtensions, $wgTrivialMimeDetection, UploadBase\checkFileExtensionList(), global, list, MimeMagic\singleton(), and UploadBase\splitExtensions().
Referenced by 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
| 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, as, contentTypeFromPath(), empty, NOT_MODIFIED, READY_STREAM, wfResetOutputBuffers(), and wfTimestamp().
Referenced by stream().
| 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.
| 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().
| const StreamFile::NOT_MODIFIED = 2 |
Definition at line 28 of file StreamFile.php.
Referenced by prepareForStream().
| const StreamFile::READY_STREAM = 1 |
Definition at line 27 of file StreamFile.php.
Referenced by prepareForStream().