X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStreamFile.php;h=8d0b8f17275f8ea28ff99d578f487f6c5d526339;hb=41fdde6e811ff3aaf12ad334bb0dee0e2e41b373;hp=a52b25b02f9d217c4183418e6a3d3ba4d473552e;hpb=8fe5a94aa059bf93ba1b00fde84ae6b1edf831fd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StreamFile.php b/includes/StreamFile.php index a52b25b02f..8d0b8f1727 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -38,15 +38,15 @@ class StreamFile { * @throws MWException * @return bool Success */ - public static function stream( $fname, $headers = array(), $sendErrors = true ) { + public static function stream( $fname, $headers = [], $sendErrors = true ) { if ( FileBackend::isStoragePath( $fname ) ) { // sanity throw new MWException( __FUNCTION__ . " given storage path '$fname'." ); } - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $stat = stat( $fname ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); $res = self::prepareForStream( $fname, $stat, $headers, $sendErrors ); if ( $res == self::NOT_MODIFIED ) { @@ -74,11 +74,11 @@ class StreamFile { * @return int|bool READY_STREAM, NOT_MODIFIED, or false on failure */ public static function prepareForStream( - $path, $info, $headers = array(), $sendErrors = true + $path, $info, $headers = [], $sendErrors = true ) { if ( !is_array( $info ) ) { if ( $sendErrors ) { - header( 'HTTP/1.0 404 Not Found' ); + HttpStatus::header( 404 ); header( 'Cache-Control: no-cache' ); header( 'Content-Type: text/html; charset=utf-8' ); $encFile = htmlspecialchars( $path ); @@ -126,7 +126,7 @@ class StreamFile { $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); if ( wfTimestamp( TS_UNIX, $info['mtime'] ) <= strtotime( $modsince ) ) { ini_set( 'zlib.output_compression', 0 ); - header( "HTTP/1.0 304 Not Modified" ); + HttpStatus::header( 304 ); return self::NOT_MODIFIED; // ok } }