X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2FStreamFile.php;h=c9b2c33b9a7ae25b2341e2cd7646a55d5a844b23;hb=73ef860025ca4bd9a605a013f30e267a5da5d659;hp=cce3fc464b10a671a7124cd5f53837c17923627a;hpb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StreamFile.php b/includes/StreamFile.php index cce3fc464b..c9b2c33b9a 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -25,8 +25,10 @@ */ class StreamFile { // Do not send any HTTP headers unless requested by caller (e.g. body only) + /** @deprecated since 1.34 */ const STREAM_HEADLESS = HTTPFileStreamer::STREAM_HEADLESS; // Do not try to tear down any PHP output buffers + /** @deprecated since 1.34 */ const STREAM_ALLOW_OB = HTTPFileStreamer::STREAM_ALLOW_OB; /** @@ -38,7 +40,7 @@ class StreamFile { * @param array $headers Any additional headers to send if the file exists * @param bool $sendErrors Send error messages if errors occur (like 404) * @param array $optHeaders HTTP request header map (e.g. "range") (use lowercase keys) - * @param integer $flags Bitfield of STREAM_* constants + * @param int $flags Bitfield of STREAM_* constants * @throws MWException * @return bool Success */ @@ -64,10 +66,12 @@ class StreamFile { * Send out a standard 404 message for a file * * @param string $fname Full name and path of the file to stream - * @param integer $flags Bitfield of STREAM_* constants + * @param int $flags Bitfield of STREAM_* constants * @since 1.24 + * @deprecated since 1.34, use HTTPFileStreamer::send404Message() instead */ public static function send404Message( $fname, $flags = 0 ) { + wfDeprecated( __METHOD__, '1.34' ); HTTPFileStreamer::send404Message( $fname, $flags ); } @@ -75,11 +79,13 @@ class StreamFile { * Convert a Range header value to an absolute (start, end) range tuple * * @param string $range Range header value - * @param integer $size File size + * @param int $size File size * @return array|string Returns error string on failure (start, end, length) * @since 1.24 + * @deprecated since 1.34, use HTTPFileStreamer::parseRange() instead */ public static function parseRange( $range, $size ) { + wfDeprecated( __METHOD__, '1.34' ); return HTTPFileStreamer::parseRange( $range, $size ); } @@ -105,7 +111,6 @@ class StreamFile { case 'png': return 'image/png'; case 'jpg': - return 'image/jpeg'; case 'jpeg': return 'image/jpeg'; } @@ -113,7 +118,7 @@ class StreamFile { return 'unknown/unknown'; } - $magic = MimeMagic::singleton(); + $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer(); // Use the extension only, rather than magic numbers, to avoid opening // up vulnerabilities due to uploads of files with allowed extensions // but disallowed types.