96 return $this->path ? FileBackend::extensionFromPath( $this->path ) :
false;
114 return $this->storagePath;
125 if ( $this->path ===
false ) {
150 abstract public function toHtml( $options = [] );
174 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
184 return ( !$this->
isError() && $this->path ===
null );
198 if ( $this->path ===
null ) {
199 return $this->file->getLocalRefPath();
201 if ( FileBackend::isStoragePath( $this->path ) ) {
202 $be = $this->file->getRepo()->getBackend();
204 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
206 return $fsFile ? $fsFile->getPath() :
false;
219 if ( !$this->path ) {
220 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
223 $repo = $this->file->getRepo();
225 if ( $repo && FileBackend::isStoragePath( $this->path ) ) {
227 $repo->getBackend()->streamFile(
228 [
'src' => $this->path,
'headers' => $headers, ]
234 $repo ? $repo->getBackend()->getStreamerOptions() : []
239 : Status::newFatal(
'backend-fail-stream', $this->path );
262 protected function linkWrap( $linkAttribs, $contents ) {
263 if ( isset( $linkAttribs[
'href'] ) ) {
264 return Xml::tags(
'a', $linkAttribs, $contents );
266 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
267 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
268 if ( $parserEnableLegacyMediaDOM ) {
271 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
285 if ( $this->page && $this->page !== 1 ) {
286 $query[
'page'] = $this->page;
289 $query[
'lang'] = $this->lang;
297 'href' => $this->file->getTitle()->getLocalURL( $query ),
300 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
301 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
302 if ( $parserEnableLegacyMediaDOM ) {
303 $attribs[
'class'] =
'image';
305 $attribs[
'class'] =
'mw-file-description';
309 $attribs[
'title'] = $title;
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
array $params
The job parameters.
Implements some public methods and some protected utility functions which are required by multiple ch...
Functions related to the output of file content.
stream( $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
A class containing constants representing the names of configuration variables.