MediaWiki  REL1_24
ArchivedFile Class Reference

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

Collaboration diagram for ArchivedFile:

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

MediaHandler $handler
 *
Title $title
 *

Private Attributes

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

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 = '' 
)
Exceptions:
MWException
Parameters:
Title$title
int$id
string$key

Definition at line 82 of file ArchivedFile.php.

References $title, exists(), key, name, title, and user.


Member Function Documentation

Returns:
bool

Definition at line 287 of file ArchivedFile.php.

Referenced by __construct().

Return the bits of the image file, in bytes.

Returns:
int

Definition at line 363 of file ArchivedFile.php.

Return upload description.

Returns:
string

Definition at line 485 of file ArchivedFile.php.

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

Return the FileStore storage group.

Returns:
string

Definition at line 315 of file ArchivedFile.php.

Get a MediaHandler instance for this file.

Returns:
MediaHandler

Definition at line 383 of file ArchivedFile.php.

Return the height of the image.

Returns:
int

Definition at line 333 of file ArchivedFile.php.

Returns:
int

Definition at line 278 of file ArchivedFile.php.

References load().

Return the FileStore key.

Returns:
string

Definition at line 297 of file ArchivedFile.php.

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 413 of file ArchivedFile.php.

Get handler-specific metadata.

Returns:
string

Definition at line 343 of file ArchivedFile.php.

Returns the MIME type of the file.

Returns:
string

Definition at line 373 of file ArchivedFile.php.

Return the file name.

Returns:
string

Definition at line 267 of file ArchivedFile.php.

References Title\makeTitleSafe(), and title.

Referenced by EraseArchivedFile\scrubVersion().

Return upload description.

Returns:
string

Definition at line 521 of file ArchivedFile.php.

References load(), and user.

Return the user ID of the uploader.

Returns:
int

Definition at line 499 of file ArchivedFile.php.

Return the user name of the uploader.

Returns:
string

Definition at line 510 of file ArchivedFile.php.

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

Returns:
string
Since:
1.21

Definition at line 436 of file ArchivedFile.php.

Return the size of the image file, in bytes.

Returns:
int

Definition at line 353 of file ArchivedFile.php.

Return the FileStore key (overriding base File class)

Returns:
string

Definition at line 307 of file ArchivedFile.php.

Referenced by EraseArchivedFile\scrubVersion().

Return upload timestamp.

Returns:
string

Definition at line 424 of file ArchivedFile.php.

Referenced by EraseArchivedFile\scrubVersion().

Return the associated title object.

Returns:
Title

Definition at line 255 of file ArchivedFile.php.

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 452 of file ArchivedFile.php.

Return the user name of the uploader.

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

Definition at line 470 of file ArchivedFile.php.

Returns the deletion bitfield.

Returns:
int

Definition at line 531 of file ArchivedFile.php.

Return the width of the image.

Returns:
int

Definition at line 323 of file ArchivedFile.php.

for file or revision rows

Parameters:
int$fieldOne of DELETED_* bitfield constants
Returns:
bool

Definition at line 543 of file ArchivedFile.php.

References load().

Referenced by getDescription().

Loads a file object from the filearchive table.

Exceptions:
MWException
Returns:
bool|null True on success or null

Definition at line 127 of file ArchivedFile.php.

Referenced by getDescription(), getID(), getRawDescription(), and isDeleted().

Load ArchivedFile object fields from a DB row.

Parameters:
stdClass$rowObject database row
Since:
1.21

Definition at line 221 of file ArchivedFile.php.

static ArchivedFile::newFromRow ( row) [static]

Loads a file object from the filearchive table.

Parameters:
stdClass$row
Returns:
ArchivedFile

Definition at line 179 of file ArchivedFile.php.

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

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

Returns:
bool|int

Definition at line 396 of file ArchivedFile.php.

static ArchivedFile::selectFields ( ) [static]

Fields in the filearchive table.

Returns:
array

Definition at line 190 of file ArchivedFile.php.

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

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 556 of file ArchivedFile.php.


Member Data Documentation

string ArchivedFile::$archive_name [private]

Original base filename *.

Definition at line 70 of file ArchivedFile.php.

int ArchivedFile::$bits [private]

Size in bytes *.

Definition at line 40 of file ArchivedFile.php.

bool ArchivedFile::$dataLoaded [private]

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

Definition at line 60 of file ArchivedFile.php.

int ArchivedFile::$deleted [private]

Bitfield akin to rev_deleted *.

Definition at line 62 of file ArchivedFile.php.

string ArchivedFile::$description [private]

Upload description *.

Definition at line 52 of file ArchivedFile.php.

string ArchivedFile::$group [private]

FileStore storage group *.

Definition at line 34 of file ArchivedFile.php.

MediaHandler ArchivedFile::$handler [protected]

*

Definition at line 72 of file ArchivedFile.php.

int ArchivedFile::$height [private]

Height *.

Definition at line 44 of file ArchivedFile.php.

int ArchivedFile::$id [private]

Filearchive row ID *.

Definition at line 30 of file ArchivedFile.php.

string ArchivedFile::$key [private]

FileStore SHA-1 key *.

Definition at line 36 of file ArchivedFile.php.

string ArchivedFile::$media_type [private]

Media type *.

Definition at line 50 of file ArchivedFile.php.

string ArchivedFile::$metadata [private]

Metadata string *.

Definition at line 46 of file ArchivedFile.php.

string ArchivedFile::$mime [private]

MIME type *.

Definition at line 48 of file ArchivedFile.php.

string ArchivedFile::$name [private]

File name *.

Definition at line 32 of file ArchivedFile.php.

string ArchivedFile::$pageCount [private]

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

Definition at line 68 of file ArchivedFile.php.

string ArchivedFile::$sha1 [private]

SHA-1 hash of file content *.

Definition at line 64 of file ArchivedFile.php.

int ArchivedFile::$size [private]

File size in bytes *.

Definition at line 38 of file ArchivedFile.php.

string ArchivedFile::$timestamp [private]

Time of upload *.

Definition at line 58 of file ArchivedFile.php.

Title ArchivedFile::$title [protected]

*

Definition at line 74 of file ArchivedFile.php.

Referenced by __construct().

int ArchivedFile::$user [private]

User ID of uploader *.

Definition at line 54 of file ArchivedFile.php.

string ArchivedFile::$user_text [private]

User name of uploader *.

Definition at line 56 of file ArchivedFile.php.

int ArchivedFile::$width [private]

Width *.

Definition at line 42 of file ArchivedFile.php.


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