97 return $this->path ? FileBackend::extensionFromPath( $this->path ) :
false;
115 return $this->storagePath;
126 if ( $this->path ===
false ) {
151 abstract public function toHtml( $options = [] );
175 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
185 return ( !$this->
isError() && $this->path ===
null );
199 if ( $this->path ===
null ) {
200 return $this->file->getLocalRefPath();
202 if ( FileBackend::isStoragePath( $this->path ) ) {
203 $be = $this->file->getRepo()->getBackend();
205 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
207 return $fsFile ? $fsFile->getPath() :
false;
220 if ( !$this->path ) {
221 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
224 $repo = $this->file->getRepo();
226 if ( $repo && FileBackend::isStoragePath( $this->path ) ) {
228 $repo->getBackend()->streamFile(
229 [
'src' => $this->path,
'headers' => $headers, ]
235 $repo ? $repo->getBackend()->getStreamerOptions() : []
240 : Status::newFatal(
'backend-fail-stream', $this->path );
263 protected function linkWrap( $linkAttribs, $contents ) {
264 if ( isset( $linkAttribs[
'href'] ) ) {
265 return Xml::tags(
'a', $linkAttribs, $contents );
267 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
268 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
269 if ( $parserEnableLegacyMediaDOM ) {
272 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
286 if ( $this->page && $this->page !== 1 ) {
287 $query[
'page'] = $this->page;
290 $query[
'lang'] = $this->lang;
298 'href' => $this->file->getTitle()->getLocalURL( $query ),
301 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
302 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
303 if ( $parserEnableLegacyMediaDOM ) {
304 $attribs[
'class'] =
'image';
306 $attribs[
'class'] =
'mw-file-description';
310 $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...
A class containing constants representing the names of configuration variables.