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

Detailed Description

Functions related to the output of file content.

Definition at line 37 of file StreamFile.php.

Member Function Documentation

◆ contentTypeFromPath()

static MediaWiki\Output\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 92 of file StreamFile.php.

References MediaWiki\MainConfigNames\CheckFileExtensions, MediaWiki\MainConfigNames\FileExtensions, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\MimeTypeExclusions, MediaWiki\MainConfigNames\ProhibitedFileExtensions, MediaWiki\MainConfigNames\StrictFileExtensions, MediaWiki\MainConfigNames\TrivialMimeDetection, and MediaWiki\MainConfigNames\VerifyMimeType.

◆ setHeader()

static MediaWiki\Output\StreamFile::setHeader ( $header)
static
Parameters
string$header
Access: internal

Definition at line 81 of file StreamFile.php.

References $header.

◆ stream()

static MediaWiki\Output\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
Returns
bool Success

Definition at line 53 of file StreamFile.php.


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