MediaWiki  REL1_22
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)
 getArchiveName ()
 getCacheFields ($prefix= 'img_')
 getCacheKey ()
 getRel ()
 getUrlRel ()
 getVisibility ()
 Returns bitfield value.
 isDeleted ($field)
 isOld ()
 isVisible ()
 loadFromDB ()
 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

 $archive_name
 $requestedTime
const CACHE_VERSION = 1
const MAX_CACHE_ROWS = 20

Protected Member Functions

 loadExtraFromDB ()
 Load lazy file metadata from the DB.

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:
$titleTitle
$repoFileRepo
string$timetimestamp or null to load by archive name
string$archiveNamearchive name or null to load by timestamp
Exceptions:
MWException

Definition at line 130 of file OldLocalFile.php.

References LocalFile\$repo, $time, and File\$title.


Member Function Documentation

Returns:
String

Definition at line 149 of file OldLocalFile.php.

References LocalFile\load().

Referenced by getRel(), and getUrlRel().

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

Reimplemented from LocalFile.

Definition at line 232 of file OldLocalFile.php.

Referenced by loadFromDB().

Returns:
bool

Reimplemented from LocalFile.

Definition at line 142 of file OldLocalFile.php.

Returns:
string

Reimplemented from File.

Definition at line 242 of file OldLocalFile.php.

References getArchiveName(), and File\getHashPath().

Referenced by recordOldUpload().

Returns:
string

Reimplemented from File.

Definition at line 249 of file OldLocalFile.php.

References getArchiveName(), and File\getHashPath().

Returns bitfield value.

Returns:
int

Reimplemented from File.

Definition at line 301 of file OldLocalFile.php.

References LocalFile\load().

Parameters:
$fieldInteger: one of DELETED_* bitfield constants for file or revision rows
Returns:
bool

Reimplemented from File.

Definition at line 292 of file OldLocalFile.php.

References LocalFile\load().

Referenced by isVisible().

Returns:
bool

Reimplemented from File.

Definition at line 159 of file OldLocalFile.php.

Returns:
bool

Reimplemented from File.

Definition at line 166 of file OldLocalFile.php.

References File\DELETED_FILE, LocalFile\exists(), and isDeleted().

Load lazy file metadata from the DB.

Reimplemented from LocalFile.

Definition at line 195 of file OldLocalFile.php.

References $dbr, File\$name, $value, array(), as, LocalFile\getLazyCacheFields(), File\getName(), LocalFile\unprefixRow(), wfProfileIn(), and wfProfileOut().

Load file metadata from the DB.

Reimplemented from LocalFile.

Definition at line 170 of file OldLocalFile.php.

References $dbr, array(), getCacheFields(), File\getName(), LocalFile\loadFromRow(), wfProfileIn(), and wfProfileOut().

static OldLocalFile::newFromArchiveName ( title,
repo,
archiveName 
) [static]
Parameters:
$titleTitle
$repoFileRepo
$archiveName
Returns:
OldLocalFile

Definition at line 56 of file OldLocalFile.php.

References LocalFile\$repo, and File\$title.

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
$repoLocalRepo
string | bool$timestampMW_timestamp (optional)
Returns:
bool|OldLocalFile

Reimplemented from LocalFile.

Definition at line 82 of file OldLocalFile.php.

References $dbr, LocalFile\$repo, LocalFile\$sha1, LocalFile\$timestamp, array(), LocalRepo\getSlaveDB(), and newFromRow().

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

Reimplemented from LocalFile.

Definition at line 65 of file OldLocalFile.php.

References $file, LocalFile\$repo, File\$title, and Title\makeTitle().

Referenced by newFromKey().

static OldLocalFile::newFromTitle ( title,
repo,
time = null 
) [static]
Parameters:
$titleTitle
$repoFileRepo
$timenull
Returns:
OldLocalFile
Exceptions:
MWException

Reimplemented from LocalFile.

Definition at line 42 of file OldLocalFile.php.

References LocalFile\$repo, $time, and File\$title.

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
$timestampstring
string$commentUpload comment
$userUser User who did this upload
Returns:
bool

Definition at line 361 of file OldLocalFile.php.

References $comment, LocalFile\$timestamp, LocalFile\$user, array(), File\getName(), and getRel().

Referenced by uploadOld().

static OldLocalFile::selectFields ( ) [static]

Fields in the oldimage table.

Returns:
array

Reimplemented from LocalFile.

Definition at line 102 of file OldLocalFile.php.

References array().

Referenced by RevDel_FileList\doQuery().

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

Reimplemented from LocalFile.

Definition at line 253 of file OldLocalFile.php.

References array(), File\getName(), list, LocalFile\loadFromFile(), File\splitMime(), wfDebug(), wfProfileIn(), and wfProfileOut().

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()
$timestampstring
$commentstring
$user
$flagsint
Returns:
FileRepoStatus

Definition at line 332 of file OldLocalFile.php.

References $comment, $flags, LocalFile\$timestamp, LocalFile\$user, FileRepo\DELETE_SOURCE, File\DELETE_SOURCE, File\getHashPath(), LocalFile\lock(), LocalFile\publishTo(), recordOldUpload(), and LocalFile\unlock().

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:
$fieldInteger
$userUser object to check, or null to use $wgUser
Returns:
bool

Reimplemented from File.

Definition at line 314 of file OldLocalFile.php.

References LocalFile\$user, LocalFile\load(), and Revision\userCanBitfield().


Member Data Documentation

OldLocalFile::$archive_name

Definition at line 30 of file OldLocalFile.php.

OldLocalFile::$requestedTime

Definition at line 30 of file OldLocalFile.php.

Definition at line 32 of file OldLocalFile.php.

Definition at line 33 of file OldLocalFile.php.


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