MediaWiki  1.28.0
ArchivedFile Class Reference

Class representing a row of the 'filearchive' table. More...

Collaboration diagram for ArchivedFile:

Public Member Functions

 __construct ($title, $id=0, $key= '', $sha1= '')
 
 exists ()
 
 getBits ()
 Return the bits of the image file, in bytes. More...
 
 getDescription ()
 Return upload description. More...
 
 getGroup ()
 Return the FileStore storage group. More...
 
 getHandler ()
 Get a MediaHandler instance for this file. More...
 
 getHeight ()
 Return the height of the image. More...
 
 getID ()
 
 getKey ()
 Return the FileStore key. More...
 
 getMediaType ()
 Return the type of the media in the file. More...
 
 getMetadata ()
 Get handler-specific metadata. More...
 
 getMimeType ()
 Returns the MIME type of the file. More...
 
 getName ()
 Return the file name. More...
 
 getRawDescription ()
 Return upload description. More...
 
 getRawUser ()
 Return the user ID of the uploader. More...
 
 getRawUserText ()
 Return the user name of the uploader. More...
 
 getSha1 ()
 Get the SHA-1 base 36 hash of the file. More...
 
 getSize ()
 Return the size of the image file, in bytes. More...
 
 getStorageKey ()
 Return the FileStore key (overriding base File class) More...
 
 getTimestamp ()
 Return upload timestamp. More...
 
 getTitle ()
 Return the associated title object. More...
 
 getUser ($type= 'text')
 Returns ID or name of user who uploaded the file. More...
 
 getUserText ()
 Return the user name of the uploader. More...
 
 getVisibility ()
 Returns the deletion bitfield. More...
 
 getWidth ()
 Return the width of the image. More...
 
 isDeleted ($field)
 for file or revision rows More...
 
 load ()
 Loads a file object from the filearchive table. More...
 
 loadFromRow ($row)
 Load ArchivedFile object fields from a DB row. More...
 
 pageCount ()
 Returns the number of pages of a multipage document, or false for documents which aren't multipage documents. More...
 
 userCan ($field, User $user=null)
 Determine if the current user is allowed to view a particular field of this FileStore image file, if it's marked as deleted. More...
 

Static Public Member Functions

static newFromRow ($row)
 Loads a file object from the filearchive table. More...
 
static selectFields ()
 Fields in the filearchive table. More...
 

Protected Attributes

MediaHandler $handler
 
Title $title
 

Private Attributes

string $archive_name
 Original base filename. More...
 
int $bits
 Size in bytes. More...
 
bool $dataLoaded
 Whether or not all this has been loaded from the database (loadFromXxx) More...
 
int $deleted
 Bitfield akin to rev_deleted. More...
 
string $description
 Upload description. More...
 
string $group
 FileStore storage group. More...
 
int $height
 Height. More...
 
int $id
 Filearchive row ID. More...
 
string $key
 FileStore SHA-1 key. More...
 
string $media_type
 Media type. More...
 
string $metadata
 Metadata string. More...
 
string $mime
 MIME type. More...
 
string $name
 File name. More...
 
string $pageCount
 Number of pages of a multipage document, or false for documents which aren't multipage documents. More...
 
string $sha1
 SHA-1 hash of file content. More...
 
int $size
 File size in bytes. More...
 
string $timestamp
 Time of upload. More...
 
int $user
 User ID of uploader. More...
 
string $user_text
 User name of uploader. More...
 
int $width
 Width. More...
 

Detailed Description

Class representing a row of the 'filearchive' table.

Definition at line 29 of file ArchivedFile.php.

Constructor & Destructor Documentation

ArchivedFile::__construct (   $title,
  $id = 0,
  $key = '',
  $sha1 = '' 
)
Exceptions
MWException
Parameters
Title$title
int$id
string$key
string$sha1

Definition at line 105 of file ArchivedFile.php.

References $id, $key, $sha1, exists(), Title\getDBkey(), key, name, File\normalizeTitle(), title, user, and width.

Member Function Documentation

ArchivedFile::exists ( )
Returns
bool

Definition at line 317 of file ArchivedFile.php.

References load().

Referenced by __construct(), and load().

ArchivedFile::getBits ( )

Return the bits of the image file, in bytes.

Returns
int

Definition at line 393 of file ArchivedFile.php.

References $bits, and load().

ArchivedFile::getDescription ( )

Return upload description.

Returns
string

Definition at line 516 of file ArchivedFile.php.

References $description, File\DELETED_COMMENT, isDeleted(), and load().

ArchivedFile::getGroup ( )

Return the FileStore storage group.

Returns
string

Definition at line 345 of file ArchivedFile.php.

