98 return $this->path ? FileBackend::extensionFromPath( $this->path ) :
false;
116 return $this->storagePath;
127 if ( $this->path ===
false ) {
152 abstract public function toHtml( $options = [] );
176 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
186 return ( !$this->
isError() && $this->path ===
null );
200 if ( $this->path ===
null ) {
201 return $this->file->getLocalRefPath();
203 if ( FileBackend::isStoragePath( $this->path ) ) {
204 $be = $this->file->getRepo()->getBackend();
206 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
208 return $fsFile ? $fsFile->getPath() :
false;
221 if ( !$this->path ) {
222 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
225 $repo = $this->file->getRepo();
227 if ( $repo && FileBackend::isStoragePath( $this->path ) ) {
229 $repo->getBackend()->streamFile(
230 [
'src' => $this->path,
'headers' => $headers, ]
236 $repo ? $repo->getBackend()->getStreamerOptions() : []
241 : Status::newFatal(
'backend-fail-stream', $this->path );
264 protected function linkWrap( $linkAttribs, $contents ) {
265 if ( isset( $linkAttribs[
'href'] ) ) {
266 return Xml::tags(
'a', $linkAttribs, $contents );
268 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
269 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
270 if ( $parserEnableLegacyMediaDOM ) {
273 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
282 if ( is_array( $params ) ) {
287 if ( $this->page && $this->page !== 1 ) {
288 $query[
'page'] = $this->page;
291 $query[
'lang'] = $this->lang;
294 if ( is_string( $params ) && $params !==
'' ) {
299 'href' => $this->file->getTitle()->getLocalURL( $query ),
302 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
303 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
304 if ( $parserEnableLegacyMediaDOM ) {
305 $attribs[
'class'] =
'image';
307 $attribs[
'class'] =
'mw-file-description';
311 $attribs[
'title'] = $title;
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
A class containing constants representing the names of configuration variables.