46 $fname, $headers = [], $sendErrors =
true, $optHeaders = [], $flags = 0
49 throw new InvalidArgumentException( __FUNCTION__ .
" given storage path '$fname'." );
55 'obResetFunc' =>
'wfResetOutputBuffers',
56 'streamMimeFunc' => [ __CLASS__,
'contentTypeFromPath' ]
60 return $streamer->stream( $headers, $sendErrors, $optHeaders, $flags );
96 $ext = strrchr( $filename,
'.' );
97 $ext =
$ext ===
false ?
'' : strtolower( substr(
$ext, 1 ) );
99 # trivial detection by file extension,
100 # used for thumbnails (thumb.php)
113 return 'unknown/unknown';
116 $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
120 $type = $magic->guessTypesForExtension(
$ext );
131 return 'unknown/unknown';
136 return 'unknown/unknown';
139 return 'unknown/unknown';
$wgFileExtensions
This is the list of preferred extensions for uploading files.
$wgCheckFileExtensions
This is a flag to determine whether or not to check file extensions on upload.
$wgVerifyMimeType
Determines if the MIME type of uploaded files should be checked.
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
$wgStrictFileExtensions
If this is turned off, users may override the warning for files not covered by $wgFileExtensions.
$wgMimeTypeBlacklist
Files with these MIME types will never be allowed as uploads if $wgVerifyMimeType is enabled.
$wgTrivialMimeDetection
Switch for trivial MIME detection.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
Functions related to the output of file content.
static send404Message( $fname, $flags=0)
Send out a standard 404 message for a file.
static parseRange( $range, $size)
Convert a Range header value to an absolute (start, end) range tuple.
Functions related to the output of file content.
static contentTypeFromPath( $filename, $safe=true)
Determine the file type of a file based on the path.
static parseRange( $range, $size)
Convert a Range header value to an absolute (start, end) range tuple.
static stream( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
static send404Message( $fname, $flags=0)
Send out a standard 404 message for a file.
static splitExtensions( $filename)
Split a file into a base name and all dot-delimited 'extensions' on the end.
static checkFileExtensionList( $ext, $list)
Perform case-insensitive match against a list of file extensions.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
if(!is_readable( $file)) $ext