MediaWiki master
MWFileProps Class Reference

MimeMagic helper wrapper. More...

Public Member Functions

 __construct (MimeAnalyzer $magic)
 
 getPropsFromPath ( $path, $ext)
 Get an associative array containing information about a file with the given storage path.
 
 newPlaceholderProps ()
 Empty place holder props for non-existing files.
 

Detailed Description

MimeMagic helper wrapper.

Since
1.28

Definition at line 28 of file MWFileProps.php.

Constructor & Destructor Documentation

◆ __construct()

MWFileProps::__construct ( MimeAnalyzer $magic)
Parameters
MimeAnalyzer$magic

Definition at line 35 of file MWFileProps.php.

Member Function Documentation

◆ getPropsFromPath()

MWFileProps::getPropsFromPath ( $path,
$ext )

Get an associative array containing information about a file with the given storage path.

Resulting array fields include:

  • fileExists
  • size (filesize in bytes)
  • mime (as major/minor)
  • media_type (value to be used with the MEDIATYPE_xxx constants)
  • metadata (handler specific)
  • sha1 (in base 36)
  • width
  • height
  • bits (bitrate)
  • file-mime
  • major_mime
  • minor_mime
Parameters
string$pathFilesystem path to a file
string | bool | null$extThe file extension, or true to extract it from the filename. Set it to false to ignore the extension. Might be null in case the file is going to be stashed.
Returns
array
Since
1.28

Definition at line 64 of file MWFileProps.php.

References $path, FileBackend\extensionFromPath(), and newPlaceholderProps().

◆ newPlaceholderProps()

MWFileProps::newPlaceholderProps ( )

Empty place holder props for non-existing files.

Resulting array fields include:

  • fileExists
  • size (filesize in bytes)
  • mime (as major/minor)
  • media_type (value to be used with the MEDIATYPE_xxx constants)
  • metadata (handler specific)
  • sha1 (in base 36)
  • width
  • height
  • bits (bitrate)
  • file-mime
  • major_mime
  • minor_mime
Returns
array
Since
1.28

Definition at line 119 of file MWFileProps.php.

References MEDIATYPE_UNKNOWN, and FSFile\placeholderProps().

Referenced by getPropsFromPath().


The documentation for this class was generated from the following file: