112 return $this->storagePath;
123 if ( $this->path ===
false ) {
148 abstract public function toHtml( $options = [] );
172 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
182 return ( !$this->
isError() && $this->path ===
null );
196 if ( $this->path ===
null ) {
197 return $this->file->getLocalRefPath();
200 $be = $this->file->getRepo()->getBackend();
202 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
204 return $fsFile ? $fsFile->getPath() :
false;
217 if ( !$this->path ) {
218 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
221 $repo = $this->file->getRepo();
225 $repo->getBackend()->streamFile(
226 [
'src' => $this->path,
'headers' => $headers, ]
232 $repo ? $repo->getBackend()->getStreamerOptions() : []
237 : Status::newFatal(
'backend-fail-stream', $this->path );
260 protected function linkWrap( $linkAttribs, $contents ) {
261 if ( isset( $linkAttribs[
'href'] ) ) {
262 return Xml::tags(
'a', $linkAttribs, $contents );
264 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
265 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
266 if ( $parserEnableLegacyMediaDOM ) {
269 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
283 if ( $this->page && $this->page !== 1 ) {
284 $query[
'page'] = $this->page;
287 $query[
'lang'] = $this->lang;
295 'href' => $this->file->getTitle()->getLocalURL( $query ),
298 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
299 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
300 if ( $parserEnableLegacyMediaDOM ) {
301 $attribs[
'class'] =
'image';
303 $attribs[
'class'] =
'mw-file-description';
307 $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.
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
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.