MediaWiki
REL1_19
|
A repository that stores files in the local filesystem and registers them in the wiki's own database. More...
Public Member Functions | |
checkRedirect (Title $title) | |
Checks if there is a redirect named as $title. | |
cleanupDeletedBatch ($storageKeys) | |
Delete files in the deleted directory if they are not referenced in the filearchive table. | |
findBySha1 ($hash) | |
Get an array or iterator of file objects for files that have a given SHA-1 content hash. | |
getMasterDB () | |
Get a connection to the master DB. | |
getSharedCacheKey () | |
Get a key on the primary cache for this repository. | |
getSlaveDB () | |
Get a connection to the slave DB. | |
invalidateImageRedirect (Title $title) | |
Invalidates image redirect cache related to that image. | |
newFileFromRow ($row) | |
newFromArchiveName ($title, $archiveName) | |
Static Public Member Functions | |
static | getHashFromKey ($key) |
Gets the SHA1 hash from a storage key. | |
Public Attributes | |
$fileFactory = array( 'LocalFile' , 'newFromTitle' ) | |
Factory functions for creating new files Override these in the base class. | |
$fileFactoryKey = array( 'LocalFile' , 'newFromKey' ) | |
$fileFromRowFactory = array( 'LocalFile' , 'newFromRow' ) | |
$oldFileFactory = array( 'OldLocalFile', 'newFromTitle' ) | |
$oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' ) | |
$oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' ) | |
Protected Member Functions | |
deletedFileHasKey ($key, $lock=null) | |
Check if a deleted (filearchive) file has this sha1 key. | |
getArticleID ($title) | |
Function link Title::getArticleID(). | |
hiddenFileHasKey ($key, $lock=null) | |
Check if a hidden (revision delete) file has this sha1 key. |
A repository that stores files in the local filesystem and registers them in the wiki's own database.
This is the most commonly used repository class.
Definition at line 16 of file LocalRepo.php.
LocalRepo::checkRedirect | ( | Title $ | title | ) |
Checks if there is a redirect named as $title.
$title | Title of file |
Reimplemented from FileRepo.
Definition at line 143 of file LocalRepo.php.
References $dbr, $wgMemc, getArticleID(), Title\getDBkey(), FileRepo\getLocalCacheKey(), getSharedCacheKey(), getSlaveDB(), Title\makeTitle(), Title\newFromText(), and File\normalizeTitle().
LocalRepo::cleanupDeletedBatch | ( | $ | storageKeys | ) |
Delete files in the deleted directory if they are not referenced in the filearchive table.
This needs to be done in the repo because it needs to interleave database locks with file operations, which is potentially a remote operation.
$storageKeys | array |
Reimplemented from FileRepo.
Definition at line 58 of file LocalRepo.php.
References FileRepo\$backend, $path, deletedFileHasKey(), FileRepo\getDeletedHashPath(), getMasterDB(), FileRepo\getZonePath(), hiddenFileHasKey(), FileRepo\newGood(), and wfDebug().
LocalRepo::deletedFileHasKey | ( | $ | key, |
$ | lock = null |
||
) | [protected] |
Check if a deleted (filearchive) file has this sha1 key.
$key | String File storage key (base-36 sha1 key with file extension) |
$lock | String|null Use "lock" to lock the row via FOR UPDATE |
Definition at line 95 of file LocalRepo.php.
References $options, and getMasterDB().
Referenced by cleanupDeletedBatch().
LocalRepo::findBySha1 | ( | $ | hash | ) |
Get an array or iterator of file objects for files that have a given SHA-1 content hash.
$hash | String a sha1 hash to look for |
Reimplemented from FileRepo.
Definition at line 217 of file LocalRepo.php.
References $dbr, $res, $result, getSlaveDB(), newFileFromRow(), and LocalFile\selectFields().
LocalRepo::getArticleID | ( | $ | title | ) | [protected] |
Function link Title::getArticleID().
We can't say Title object, what database it should use, so we duplicate that function here.
$title | Title |
Definition at line 193 of file LocalRepo.php.
References $dbr, $title, and getSlaveDB().
Referenced by checkRedirect().
static LocalRepo::getHashFromKey | ( | $ | key | ) | [static] |
Gets the SHA1 hash from a storage key.
string | $key |
Definition at line 133 of file LocalRepo.php.
Referenced by ApiQueryFilearchive\execute(), and hiddenFileHasKey().
Get a connection to the master DB.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 244 of file LocalRepo.php.
References wfGetDB().
Referenced by cleanupDeletedBatch(), deletedFileHasKey(), and hiddenFileHasKey().
Get a key on the primary cache for this repository.
Returns false if the repository's cache is not accessible at this site. The parameters are the parts of the key, as for wfMemcKey().
Reimplemented from FileRepo.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 255 of file LocalRepo.php.
Referenced by checkRedirect(), and invalidateImageRedirect().
Get a connection to the slave DB.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 237 of file LocalRepo.php.
References wfGetDB().
Referenced by checkRedirect(), findBySha1(), and getArticleID().
LocalRepo::hiddenFileHasKey | ( | $ | key, |
$ | lock = null |
||
) | [protected] |
Check if a hidden (revision delete) file has this sha1 key.
$key | String File storage key (base-36 sha1 key with file extension) |
$lock | String|null Use "lock" to lock the row via FOR UPDATE |
Definition at line 112 of file LocalRepo.php.
References $ext, $options, File\DELETED_FILE, getHashFromKey(), getMasterDB(), and File\normalizeExtension().
Referenced by cleanupDeletedBatch().
LocalRepo::invalidateImageRedirect | ( | Title $ | title | ) |
Invalidates image redirect cache related to that image.
$title | Title of page |
Reimplemented from FileRepo.
Definition at line 266 of file LocalRepo.php.
References $wgMemc, Title\getDBkey(), and getSharedCacheKey().
LocalRepo::newFileFromRow | ( | $ | row | ) |
MWException |
$row |
Definition at line 29 of file LocalRepo.php.
Referenced by findBySha1().
LocalRepo::newFromArchiveName | ( | $ | title, |
$ | archiveName | ||
) |
$title | |
$archiveName |
Definition at line 44 of file LocalRepo.php.
References $title.
LocalRepo::$fileFactory = array( 'LocalFile' , 'newFromTitle' ) |
Factory functions for creating new files Override these in the base class.
Reimplemented from FileRepo.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 17 of file LocalRepo.php.
LocalRepo::$fileFactoryKey = array( 'LocalFile' , 'newFromKey' ) |
Reimplemented from FileRepo.
Definition at line 18 of file LocalRepo.php.
LocalRepo::$fileFromRowFactory = array( 'LocalFile' , 'newFromRow' ) |
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 19 of file LocalRepo.php.
LocalRepo::$oldFileFactory = array( 'OldLocalFile', 'newFromTitle' ) |
Reimplemented from FileRepo.
Definition at line 20 of file LocalRepo.php.
LocalRepo::$oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' ) |
Reimplemented from FileRepo.
Definition at line 21 of file LocalRepo.php.
LocalRepo::$oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' ) |
Definition at line 22 of file LocalRepo.php.