References $group.

ArchivedFile::getHandler ( )

Get a MediaHandler instance for this file.

Returns
MediaHandler

Definition at line 413 of file ArchivedFile.php.

References $handler, MediaHandler\getHandler(), getMimeType(), and handler.

Referenced by pageCount().

ArchivedFile::getHeight ( )

Return the height of the image.

Returns
int

Definition at line 363 of file ArchivedFile.php.

References $height, and load().

ArchivedFile::getID ( )
Returns
int

Definition at line 308 of file ArchivedFile.php.

References $id, and load().

ArchivedFile::getKey ( )

Return the FileStore key.

Returns
string

Definition at line 327 of file ArchivedFile.php.

References $key, and load().

Referenced by getStorageKey().

ArchivedFile::getMediaType ( )

Return the type of the media in the file.

Use the value returned by this function with the MEDIATYPE_xxx constants.

Returns
string

Definition at line 444 of file ArchivedFile.php.

References $media_type, and load().

ArchivedFile::getMetadata ( )

Get handler-specific metadata.

Returns
string

Definition at line 373 of file ArchivedFile.php.

References $metadata, and load().

ArchivedFile::getMimeType ( )

Returns the MIME type of the file.

Returns
string

Definition at line 403 of file ArchivedFile.php.

References $mime, and load().

Referenced by getHandler().

ArchivedFile::getName ( )

Return the file name.

Returns
string

Definition at line 297 of file ArchivedFile.php.

References $name, load(), and name.

Referenced by EraseArchivedFile\scrubVersion().

ArchivedFile::getRawDescription ( )

Return upload description.

Returns
string

Definition at line 552 of file ArchivedFile.php.

References $description, and load().

ArchivedFile::getRawUser ( )

Return the user ID of the uploader.

Returns
int

Definition at line 530 of file ArchivedFile.php.

References $user, and load().

ArchivedFile::getRawUserText ( )

Return the user name of the uploader.

Returns
string

Definition at line 541 of file ArchivedFile.php.

References $user_text, and load().

ArchivedFile::getSha1 ( )

Get the SHA-1 base 36 hash of the file.

Returns
string
Since
1.21

Definition at line 467 of file ArchivedFile.php.

References $sha1, and load().

ArchivedFile::getSize ( )

Return the size of the image file, in bytes.

Returns
int

Definition at line 383 of file ArchivedFile.php.

References $size, and load().

ArchivedFile::getStorageKey ( )

Return the FileStore key (overriding base File class)

Returns
string

Definition at line 337 of file ArchivedFile.php.

References getKey().

Referenced by EraseArchivedFile\scrubVersion().

ArchivedFile::getTimestamp ( )

Return upload timestamp.

Returns
string

Definition at line 455 of file ArchivedFile.php.

References load(), TS_MW, and wfTimestamp().

Referenced by EraseArchivedFile\scrubVersion().

ArchivedFile::getTitle ( )

Return the associated title object.

Returns
Title

Definition at line 285 of file ArchivedFile.php.

References $title, load(), and title.

Referenced by userCan().

ArchivedFile::getUser (   $type = 'text')

Returns ID or name of user who uploaded the file.

Note
Prior to MediaWiki 1.23, this method always returned the user id, and was inconsistent with the rest of the file classes.
Parameters
string$type'text' or 'id'
Returns
int|string
Exceptions
MWException

Definition at line 483 of file ArchivedFile.php.

References $type, $user, $user_text, and load().

ArchivedFile::getUserText ( )

Return the user name of the uploader.

Deprecated:
since 1.23 Use getUser( 'text' ) instead.
Returns
string

Definition at line 501 of file ArchivedFile.php.

References $user_text, File\DELETED_USER, isDeleted(), load(), and wfDeprecated().

ArchivedFile::getVisibility ( )

Returns the deletion bitfield.

Returns
int

Definition at line 562 of file ArchivedFile.php.

References $deleted, and load().

ArchivedFile::getWidth ( )

Return the width of the image.

Returns
int

Definition at line 353 of file ArchivedFile.php.

References $width, and load().

ArchivedFile::isDeleted (   $field)

for file or revision rows

Parameters
int$fieldOne of DELETED_* bitfield constants
Returns
bool

Definition at line 574 of file ArchivedFile.php.

References load().

Referenced by getDescription(), and getUserText().

ArchivedFile::load ( )
ArchivedFile::loadFromRow (   $row)

Load ArchivedFile object fields from a DB row.

Parameters
stdClass$rowObject database row
Since
1.21

Definition at line 251 of file ArchivedFile.php.

References LocalRepo\getHashFromKey(), key, Title\makeTitleSafe(), name, NS_FILE, title, user, and width.

