Go to the documentation of this file.
60 return is_file( $this->path );
69 return filesize( $this->path );
94 return MimeMagic::singleton()->guessMimeType( $this->path,
false );
108 wfDebug( __METHOD__ .
": Getting file info for $this->path\n" );
111 $info[
'fileExists'] = $this->
exists();
113 if ( $info[
'fileExists'] ) {
114 $magic = MimeMagic::singleton();
116 # get the file extension
117 if (
$ext ===
true ) {
121 # mime type according to file contents
124 $info[
'mime'] = $magic->improveTypeFromExtension( $info[
'file-mime'],
$ext );
127 $info[
'media_type'] = $magic->getMediaType( $this->path, $info[
'mime'] );
130 $info[
'size'] = $this->
getSize();
132 # Height, width and metadata
136 $info[
'metadata'] = $handler->getMetadata( $tempImage, $this->path );
137 $gis = $handler->getImageSize( $tempImage, $this->path, $info[
'metadata'] );
138 if ( is_array( $gis ) ) {
144 wfDebug( __METHOD__ .
": $this->path loaded, {$info['size']} bytes, {$info['mime']}.\n" );
146 wfDebug( __METHOD__ .
": $this->path NOT FOUND!\n" );
161 $info[
'fileExists'] =
false;
162 $info[
'mime'] =
null;
164 $info[
'metadata'] =
'';
181 # NOTE: $gis[2] contains a code for the image type. This is no longer used.
182 $info[
'width'] = $gis[0];
183 $info[
'height'] = $gis[1];
184 if ( isset( $gis[
'bits'] ) ) {
185 $info[
'bits'] = $gis[
'bits'];
206 if ( $this->sha1Base36 !==
null && !$recache ) {
213 $this->sha1Base36 = sha1_file( $this->path );
216 if ( $this->sha1Base36 !==
false ) {
217 $this->sha1Base36 =
wfBaseConvert( $this->sha1Base36, 16, 36, 31 );
232 $i = strrpos(
$path,
'.' );
234 return strtolower( $i ? substr(
$path, $i + 1 ) :
'' );
246 $fsFile =
new self(
$path );
248 return $fsFile->getProps(
$ext );
262 $fsFile =
new self(
$path );
264 return $fsFile->getSha1Base36();
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 object
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
static getPropsFromPath( $path, $ext=true)
Get an associative array containing information about a file in the local filesystem.
getProps( $ext=true)
Get an associative array containing information about a file with the given storage path.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfProfileIn( $functionname)
Begin profiling of a function.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
getMimeType()
Guess the MIME type from the file contents alone.
static splitMime( $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
string $path
Path to file *.
static placeholderProps()
Placeholder file properties to use for files that don't exist.
__construct( $path)
Sets up the file object.
wfRestoreWarnings()
Restore error level to previous value.
static getSha1Base36FromPath( $path)
Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding,...
wfProfileOut( $functionname='missing')
Stop profiling of a function.
extractImageSizeInfo(array $gis)
Exract image size information.
exists()
Checks if the file exists.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getSha1Base36( $recache=false)
Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding,...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
getSize()
Get the file size in bytes.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Class representing a non-directory file on the file system.
getTimestamp()
Get the file's last-modified timestamp.
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...
getPath()
Returns the file system path.
string $sha1Base36
File SHA-1 in base 36 *.
static extensionFromPath( $path)
Get the final file extension from a file system path.