Go to the documentation of this file.
45 $this->mExists = $exists;
59 'prop' =>
'imageinfo',
63 'iiextmetadatamultilang' => 1,
66 $info =
$repo->getImageInfo( $data );
69 $lastRedirect = isset( $data[
'query'][
'redirects'] )
70 ? count( $data[
'query'][
'redirects'] ) - 1
72 if ( $lastRedirect >= 0 ) {
74 $img =
new self( $newtitle,
$repo, $info,
true );
93 return 'timestamp|user|comment|url|size|sha1|metadata|mime|mediatype|extmetadata';
125 $otherParams = $this->handler->makeParamString(
$params );
129 $thumbUrl = $this->repo->getThumbUrlFromCache(
135 if ( $thumbUrl ===
false ) {
138 return $this->repo->getThumbError(
147 return $this->handler->getTransform( $this,
'bogus', $thumbUrl,
$params );
157 return isset( $this->mInfo[
'width'] ) ? intval( $this->mInfo[
'width'] ) : 0;
165 return isset( $this->mInfo[
'height'] ) ? intval( $this->mInfo[
'height'] ) : 0;
172 if ( isset( $this->mInfo[
'metadata'] ) ) {
173 return serialize( self::parseMetadata( $this->mInfo[
'metadata'] ) );
184 if ( isset( $this->mInfo[
'extmetadata'] ) ) {
185 return $this->mInfo[
'extmetadata'];
196 if ( !is_array( $metadata ) ) {
200 foreach ( $metadata
as $meta ) {
211 return isset( $this->mInfo[
'size'] ) ? intval( $this->mInfo[
'size'] ) :
null;
218 return isset( $this->mInfo[
'url'] ) ? strval( $this->mInfo[
'url'] ) :
null;
226 return isset( $this->mInfo[
'user'] ) ? strval( $this->mInfo[
'user'] ) :
null;
235 return isset( $this->mInfo[
'comment'] ) ? strval( $this->mInfo[
'comment'] ) :
null;
242 return isset( $this->mInfo[
'sha1'] )
243 ?
wfBaseConvert( strval( $this->mInfo[
'sha1'] ), 16, 36, 31 )
252 isset( $this->mInfo[
'timestamp'] )
253 ? strval( $this->mInfo[
'timestamp'] )
262 if ( !isset( $this->mInfo[
'mime'] ) ) {
263 $magic = MimeMagic::singleton();
264 $this->mInfo[
'mime'] = $magic->guessTypesForExtension( $this->
getExtension() );
267 return $this->mInfo[
'mime'];
274 if ( isset( $this->mInfo[
'mediatype'] ) ) {
275 return $this->mInfo[
'mediatype'];
277 $magic = MimeMagic::singleton();
279 return $magic->getMediaType(
null, $this->
getMimeType() );
286 return isset( $this->mInfo[
'descriptionurl'] )
287 ? $this->mInfo[
'descriptionurl']
297 if ( $this->repo->canCacheThumbs() ) {
314 $iter = $this->repo->getBackend()->getFileList(
array(
'dir' =>
$dir ) );
335 $url = $this->repo->getDescriptionRenderUrl( $this->
getName(), $wgContLang->getCode() );
336 $key = $this->repo->getLocalCacheKey(
'RemoteFileDescription',
'url', md5(
$url ) );
347 $key = $this->repo->getLocalCacheKey(
'ForeignAPIRepo',
'ThumbUrl', $this->
getName() );
348 $wgMemc->delete( $key );
358 $purgeList =
array();
360 $purgeList[] =
"{$dir}{$file}";
363 # Delete the thumbnails
364 $this->repo->quickPurgeBatch( $purgeList );
365 # Clear out the thumbnail directory if empty
366 $this->repo->quickCleanDir(
$dir );
getExtension()
Get the file extension, e.g.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getThumbPath( $suffix='')
Only useful if we're locally caching thumbs anyway...
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
static newFromTitle(Title $title, $repo)
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
purgeCache( $options=array())
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
it s the revision text itself In either if gzip is the revision text is gzipped $flags
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
string $path
The storage path corresponding to one of the zones *.
Implements some public methods and some protected utility functions which are required by multiple ch...
getDBkey()
Get the main part with underscores.
string $url
The URL corresponding to one of the four basic zones *.
__construct( $title, $repo, $info, $exists=false)
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
purgeThumbnails( $options=array())
getDescription( $audience=self::FOR_PUBLIC, User $user=null)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
canRender()
Checks if the output of transform() for this file is likely to be valid.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
getName()
Return the name of this file.
transform( $params, $flags=0)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
if(PHP_SAPI !='cli') $file
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
assertRepoDefined()
Assert that $this->repo is set to a valid FileRepo instance.
if(count( $args)==0) $dir
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static parseMetadata( $metadata)
static getProps()
Get the property string for iiprop and aiprop.
getHandler()
Get a MediaHandler instance for this file.
Foreign file accessible through api.php requests.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getHashPath()
Get the filename hash component of the directory including trailing slash, e.g.