Referenced by load().

static ArchivedFile::newFromRow (   $row)
static

Loads a file object from the filearchive table.

Parameters
stdClass$row
Returns
ArchivedFile

Definition at line 209 of file ArchivedFile.php.

References Title\makeTitle(), and NS_FILE.

Referenced by RevDelArchivedFileItem\__construct(), ApiQueryFilearchive\execute(), EraseArchivedFile\execute(), SpecialUndelete\formatFileRow(), and EraseArchivedFile\scrubAllVersions().

ArchivedFile::pageCount ( )

Returns the number of pages of a multipage document, or false for documents which aren't multipage documents.

Returns
bool|int

Definition at line 426 of file ArchivedFile.php.

References $pageCount, getHandler(), and handler.

static ArchivedFile::selectFields ( )
static

Fields in the filearchive table.

Returns
array

Definition at line 220 of file ArchivedFile.php.

Referenced by RevDelArchivedFileList\doQuery(), ApiQueryFilearchive\execute(), LocalFileRestoreBatch\execute(), and PageArchive\listFiles().

ArchivedFile::userCan (   $field,
User  $user = null 
)

Determine if the current user is allowed to view a particular field of this FileStore image file, if it's marked as deleted.

Parameters
int$field
null | User$userUser object to check, or null to use $wgUser
Returns
bool

Definition at line 587 of file ArchivedFile.php.

References getTitle(), load(), and Revision\userCanBitfield().

Member Data Documentation

string ArchivedFile::$archive_name
private

Original base filename.

Definition at line 90 of file ArchivedFile.php.

int ArchivedFile::$bits
private

Size in bytes.

Definition at line 46 of file ArchivedFile.php.

Referenced by getBits().

bool ArchivedFile::$dataLoaded
private

Whether or not all this has been loaded from the database (loadFromXxx)

Definition at line 76 of file ArchivedFile.php.

int ArchivedFile::$deleted
private

Bitfield akin to rev_deleted.

Definition at line 79 of file ArchivedFile.php.

Referenced by getVisibility().

string ArchivedFile::$description
private

Upload description.

Definition at line 64 of file ArchivedFile.php.

Referenced by getDescription(), and getRawDescription().

string ArchivedFile::$group
private

FileStore storage group.

Definition at line 37 of file ArchivedFile.php.

Referenced by getGroup(), and load().

MediaHandler ArchivedFile::$handler
protected

Definition at line 93 of file ArchivedFile.php.

Referenced by getHandler().

int ArchivedFile::$height
private

Height.

Definition at line 52 of file ArchivedFile.php.

Referenced by getHeight().

int ArchivedFile::$id
private

Filearchive row ID.

Definition at line 31 of file ArchivedFile.php.

Referenced by __construct(), getID(), and load().

string ArchivedFile::$key
private

FileStore SHA-1 key.

Definition at line 40 of file ArchivedFile.php.

Referenced by __construct(), getKey(), and load().

string ArchivedFile::$media_type
private

Media type.

Definition at line 61 of file ArchivedFile.php.

Referenced by getMediaType().

string ArchivedFile::$metadata
private

Metadata string.

Definition at line 55 of file ArchivedFile.php.

Referenced by getMetadata().

string ArchivedFile::$mime
private

MIME type.

Definition at line 58 of file ArchivedFile.php.

Referenced by getMimeType().

string ArchivedFile::$name
private

File name.

Definition at line 34 of file ArchivedFile.php.

Referenced by getName().

string ArchivedFile::$pageCount
private

Number of pages of a multipage document, or false for documents which aren't multipage documents.

Definition at line 87 of file ArchivedFile.php.

Referenced by pageCount().

string ArchivedFile::$sha1
private

SHA-1 hash of file content.

Definition at line 82 of file ArchivedFile.php.

Referenced by __construct(), getSha1(), and load().

int ArchivedFile::$size
private

File size in bytes.

Definition at line 43 of file ArchivedFile.php.

Referenced by getSize().

string ArchivedFile::$timestamp
private

Time of upload.

Definition at line 73 of file ArchivedFile.php.

Title ArchivedFile::$title
protected

Definition at line 96 of file ArchivedFile.php.

Referenced by getTitle().

int ArchivedFile::$user
private

User ID of uploader.

Definition at line 67 of file ArchivedFile.php.

Referenced by getRawUser(), and getUser().

string ArchivedFile::$user_text
private

User name of uploader.

Definition at line 70 of file ArchivedFile.php.

Referenced by getRawUserText(), getUser(), and getUserText().

int ArchivedFile::$width
private

Width.

Definition at line 49 of file ArchivedFile.php.

Referenced by getWidth().


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