X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FStreamFile.php;h=a7522ea2b5f73ff62f846ad34786f01f0d4bd892;hb=22bf875d152751f5590508a1f44976c9db30cb44;hp=2503150129906e52f1e486a2e7ccf1d7f3a43d2c;hpb=4f42c2bbe4184830986910f9374bf913590b0096;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 2503150129..a7522ea2b5 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -39,10 +39,8 @@ class StreamFile { * @return bool Success */ public static function stream( $fname, $headers = array(), $sendErrors = true ) { - wfProfileIn( __METHOD__ ); if ( FileBackend::isStoragePath( $fname ) ) { // sanity - wfProfileOut( __METHOD__ ); throw new MWException( __FUNCTION__ . " given storage path '$fname'." ); } @@ -54,14 +52,11 @@ class StreamFile { if ( $res == self::NOT_MODIFIED ) { $ok = true; // use client cache } elseif ( $res == self::READY_STREAM ) { - wfProfileIn( __METHOD__ . '-send' ); $ok = readfile( $fname ); - wfProfileOut( __METHOD__ . '-send' ); } else { $ok = false; // failed } - wfProfileOut( __METHOD__ ); return $ok; } @@ -83,7 +78,7 @@ class StreamFile { ) { 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 ); @@ -131,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 } }