コード例 #1
0
 /**
  * @see FileBackendStore::streamFile()
  * @param array $params
  * @return StatusValue
  */
 protected function doStreamFile(array $params)
 {
     $status = $this->newStatus();
     $flags = 0;
     $flags |= !empty($params['headless']) ? HTTPFileStreamer::STREAM_HEADLESS : 0;
     $flags |= !empty($params['allowOB']) ? HTTPFileStreamer::STREAM_ALLOW_OB : 0;
     $fsFile = $this->getLocalReference($params);
     if ($fsFile) {
         $streamer = new HTTPFileStreamer($fsFile->getPath(), ['obResetFunc' => $this->obResetFunc, 'streamMimeFunc' => $this->streamMimeFunc]);
         $res = $streamer->stream($params['headers'], true, $params['options'], $flags);
     } else {
         $res = false;
         HTTPFileStreamer::send404Message($params['src'], $flags);
     }
     if (!$res) {
         $status->fatal('backend-fail-stream', $params['src']);
     }
     return $status;
 }
コード例 #2
0
ファイル: StreamFile.php プロジェクト: paladox/mediawiki
 /**
  * Convert a Range header value to an absolute (start, end) range tuple
  *
  * @param string $range Range header value
  * @param integer $size File size
  * @return array|string Returns error string on failure (start, end, length)
  * @since 1.24
  */
 public static function parseRange($range, $size)
 {
     return HTTPFileStreamer::parseRange($range, $size);
 }