Inherits FileRepo.
Public Member Functions | |
__construct ($info) | |
newFile ($title, $time=false) | |
Per docs in FileRepo, this needs to return false if we don't support versioned files. | |
storeBatch ($triplets, $flags=0) | |
No-ops. | |
storeTemp ($originalName, $srcPath) | |
Pick a random name in the temp zone and store a file to it. | |
publishBatch ($triplets, $flags=0) | |
Publish a batch of files. | |
deleteBatch ($sourceDestPairs) | |
Move a group of files 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(). | |
getImageInfo ($title, $time=false) | |
findBySha1 ($hash) | |
getThumbUrl ($name, $width=-1, $height=-1) | |
getThumbUrlFromCache ($name, $width, $height) | |
canCacheThumbs () | |
Are we locally caching the thumbnails? | |
Public Attributes | |
$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' ) | |
Factory functions for creating new files Override these in the base class. | |
$apiThumbCacheExpiry = 0 | |
Protected Member Functions | |
queryImage ($query) | |
fetchImageQuery ($query) | |
Protected Attributes | |
$mQueryCache = array() |
Example config:
$wgForeignFileRepos[] = array( 'class' => 'ForeignAPIRepo', 'name' => 'shared', 'apibase' => 'http://en.wikipedia.org/w/api.php', 'fetchDescription' => true, // Optional 'descriptionCacheExpiry' => 3600, );
Definition at line 20 of file ForeignAPIRepo.php.
ForeignAPIRepo::__construct | ( | $ | info | ) |
ForeignAPIRepo::canCacheThumbs | ( | ) |
Are we locally caching the thumbnails?
Definition at line 183 of file ForeignAPIRepo.php.
Referenced by getThumbUrlFromCache().
ForeignAPIRepo::deleteBatch | ( | $ | sourceDestPairs | ) |
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 from FileRepo.
Definition at line 57 of file ForeignAPIRepo.php.
ForeignAPIRepo::fetchImageQuery | ( | $ | query | ) | [protected] |
Definition at line 77 of file ForeignAPIRepo.php.
References $key, $url, $wgMemc, Http::get(), and wfMemcKey().
Referenced by findBySha1(), and queryImage().
ForeignAPIRepo::findBySha1 | ( | $ | hash | ) |
Reimplemented from FileRepo.
Definition at line 115 of file ForeignAPIRepo.php.
References fetchImageQuery(), and Title::makeTitle().
ForeignAPIRepo::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().
Reimplemented from FileRepo.
Definition at line 60 of file ForeignAPIRepo.php.
ForeignAPIRepo::getImageInfo | ( | $ | title, | |
$ | time = false | |||
) |
ForeignAPIRepo::getThumbUrl | ( | $ | name, | |
$ | width = -1 , |
|||
$ | height = -1 | |||
) |
Definition at line 129 of file ForeignAPIRepo.php.
References $name, queryImage(), and wfDebug().
Referenced by getThumbUrlFromCache().
ForeignAPIRepo::getThumbUrlFromCache | ( | $ | name, | |
$ | width, | |||
$ | height | |||
) |
Definition at line 144 of file ForeignAPIRepo.php.
References $key, $name, $path, $wgMemc, $wgServer, $wgUploadDirectory, $wgUploadPath, canCacheThumbs(), Http::get(), FileRepo::getHashPath(), getThumbUrl(), wfDebug(), wfMemcKey(), and wfMkdirParents().
ForeignAPIRepo::newFile | ( | $ | title, | |
$ | time = false | |||
) |
Per docs in FileRepo, this needs to return false if we don't support versioned files.
Well, we don't.
Reimplemented from FileRepo.
Definition at line 38 of file ForeignAPIRepo.php.
References $title.
ForeignAPIRepo::publishBatch | ( | $ | triplets, | |
$ | flags = 0 | |||
) |
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 from FileRepo.
Definition at line 54 of file ForeignAPIRepo.php.
ForeignAPIRepo::queryImage | ( | $ | query | ) | [protected] |
Definition at line 64 of file ForeignAPIRepo.php.
References fetchImageQuery().
Referenced by getImageInfo(), and getThumbUrl().
ForeignAPIRepo::storeBatch | ( | $ | triplets, | |
$ | flags = 0 | |||
) |
ForeignAPIRepo::storeTemp | ( | $ | originalName, | |
$ | srcPath | |||
) |
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 from FileRepo.
Definition at line 51 of file ForeignAPIRepo.php.
ForeignAPIRepo::$apiThumbCacheExpiry = 0 |
ForeignAPIRepo::$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' ) |
Factory functions for creating new files Override these in the base class.
Reimplemented from FileRepo.
Definition at line 21 of file ForeignAPIRepo.php.
ForeignAPIRepo::$mQueryCache = array() [protected] |
Definition at line 23 of file ForeignAPIRepo.php.