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 ) {
202 return $this->file->getLocalRefPath();
204 if ( FileBackend::isStoragePath( $this->path ) ) {
205 $be = $this->file->getRepo()->getBackend();
207 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
209 return $fsFile ? $fsFile->getPath() :
false;
223 if ( !$this->path ) {
224 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
227 $repo = $this->file->getRepo();
229 if ( $repo && FileBackend::isStoragePath( $this->path ) ) {
231 $repo->getBackend()->streamFile(
232 [
'src' => $this->path,
'headers' => $headers, ]
239 $repo ? $repo->getBackend()->getStreamerOptions() : []
245 : Status::newFatal(
'backend-fail-stream', $this->path );
267 protected function linkWrap( $linkAttribs, $contents ) {
268 if ( isset( $linkAttribs[
'href'] ) ) {
269 return Html::rawElement(
'a', $linkAttribs, $contents );
271 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
272 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
273 if ( $parserEnableLegacyMediaDOM ) {
276 return Html::rawElement(
'span', $linkAttribs ?:
null, $contents );
285 if ( is_array( $params ) ) {
290 if ( $this->page && $this->page !== 1 ) {
291 $query[
'page'] = $this->page;
294 $query[
'lang'] = $this->lang;
297 if ( is_string( $params ) && $params !==
'' ) {
302 'href' => $this->file->getTitle()->getLocalURL( $query ),
305 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
306 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
307 if ( $parserEnableLegacyMediaDOM ) {
308 $attribs[
'class'] =
'image';
310 $attribs[
'class'] =
'mw-file-description';
314 $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.