MediaWiki  REL1_24
OldLocalFile Class Reference

Class to represent a file in the oldimage table. More...

Inheritance diagram for OldLocalFile:
Collaboration diagram for OldLocalFile:

List of all members.

Public Member Functions

 __construct ($title, $repo, $time, $archiveName)
 exists ()
 If archive name is an empty string, then file does not "exist".
 getArchiveName ()
 getCacheFields ($prefix= 'img_')
 getCacheKey ()
 getRel ()
 getUrlRel ()
 getVisibility ()
 Returns bitfield value.
 isDeleted ($field)
 isOld ()
 isVisible ()
 loadFromDB ($flags=0)
 Load file metadata from the DB.
 recordOldUpload ($srcPath, $archiveName, $timestamp, $comment, $user)
 Record a file upload in the oldimage table, without adding log entries.
 upgradeRow ()
 Fix assorted version-related problems with the image row by reloading it from the file.
 uploadOld ($srcPath, $archiveName, $timestamp, $comment, $user, $flags=0)
 Upload a file directly into archive.
 userCan ($field, User $user=null)
 Determine if the current user is allowed to view a particular field of this image file, if it's marked as deleted.

Static Public Member Functions

static newFromArchiveName ($title, $repo, $archiveName)
static newFromKey ($sha1, $repo, $timestamp=false)
 Create a OldLocalFile from a SHA-1 key Do not call this except from inside a repo class.
static newFromRow ($row, $repo)
static newFromTitle ($title, $repo, $time=null)
static selectFields ()
 Fields in the oldimage table.

Public Attributes

const CACHE_VERSION = 1
const MAX_CACHE_ROWS = 20

Protected Member Functions

 loadExtraFromDB ()
 Load lazy file metadata from the DB.

Protected Attributes

string $archive_name
 Archive name *.
string $requestedTime
 Timestamp *.

Detailed Description

Class to represent a file in the oldimage table.

Definition at line 29 of file OldLocalFile.php.


Constructor & Destructor Documentation

OldLocalFile::__construct ( title,
repo,
time,
archiveName 
)
Parameters:
Title$title
FileRepo$repo
string$timeTimestamp or null to load by archive name
string$archiveNameArchive name or null to load by timestamp
Exceptions:
MWException

Definition at line 134 of file OldLocalFile.php.


Member Function Documentation

If archive name is an empty string, then file does not "exist".

This is the case for a couple files on Wikimedia servers where the old version is "lost".

Reimplemented from LocalFile.

Definition at line 412 of file OldLocalFile.php.

Returns:
string

Definition at line 153 of file OldLocalFile.php.

OldLocalFile::getCacheFields ( prefix = 'img_')
Parameters:
string$prefix
Returns:
array

Reimplemented from LocalFile.

Definition at line 238 of file OldLocalFile.php.

Returns:
bool

Reimplemented from LocalFile.

Definition at line 146 of file OldLocalFile.php.

Returns:
string

Reimplemented from File.

Definition at line 249 of file OldLocalFile.php.

Returns:
string

Reimplemented from File.

Definition at line 256 of file OldLocalFile.php.

Returns bitfield value.

Returns:
int

Reimplemented from File.

Definition at line 310 of file OldLocalFile.php.

Parameters:
int$fieldOne of DELETED_* bitfield constants for file or revision rows
Returns:
bool

Reimplemented from File.

Definition at line 300 of file OldLocalFile.php.

Returns:
bool

Reimplemented from File.

Definition at line 164 of file OldLocalFile.php.

Returns:
bool

Reimplemented from File.

Definition at line 171 of file OldLocalFile.php.

Load lazy file metadata from the DB.

Reimplemented from LocalFile.

Definition at line 201 of file OldLocalFile.php.

OldLocalFile::loadFromDB ( flags = 0)

Load file metadata from the DB.

Parameters:
int$flags

Reimplemented from LocalFile.

Definition at line 175 of file OldLocalFile.php.

static OldLocalFile::newFromArchiveName ( title,
repo,
archiveName 
) [static]
Parameters:
Title$title
FileRepo$repo
string$archiveName
Returns:
OldLocalFile

Definition at line 59 of file OldLocalFile.php.

static OldLocalFile::newFromKey ( sha1,
repo,
timestamp = false 
) [static]

Create a OldLocalFile from a SHA-1 key Do not call this except from inside a repo class.

Parameters:
string$sha1Base-36 SHA-1
LocalRepo$repo
string | bool$timestampMW_timestamp (optional)
Returns:
bool|OldLocalFile

Reimplemented from LocalFile.

Definition at line 86 of file OldLocalFile.php.

static OldLocalFile::newFromRow ( row,
repo 
) [static]
Parameters:
stdClass$row
FileRepo$repo
Returns:
OldLocalFile

Reimplemented from LocalFile.

Definition at line 68 of file OldLocalFile.php.

static OldLocalFile::newFromTitle ( title,
repo,
time = null 
) [static]
Parameters:
Title$title
FileRepo$repo
null | int$timeTimestamp or null
Returns:
OldLocalFile
Exceptions:
MWException

Reimplemented from LocalFile.

Definition at line 44 of file OldLocalFile.php.

OldLocalFile::recordOldUpload ( srcPath,
archiveName,
timestamp,
comment,
user 
)

Record a file upload in the oldimage table, without adding log entries.

Parameters:
string$srcPathFile system path to the source file
string$archiveNameThe archive name of the file
string$timestamp
string$commentUpload comment
User$userUser who did this upload
Returns:
bool

Definition at line 371 of file OldLocalFile.php.

static OldLocalFile::selectFields ( ) [static]

Fields in the oldimage table.

Returns:
array

Reimplemented from LocalFile.

Definition at line 106 of file OldLocalFile.php.

Fix assorted version-related problems with the image row by reloading it from the file.

Reimplemented from LocalFile.

Definition at line 260 of file OldLocalFile.php.

OldLocalFile::uploadOld ( srcPath,
archiveName,
timestamp,
comment,
user,
flags = 0 
)

Upload a file directly into archive.

Generally for Special:Import.

Parameters:
string$srcPathFile system path of the source file
string$archiveNameFull archive name of the file, in the form $timestamp!$filename, where $filename must match $this->getName()
string$timestamp
string$comment
User$user
int$flags
Returns:
FileRepoStatus

Definition at line 342 of file OldLocalFile.php.

OldLocalFile::userCan ( field,
User user = null 
)

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

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

Reimplemented from File.

Definition at line 324 of file OldLocalFile.php.


Member Data Documentation

string OldLocalFile::$archive_name [protected]

Archive name *.

Definition at line 32 of file OldLocalFile.php.

string OldLocalFile::$requestedTime [protected]

Timestamp *.

Definition at line 30 of file OldLocalFile.php.

Definition at line 34 of file OldLocalFile.php.

Definition at line 35 of file OldLocalFile.php.


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