Inherited by ForeignAPIRepo, FSRepo, and NullRepo.
Public Member Functions | |
__construct ($info) | |
newFile ($title, $time=false) | |
Create a new File object from the local repository. | |
findFile ($title, $options=array()) | |
Find an instance of the named file created at the specified time Returns false if the file does not exist. | |
findFiles ($items) | |
newFileFromKey ($sha1, $time=false) | |
Create a new File object from the local repository. | |
findFileFromKey ($sha1, $options=array()) | |
Find an instance of the file with this key, created at the specified time Returns false if the file does not exist. | |
getThumbScriptUrl () | |
Get the URL of thumb.php. | |
getZoneUrl ($zone) | |
Get the URL corresponding to one of the four basic zones. | |
canTransformVia404 () | |
Returns true if the repository can transform files via a 404 handler. | |
getNameFromTitle ($title) | |
Get the name of an image from its title object. | |
getHashPath ($name) | |
Get a relative path including trailing slash, e.g. | |
getName () | |
Get the name of this repository, as specified by $info['name]' to the constructor. | |
getDescriptionUrl ($name) | |
Get the URL of an image description page. | |
getDescriptionRenderUrl ($name, $lang=null) | |
Get the URL of the content-only fragment of the description page. | |
store ($srcPath, $dstZone, $dstRel, $flags=0) | |
Store a file to a given destination. | |
storeBatch ($triplets, $flags=0) | |
Store a batch of files. | |
storeTemp ($originalName, $srcPath) | |
Pick a random name in the temp zone and store a file to it. | |
append ($srcPath, $toAppendPath, $flags=0) | |
Append the contents of the source path to the given file. | |
freeTemp ($virtualUrl) | |
Remove a temporary file or mark it for garbage collection. | |
publish ($srcPath, $dstRel, $archiveRel, $flags=0) | |
Copy or move a file either from the local filesystem or from an mwrepo:// virtual URL, into this repository at the specified destination location. | |
publishBatch ($triplets, $flags=0) | |
Publish a batch of files. | |
fileExists ($file, $flags=0) | |
fileExistsBatch ($files, $flags=0) | |
Checks existence of an array of files. | |
deleteBatch ($sourceDestPairs) | |
Move a group of files to the deletion archive. | |
delete ($srcRel, $archiveRel) | |
Move a file to the deletion archive. | |
getFileProps ($virtualUrl) | |
Get properties of a file with a given virtual URL The virtual URL must refer to this repo Properties should ultimately be obtained via File::getPropsFromPath(). | |
enumFiles ($callback) | |
Call a callback function for every file in the repository May use either the database or the filesystem STUB. | |
validateFilename ($filename) | |
Determine if a relative path is valid, i.e. | |
paranoidClean ($param) | |
#@+ Path disclosure protection functions | |
passThrough ($param) | |
getErrorCleanupFunction () | |
Get a callback function to use for cleaning error message parameters. | |
newFatal ($message) | |
#@- | |
newGood ($value=null) | |
Create a new good result. | |
cleanupDeletedBatch ($storageKeys) | |
Delete files in the deleted directory if they are not referenced in the filearchive table STUB. | |
checkRedirect ($title) | |
Checks if there is a redirect named as $title. | |
invalidateImageRedirect ($title) | |
Invalidates image redirect cache related to that image Doesn't do anything for repositories that don't support image redirects. | |
findBySha1 ($hash) | |
Get an array or iterator of file objects for files that have a given SHA-1 content hash. | |
getDisplayName () | |
Get the human-readable name of the repo. | |
getSharedCacheKey () | |
Get a key on the primary cache for this repository. | |
getLocalCacheKey () | |
Get a key for this repo in the local cache domain. | |
Static Public Member Functions | |
static | isVirtualUrl ($url) |
Determine if a string is an mwrepo:// URL. | |
static | getHashPathForLevel ($name, $levels) |
Public Attributes | |
const | FILES_ONLY = 1 |
const | DELETE_SOURCE = 1 |
const | OVERWRITE = 2 |
const | OVERWRITE_SAME = 4 |
$thumbScriptUrl | |
$transformVia404 | |
$descBaseUrl | |
$scriptDirUrl | |
$articleUrl | |
$fetchDescription | |
$initialCapital | |
$pathDisclosureProtection = 'paranoid' | |
$descriptionCacheExpiry | |
$hashLevels | |
$url | |
$thumbUrl | |
$fileFactory = false | |
Factory functions for creating new files Override these in the base class. | |
$oldFileFactory = false | |
$fileFactoryKey = false | |
$oldFileFactoryKey = false |
Definition at line 8 of file FileRepo.php.
FileRepo::__construct | ( | $ | info | ) |
Reimplemented in ForeignAPIRepo, ForeignDBRepo, ForeignDBViaLBRepo, FSRepo, and NullRepo.
Definition at line 26 of file FileRepo.php.
References MWNamespace::isCapitalized().
FileRepo::append | ( | $ | srcPath, | |
$ | toAppendPath, | |||
$ | flags = 0 | |||
) | [abstract] |
Append the contents of the source path to the given file.
$srcPath | string location of the source file | |
$toAppendPath | string path to append to. | |
$flags | Bitfield, may be FileRepo::DELETE_SOURCE to indicate that the source file should be deleted if possible |
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
FileRepo::canTransformVia404 | ( | ) |
Returns true if the repository can transform files via a 404 handler.
Definition at line 250 of file FileRepo.php.
FileRepo::checkRedirect | ( | $ | title | ) |
Checks if there is a redirect named as $title.
If there is, return the title object. If not, return false. STUB
Reimplemented in LocalRepo.
Definition at line 594 of file FileRepo.php.
Referenced by findFile().
FileRepo::cleanupDeletedBatch | ( | $ | storageKeys | ) |
Delete files in the deleted directory if they are not referenced in the filearchive table STUB.
Reimplemented in LocalRepo.
Definition at line 585 of file FileRepo.php.
FileRepo::delete | ( | $ | srcRel, | |
$ | archiveRel | |||
) |
Move a file to the deletion archive.
If no valid deletion archive exists, this may either delete the file or throw an exception, depending on the preference of the repository
mixed | $srcRel Relative path for the file to be deleted | |
mixed | $archiveRel Relative path for the archive location. Relative to a private archive directory. |
Definition at line 498 of file FileRepo.php.
References deleteBatch().
FileRepo::deleteBatch | ( | $ | sourceDestPairs | ) | [abstract] |
Move a group of files to the deletion archive.
If no valid deletion archive is configured, this may either delete the file or throw an exception, depending on the preference of the repository.
The overwrite policy is determined by the repository -- currently FSRepo assumes a naming scheme in the deleted zone based on content hash, as opposed to the public zone which is assumed to be unique.
array | $sourceDestPairs Array of source/destination pairs. Each element is a two-element array containing the source file path relative to the public root in the first element, and the archive file path relative to the deleted zone root in the second element. |
Reimplemented in ForeignAPIRepo, ForeignDBRepo, ForeignDBViaLBRepo, FSRepo, and NullRepo.
Referenced by delete().
FileRepo::enumFiles | ( | $ | callback | ) |
Call a callback function for every file in the repository May use either the database or the filesystem STUB.
Reimplemented in FSRepo.
Definition at line 514 of file FileRepo.php.
FileRepo::fileExists | ( | $ | file, | |
$ | flags = 0 | |||
) |
FileRepo::fileExistsBatch | ( | $ | files, | |
$ | flags = 0 | |||
) | [abstract] |
Checks existence of an array of files.
array | $files URLs (or paths) of files to check | |
integer | $flags Bitwise combination of the following flags: self::FILES_ONLY Mark file as existing only if it is a file (not directory) |
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
Referenced by fileExists().
FileRepo::findBySha1 | ( | $ | hash | ) |
Get an array or iterator of file objects for files that have a given SHA-1 content hash.
STUB
Reimplemented in ForeignAPIRepo, and LocalRepo.
Definition at line 613 of file FileRepo.php.
FileRepo::findFile | ( | $ | title, | |
$ | options = array() | |||
) |
Find an instance of the named file created at the specified time Returns false if the file does not exist.
Repositories not supporting version control should return false if the time is specified.
mixed | $title Title object or string | |
$options | Associative array of options: time: requested time for an archived image, or false for the current version. An image object will be returned which was created at the specified time. |
private: If true, return restricted (deleted) files if the current user is allowed to view them. Otherwise, such files will not be found.
Reimplemented in NullRepo.
Definition at line 94 of file FileRepo.php.
References $options, $title, checkRedirect(), File::DELETED_FILE, Title::makeTitleSafe(), and newFile().
Referenced by findFiles().
FileRepo::findFileFromKey | ( | $ | sha1, | |
$ | options = array() | |||
) |
Find an instance of the file with this key, created at the specified time Returns false if the file does not exist.
Repositories not supporting version control should return false if the time is specified.
string | $sha1 string | |
array | $options Option array, same as findFile(). |
Definition at line 201 of file FileRepo.php.
References $options, File::DELETED_FILE, and newFileFromKey().
FileRepo::findFiles | ( | $ | items | ) |
FileRepo::freeTemp | ( | $ | virtualUrl | ) |
Remove a temporary file or mark it for garbage collection.
string | $virtualUrl The virtual URL returned by storeTemp |
Reimplemented in FSRepo.
Definition at line 417 of file FileRepo.php.
FileRepo::getDescriptionRenderUrl | ( | $ | name, | |
$ | lang = null | |||
) |
Get the URL of the content-only fragment of the description page.
For MediaWiki this means action=render. This should only be called by the repository's file class, since it may return invalid results. User code should use File::getDescriptionText().
string | $name Name of image to fetch | |
string | $lang Language to fetch it in, if any. |
Definition at line 342 of file FileRepo.php.
References $name, getDescriptionUrl(), wfAppendQuery(), and wfUrlencode().
FileRepo::getDescriptionUrl | ( | $ | name | ) |
Get the URL of an image description page.
May return false if it is unknown or not applicable. In general this should only be called by the File class, since it may return invalid results for certain kinds of repositories. Use File::getDescriptionUrl() in user code.
In particular, it uses the article paths as specified to the repository constructor, whereas local repositories use the local Title functions.
Definition at line 308 of file FileRepo.php.
References $name, and wfUrlencode().
Referenced by getDescriptionRenderUrl().
FileRepo::getDisplayName | ( | ) |
Get the human-readable name of the repo.
Definition at line 621 of file FileRepo.php.
References wfEmptyMsg(), and wfMsg().
FileRepo::getErrorCleanupFunction | ( | ) |
Get a callback function to use for cleaning error message parameters.
Reimplemented in FSRepo.
Definition at line 553 of file FileRepo.php.
FileRepo::getFileProps | ( | $ | virtualUrl | ) | [abstract] |
Get properties of a file with a given virtual URL The virtual URL must refer to this repo Properties should ultimately be obtained via File::getPropsFromPath().
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
FileRepo::getHashPath | ( | $ | name | ) |
Get a relative path including trailing slash, e.g.
f/fa/ If the repo is not hashed, returns an empty string
Definition at line 288 of file FileRepo.php.
References $name, and getHashPathForLevel().
Referenced by ForeignAPIRepo::getThumbUrlFromCache(), and FSRepo::storeTemp().
static FileRepo::getHashPathForLevel | ( | $ | name, | |
$ | levels | |||
) | [static] |
Definition at line 271 of file FileRepo.php.
References $i, $name, and $path.
Referenced by getHashPath().
FileRepo::getLocalCacheKey | ( | ) |
Get a key for this repo in the local cache domain.
These cache keys are not shared with remote instances of the repo. The parameters are the parts of the key, as for wfMemcKey().
Definition at line 650 of file FileRepo.php.
References getName().
Referenced by LocalRepo::checkRedirect(), ForeignAPIRepo::fetchImageQuery(), and ForeignAPIRepo::getThumbUrlFromCache().
FileRepo::getName | ( | ) |
Get the name of this repository, as specified by $info['name]' to the constructor.
Definition at line 295 of file FileRepo.php.
Referenced by getLocalCacheKey().
FileRepo::getNameFromTitle | ( | $ | title | ) |
Get the name of an image from its title object.
Definition at line 257 of file FileRepo.php.
References $name, $title, $wgCapitalLinks, $wgContLang, and MWNamespace::isCapitalized().
FileRepo::getSharedCacheKey | ( | ) |
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().
STUB
Reimplemented in ForeignDBRepo, ForeignDBViaLBRepo, and LocalRepo.
Definition at line 641 of file FileRepo.php.
FileRepo::getThumbScriptUrl | ( | ) |
FileRepo::getZoneUrl | ( | $ | zone | ) |
Get the URL corresponding to one of the four basic zones.
String | $zone One of: public, deleted, temp, thumb |
Reimplemented in ForeignAPIRepo, and FSRepo.
Definition at line 243 of file FileRepo.php.
FileRepo::invalidateImageRedirect | ( | $ | title | ) |
Invalidates image redirect cache related to that image Doesn't do anything for repositories that don't support image redirects.
STUB
Reimplemented in LocalRepo.
Definition at line 605 of file FileRepo.php.
static FileRepo::isVirtualUrl | ( | $ | url | ) | [static] |
Determine if a string is an mwrepo:// URL.
Definition at line 46 of file FileRepo.php.
References $url.
Referenced by RepoGroup::getFileProps().
FileRepo::newFatal | ( | $ | message | ) |
#@-
Create a new fatal error
Definition at line 568 of file FileRepo.php.
Referenced by FSRepo::publishBatch(), and FSRepo::storeBatch().
FileRepo::newFile | ( | $ | title, | |
$ | time = false | |||
) |
Create a new File object from the local repository.
mixed | $title Title object or string | |
mixed | $time Time at which the image was uploaded. If this is specified, the returned object will be an instance of the repository's old file class instead of a current file. Repositories not supporting version control should return false if this parameter is set. |
Reimplemented in ForeignAPIRepo, and NullRepo.
Definition at line 59 of file FileRepo.php.
References $title, and Title::makeTitleSafe().
Referenced by findFile().
FileRepo::newFileFromKey | ( | $ | sha1, | |
$ | time = false | |||
) |
Create a new File object from the local repository.
mixed | $sha1 SHA-1 key | |
mixed | $time Time at which the image was uploaded. If this is specified, the returned object will be an instance of the repository's old file class instead of a current file. Repositories not supporting version control should return false if this parameter is set. |
Definition at line 181 of file FileRepo.php.
Referenced by findFileFromKey().
FileRepo::newGood | ( | $ | value = null |
) |
Create a new good result.
Definition at line 577 of file FileRepo.php.
Referenced by FSRepo::append(), LocalRepo::cleanupDeletedBatch(), FSRepo::deleteBatch(), FSRepo::publishBatch(), and FSRepo::storeBatch().
FileRepo::paranoidClean | ( | $ | param | ) |
FileRepo::passThrough | ( | $ | param | ) |
Definition at line 548 of file FileRepo.php.
FileRepo::publish | ( | $ | srcPath, | |
$ | dstRel, | |||
$ | archiveRel, | |||
$ | flags = 0 | |||
) |
Copy or move a file either from the local filesystem or from an mwrepo:// virtual URL, into this repository at the specified destination location.
Returns a FileRepoStatus object. On success, the value contains "new" or "archived", to indicate whether the file was new with that name.
string | $srcPath The source path or URL | |
string | $dstRel The destination relative path | |
string | $archiveRel The relative path where the existing file is to be archived, if there is one. Relative to the public zone root. | |
integer | $flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate that the source file should be deleted if possible |
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 435 of file FileRepo.php.
References publishBatch().
FileRepo::publishBatch | ( | $ | triplets, | |
$ | flags = 0 | |||
) | [abstract] |
Publish a batch of files.
array | $triplets (source,dest,archive) triplets as per publish() | |
integer | $flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate that the source files should be deleted if possible |
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
Referenced by publish().
FileRepo::store | ( | $ | srcPath, | |
$ | dstZone, | |||
$ | dstRel, | |||
$ | flags = 0 | |||
) |
Store a file to a given destination.
string | $srcPath Source path or virtual URL | |
string | $dstZone Destination zone | |
string | $dstRel Destination relative path | |
integer | $flags Bitwise combination of the following flags: self::DELETE_SOURCE Delete the source file after upload self::OVERWRITE Overwrite an existing destination file instead of failing self::OVERWRITE_SAME Overwrite the file if the destination exists and has the same contents as the source |
Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.
Definition at line 374 of file FileRepo.php.
References storeBatch().
Referenced by FSRepo::storeTemp().
FileRepo::storeBatch | ( | $ | triplets, | |
$ | flags = 0 | |||
) | [abstract] |
Store a batch of files.
array | $triplets (src,zone,dest) triplets as per store() | |
integer | $flags Flags as per store |
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
Referenced by store().
FileRepo::storeTemp | ( | $ | originalName, | |
$ | srcPath | |||
) | [abstract] |
Pick a random name in the temp zone and store a file to it.
Returns a FileRepoStatus object with the URL in the value.
string | $originalName The base name of the file as specified by the user. The file extension will be maintained. | |
string | $srcPath The current location of the file. |
Reimplemented in ForeignAPIRepo, FSRepo, and NullRepo.
FileRepo::validateFilename | ( | $ | filename | ) |
Determine if a relative path is valid, i.e.
not blank or involving directory traveral
Definition at line 521 of file FileRepo.php.
References $filename, and wfIsWindows().
Referenced by FSRepo::deleteBatch(), FSRepo::publishBatch(), and FSRepo::storeBatch().
FileRepo::$articleUrl |
Definition at line 15 of file FileRepo.php.
FileRepo::$descBaseUrl |
Definition at line 15 of file FileRepo.php.
FileRepo::$descriptionCacheExpiry |
Definition at line 17 of file FileRepo.php.
FileRepo::$fetchDescription |
Definition at line 15 of file FileRepo.php.
FileRepo::$fileFactory = false |
Factory functions for creating new files Override these in the base class.
Reimplemented in ForeignAPIRepo, ForeignDBRepo, ForeignDBViaLBRepo, FSRepo, and LocalRepo.
Definition at line 23 of file FileRepo.php.
FileRepo::$fileFactoryKey = false |
Definition at line 24 of file FileRepo.php.
FileRepo::$hashLevels |
Definition at line 17 of file FileRepo.php.
FileRepo::$initialCapital |
Definition at line 15 of file FileRepo.php.
FileRepo::$oldFileFactory = false |
FileRepo::$oldFileFactoryKey = false |
Definition at line 24 of file FileRepo.php.
FileRepo::$pathDisclosureProtection = 'paranoid' |
FileRepo::$scriptDirUrl |
Definition at line 15 of file FileRepo.php.
FileRepo::$thumbScriptUrl |
Definition at line 14 of file FileRepo.php.
FileRepo::$thumbUrl |
FileRepo::$transformVia404 |
Definition at line 14 of file FileRepo.php.
FileRepo::$url |
Definition at line 17 of file FileRepo.php.
Referenced by ForeignAPIRepo::fetchImageQuery(), isVirtualUrl(), and FSRepo::resolveVirtualUrl().
const FileRepo::DELETE_SOURCE = 1 |
Definition at line 10 of file FileRepo.php.
Referenced by LocalFileMoveBatch::execute(), and LocalFile::publish().
const FileRepo::FILES_ONLY = 1 |
Definition at line 9 of file FileRepo.php.
Referenced by LocalFile::isMissing(), LocalFileMoveBatch::removeNonexistentFiles(), LocalFileRestoreBatch::removeNonexistentFiles(), LocalFileDeleteBatch::removeNonexistentFiles(), and LocalFileRestoreBatch::removeNonexistentFromCleanup().
const FileRepo::OVERWRITE = 2 |
Definition at line 11 of file FileRepo.php.
const FileRepo::OVERWRITE_SAME = 4 |
Definition at line 12 of file FileRepo.php.
Referenced by RevDel_FileList::doPreCommitUpdates(), and LocalFileRestoreBatch::execute().