MediaWiki
REL1_22
|
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 (array $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. | |
findBySha1s (array $hashes) | |
Get an array of arrays or iterators of file objects for files that have the given SHA-1 content hashes. | |
findFilesByPrefix ($prefix, $limit) | |
Return an array of files where the name starts with $prefix. | |
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 31 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 158 of file LocalRepo.php.
References $dbr, $wgMemc, array(), getArticleID(), Title\getDBkey(), FileRepo\getLocalCacheKey(), getSharedCacheKey(), getSlaveDB(), global, Title\makeTitle(), Title\newFromText(), and File\normalizeTitle().
LocalRepo::cleanupDeletedBatch | ( | array $ | 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 73 of file LocalRepo.php.
References FileRepo\$backend, $key, $path, array(), as, deletedFileHasKey(), FileBackend\doOperation(), 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.
string | $key | File storage key (base-36 sha1 key with file extension) |
string | null | $lock | Use "lock" to lock the row via FOR UPDATE |
Definition at line 110 of file LocalRepo.php.
References $key, $options, array(), 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.
string | $hash | a sha1 hash to look for |
Reimplemented from FileRepo.
Definition at line 232 of file LocalRepo.php.
References $dbr, $hash, $res, $result, array(), as, getSlaveDB(), newFileFromRow(), and LocalFile\selectFields().
LocalRepo::findBySha1s | ( | array $ | hashes | ) |
Get an array of arrays or iterators of file objects for files that have the given SHA-1 content hashes.
Overrides generic implementation in FileRepo for performance reason
array | $hashes | An array of hashes |
Reimplemented from FileRepo.
Definition at line 260 of file LocalRepo.php.
References $dbr, $file, $res, $result, array(), as, getSlaveDB(), newFileFromRow(), and LocalFile\selectFields().
LocalRepo::findFilesByPrefix | ( | $ | prefix, |
$ | limit | ||
) |
Return an array of files where the name starts with $prefix.
string | $prefix | The prefix to search for |
int | $limit | The maximum amount of files to return |
Reimplemented from FileRepo.
Definition at line 291 of file LocalRepo.php.
References $dbr, $files, $limit, $res, array(), as, 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 208 of file LocalRepo.php.
References $dbr, $title, array(), and getSlaveDB().
Referenced by checkRedirect().
static LocalRepo::getHashFromKey | ( | $ | key | ) | [static] |
Gets the SHA1 hash from a storage key.
string | $key |
Definition at line 148 of file LocalRepo.php.
References $key.
Referenced by PopulateFilearchiveSha1\doDBUpdates(), DeleteArchivedFilesImplementation\doDelete(), and hiddenFileHasKey().
Get a connection to the master DB.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 324 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 335 of file LocalRepo.php.
Referenced by checkRedirect(), and invalidateImageRedirect().
Get a connection to the slave DB.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 316 of file LocalRepo.php.
References wfGetDB().
Referenced by checkRedirect(), findBySha1(), findBySha1s(), findFilesByPrefix(), getArticleID(), and OldLocalFile\newFromKey().
LocalRepo::hiddenFileHasKey | ( | $ | key, |
$ | lock = null |
||
) | [protected] |
Check if a hidden (revision delete) file has this sha1 key.
string | $key | File storage key (base-36 sha1 key with file extension) |
string | null | $lock | Use "lock" to lock the row via FOR UPDATE |
Definition at line 127 of file LocalRepo.php.
References $ext, $key, $options, array(), 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 346 of file LocalRepo.php.
References $wgMemc, Title\getDBkey(), getSharedCacheKey(), and global.
LocalRepo::newFileFromRow | ( | $ | row | ) |
MWException |
$row |
Definition at line 44 of file LocalRepo.php.
Referenced by findBySha1(), findBySha1s(), and findFilesByPrefix().
LocalRepo::newFromArchiveName | ( | $ | title, |
$ | archiveName | ||
) |
$title | |
$archiveName |
Definition at line 59 of file LocalRepo.php.
References $title.
Factory functions for creating new files Override these in the base class.
Reimplemented from FileRepo.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 32 of file LocalRepo.php.
Reimplemented from FileRepo.
Definition at line 33 of file LocalRepo.php.
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 34 of file LocalRepo.php.
LocalRepo::$oldFileFactory = array( 'OldLocalFile', 'newFromTitle' ) |
Reimplemented from FileRepo.
Definition at line 35 of file LocalRepo.php.
LocalRepo::$oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' ) |
Reimplemented from FileRepo.
Definition at line 36 of file LocalRepo.php.
LocalRepo::$oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' ) |
Definition at line 37 of file LocalRepo.php.