MediaWiki REL1_39
StreamFile Class Reference

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 stream ( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
 Stream a file to the browser, adding all the headings and fun stuff.
 

Public Attributes

const STREAM_ALLOW_OB = HTTPFileStreamer::STREAM_ALLOW_OB
 
const STREAM_HEADLESS = HTTPFileStreamer::STREAM_HEADLESS
 

Detailed Description

Functions related to the output of file content.

Definition at line 30 of file StreamFile.php.

Member Function Documentation

◆ contentTypeFromPath()

static StreamFile::contentTypeFromPath ( $filename,
$safe = true )
static

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

Parameters
string$filenameStorage path or file system path
bool$safeWhether to do retroactive upload prevention checks
Returns
null|string

Definition at line 76 of file StreamFile.php.

References $ext, and $type.

Referenced by FileBackendDBRepoWrapper\streamFile().

◆ stream()

static StreamFile::stream ( $fname,
$headers = [],
$sendErrors = true,
$optHeaders = [],
$flags = 0 )
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
string$fnameFull name and path of the file to stream
array$headersAny additional headers to send if the file exists
bool$sendErrorsSend error messages if errors occur (like 404)
array$optHeadersHTTP request header map (e.g. "range") (use lowercase keys)
int$flagsBitfield of STREAM_* constants
Exceptions
MWException
Returns
bool Success

Definition at line 51 of file StreamFile.php.

References FileBackend\isStoragePath().

Referenced by MediaTransformOutput\streamFileWithStatus().

Member Data Documentation

◆ STREAM_ALLOW_OB

const StreamFile::STREAM_ALLOW_OB = HTTPFileStreamer::STREAM_ALLOW_OB
Deprecated
since 1.34

Definition at line 36 of file StreamFile.php.

◆ STREAM_HEADLESS

const StreamFile::STREAM_HEADLESS = HTTPFileStreamer::STREAM_HEADLESS
Deprecated
since 1.34

Definition at line 33 of file StreamFile.php.


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