Go to the documentation of this file.
46 throw new MWException( __FUNCTION__ .
" given storage path '$fname'." );
54 if (
$res == self::NOT_MODIFIED ) {
56 } elseif (
$res == self::READY_STREAM ) {
82 $path, $info, $headers =
array(), $sendErrors =
true
84 if ( !is_array( $info ) ) {
86 header(
'HTTP/1.0 404 Not Found' );
87 header(
'Cache-Control: no-cache' );
88 header(
'Content-Type: text/html; charset=utf-8' );
89 $encFile = htmlspecialchars(
$path );
90 $encScript = htmlspecialchars( $_SERVER[
'SCRIPT_NAME'] );
92 <h1>File not found</h1>
93 <p>Although this PHP script ($encScript) exists, the file requested for output
94 ($encFile) does not.</p>
109 header(
"Content-type: $type" );
115 header(
'Content-type: application/x-wiki' );
119 if ( headers_sent() ) {
120 echo
"Headers already sent, terminating.\n";
125 foreach ( $headers
as $header ) {
130 if ( !empty( $_SERVER[
'HTTP_IF_MODIFIED_SINCE'] ) ) {
131 $modsince = preg_replace(
'/;.*$/',
'', $_SERVER[
'HTTP_IF_MODIFIED_SINCE'] );
133 ini_set(
'zlib.output_compression', 0 );
134 header(
"HTTP/1.0 304 Not Modified" );
139 header(
'Content-Length: ' . $info[
'size'] );
154 $ext = strrchr( $filename,
'.' );
155 $ext =
$ext ===
false ?
'' : strtolower( substr(
$ext, 1 ) );
157 # trivial detection by file extension,
158 # used for thumbnails (thumb.php)
161 case 'gif':
return 'image/gif';
162 case 'png':
return 'image/png';
163 case 'jpg':
return 'image/jpeg';
164 case 'jpeg':
return 'image/jpeg';
167 return 'unknown/unknown';
170 $magic = MimeMagic::singleton();
174 $type = $magic->guessTypesForExtension(
$ext );
181 global $wgFileBlacklist, $wgCheckFileExtensions, $wgStrictFileExtensions,
185 return 'unknown/unknown';
187 if ( $wgCheckFileExtensions && $wgStrictFileExtensions
190 return 'unknown/unknown';
192 if ( $wgVerifyMimeType && in_array( strtolower(
$type ), $wgMimeTypeBlacklist ) ) {
193 return 'unknown/unknown';
wfResetOutputBuffers( $resetGzipEncoding=true)
Clear away any user-level output buffers, discarding contents.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static contentTypeFromPath( $filename, $safe=true)
Determine the file type of a file based on the path.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static checkFileExtensionList( $ext, $list)
Perform case-insensitive match against a list of file extensions.
wfProfileIn( $functionname)
Begin profiling of a function.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
static stream( $fname, $headers=array(), $sendErrors=true)
Stream a file to the browser, adding all the headings and fun stuff.
wfRestoreWarnings()
Restore error level to previous value.
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
if(! $wgHtml5Version && $wgAllowRdfaAttributes) $wgFileExtensions
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
Functions related to the output of file content.
static prepareForStream( $path, $info, $headers=array(), $sendErrors=true)
Call this function used in preparation before streaming a file.
static splitExtensions( $filename)
Split a file into a base name and all dot-delimited 'extensions' on the end.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.