MediaWiki  REL1_19
StreamFile Class Reference

List of all members.

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

Detailed Description

Definition at line 7 of file StreamFile.php.


Member Function Documentation

static StreamFile::contentTypeFromPath ( filename,
safe = true 
) [static]

Determine the file type of a file based on the path.

Parameters:
$filenamestring Storage path or file system path
$safebool Whether to do retroactive upload blacklist checks
Returns:
null|string

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
$pathstring Storage path or file system path
$infoArray|false File stat info with 'mtime' and 'size' fields
$headersArray Additional headers to send
$sendErrorsbool Send error messages if errors occur (like 404)
Returns:
int|false READY_STREAM, NOT_MODIFIED, or false on failure

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$fnamestring Full name and path of the file to stream
$headersarray Any additional headers to send
$sendErrorsbool Send error messages if errors occur (like 404)
Returns:
bool Success

Definition at line 21 of file StreamFile.php.

References $fname, $res, prepareForStream(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by MediaTransformOutput\streamFile(), and wfStreamFile().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 9 of file StreamFile.php.

Referenced by prepareForStream(), and FileBackendStore\streamFile().

Definition at line 8 of file StreamFile.php.

Referenced by prepareForStream(), and FileBackendStore\streamFile().


The documentation for this class was generated from the following file: