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. | |
append ($srcPath, $toAppendPath, $flags=0) | |
Append the contents of the source path to the given file. | |
publishBatch ($triplets, $flags=0) | |
Publish a batch of files. | |
deleteBatch ($sourceDestPairs) | |
Move a group of files to the deletion archive. | |
fileExistsBatch ($files, $flags=0) | |
Checks existence of an array of files. | |
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) | |
Get an array or iterator of file objects for files that have a given SHA-1 content hash. | |
getThumbUrl ($name, $width=-1, $height=-1) | |
getThumbUrlFromCache ($name, $width, $height) | |
getZoneUrl ($zone) | |
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 = 86400 | |
Protected Member Functions | |
queryImage ($query) | |
fetchImageQuery ($query) | |
Protected Attributes | |
$mQueryCache = array() | |
$mFileExists = 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 | ) |
Reimplemented from FileRepo.
Definition at line 26 of file ForeignAPIRepo.php.
References $wgLocalFileRepo, and canCacheThumbs().
ForeignAPIRepo::append | ( | $ | srcPath, | |
$ | toAppendPath, | |||
$ | flags = 0 | |||
) |
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 from FileRepo.
Definition at line 66 of file ForeignAPIRepo.php.
ForeignAPIRepo::canCacheThumbs | ( | ) |
Are we locally caching the thumbnails?
Definition at line 245 of file ForeignAPIRepo.php.
Referenced by __construct(), and 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 72 of file ForeignAPIRepo.php.
ForeignAPIRepo::fetchImageQuery | ( | $ | query | ) | [protected] |
Definition at line 119 of file ForeignAPIRepo.php.
References FileRepo::$url, $wgMemc, FormatJson::decode(), Http::get(), and FileRepo::getLocalCacheKey().
Referenced by fileExistsBatch(), findBySha1(), and queryImage().
ForeignAPIRepo::fileExistsBatch | ( | $ | files, | |
$ | flags = 0 | |||
) |
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 from FileRepo.
Definition at line 77 of file ForeignAPIRepo.php.
References $files, $i, and fetchImageQuery().
ForeignAPIRepo::findBySha1 | ( | $ | hash | ) |
Get an array or iterator of file objects for files that have a given SHA-1 content hash.
STUB
Reimplemented from FileRepo.
Definition at line 157 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 102 of file ForeignAPIRepo.php.
ForeignAPIRepo::getImageInfo | ( | $ | title, | |
$ | time = false | |||
) |
ForeignAPIRepo::getThumbUrl | ( | $ | name, | |
$ | width = -1 , |
|||
$ | height = -1 | |||
) |
Definition at line 171 of file ForeignAPIRepo.php.
References $name, queryImage(), and wfDebug().
Referenced by getThumbUrlFromCache().
ForeignAPIRepo::getThumbUrlFromCache | ( | $ | name, | |
$ | width, | |||
$ | height | |||
) |
Definition at line 186 of file ForeignAPIRepo.php.
References $name, $path, FileRepo::$thumbUrl, $wgMemc, $wgServer, $wgUploadDirectory, $wgUploadPath, canCacheThumbs(), Http::get(), FileRepo::getHashPath(), FileRepo::getLocalCacheKey(), getThumbUrl(), wfDebug(), and wfMkdirParents().
ForeignAPIRepo::getZoneUrl | ( | $ | zone | ) |
Reimplemented from FileRepo.
Definition at line 230 of file ForeignAPIRepo.php.
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 50 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 69 of file ForeignAPIRepo.php.
ForeignAPIRepo::queryImage | ( | $ | query | ) | [protected] |
Definition at line 106 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 63 of file ForeignAPIRepo.php.
ForeignAPIRepo::$apiThumbCacheExpiry = 86400 |
Definition at line 22 of file ForeignAPIRepo.php.
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::$mFileExists = array() [protected] |
Definition at line 24 of file ForeignAPIRepo.php.
ForeignAPIRepo::$mQueryCache = array() [protected] |
Definition at line 23 of file ForeignAPIRepo.php.