MediaWiki
REL1_24
|
A foreign repository with a remote MediaWiki with an API thingy. More...
Public Member Functions | |
__construct ($info) | |
canCacheThumbs () | |
Are we locally caching the thumbnails? | |
enumFiles ($callback) | |
fetchImageQuery ($query) | |
fileExistsBatch (array $files) | |
findBySha1 ($hash) | |
getApiUrl () | |
getFileProps ($virtualUrl) | |
getImageInfo ($data) | |
getInfo () | |
Get information about the repo - overrides/extends the parent class's information. | |
getThumbError ($name, $width=-1, $height=-1, $otherParams= '', $lang=null) | |
getThumbUrl ($name, $width=-1, $height=-1, &$result=null, $otherParams= '') | |
getThumbUrlFromCache ($name, $width, $height, $params="") | |
Return the imageurl from cache if possible. | |
getZonePath ($zone) | |
Get the local directory corresponding to one of the basic zones. | |
getZoneUrl ($zone, $ext=null) | |
httpGetCached ($target, $query, $cacheTTL=3600) | |
HTTP GET request to a mediawiki API (with caching) | |
newFile ($title, $time=false) | |
Per docs in FileRepo, this needs to return false if we don't support versioned files. | |
Static Public Member Functions | |
static | getUserAgent () |
The user agent the ForeignAPIRepo will use. | |
static | httpGet ($url, $timeout= 'default', $options=array()) |
Like a Http:get request, but with custom User-Agent. | |
Public Attributes | |
const | VERSION = "2.1" |
Protected Member Functions | |
assertWritableRepo () | |
Static Protected Member Functions | |
static | getIIProps () |
Protected Attributes | |
int | $apiThumbCacheExpiry = 86400 |
Check back with Commons after a day (24*60*60) *. | |
int | $fileCacheExpiry = 2592000 |
Redownload thumbnail files after a month (86400*30) *. | |
$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' ) | |
Factory functions for creating new files Override these in the base class. | |
array | $mFileExists = array() |
* | |
Static Protected Attributes | |
static | $imageInfoProps |
List of iiprop values for the thumbnail fetch queries. | |
Private Attributes | |
array | $mQueryCache = array() |
* |
A foreign repository with a remote MediaWiki with an API thingy.
Example config:
$wgForeignFileRepos[] = array( 'class' => 'ForeignAPIRepo', 'name' => 'shared', 'apibase' => 'http://en.wikipedia.org/w/api.php', 'fetchDescription' => true, // Optional 'descriptionCacheExpiry' => 3600, );
Definition at line 39 of file ForeignAPIRepo.php.
ForeignAPIRepo::__construct | ( | $ | info | ) |
array | null | $info |
Definition at line 67 of file ForeignAPIRepo.php.
References canCacheThumbs(), and global.
ForeignAPIRepo::assertWritableRepo | ( | ) | [protected] |
MWException |
Reimplemented from FileRepo.
Definition at line 584 of file ForeignAPIRepo.php.
Are we locally caching the thumbnails?
Definition at line 448 of file ForeignAPIRepo.php.
Referenced by __construct().
ForeignAPIRepo::enumFiles | ( | $ | callback | ) |
callable | $callback |
MWException |
Reimplemented from FileRepo.
Definition at line 577 of file ForeignAPIRepo.php.
ForeignAPIRepo::fetchImageQuery | ( | $ | query | ) |
ForeignAPIRepo::fileExistsBatch | ( | array $ | files | ) |
array | $files |
Reimplemented from FileRepo.
Definition at line 121 of file ForeignAPIRepo.php.
ForeignAPIRepo::findBySha1 | ( | $ | hash | ) |
string | $hash |
Reimplemented from FileRepo.
Definition at line 227 of file ForeignAPIRepo.php.
ForeignAPIRepo::getFileProps | ( | $ | virtualUrl | ) |
string | $virtualUrl |
Reimplemented from FileRepo.
Definition at line 176 of file ForeignAPIRepo.php.
static ForeignAPIRepo::getIIProps | ( | ) | [static, protected] |
ForeignAPIRepo::getImageInfo | ( | $ | data | ) |
Get information about the repo - overrides/extends the parent class's information.
Reimplemented from FileRepo.
Definition at line 466 of file ForeignAPIRepo.php.
ForeignAPIRepo::getThumbError | ( | $ | name, |
$ | width = -1 , |
||
$ | height = -1 , |
||
$ | otherParams = '' , |
||
$ | lang = null |
||
) |
string | $name | |
int | $width | |
int | $height | |
string | $otherParams | |
string | $lang | Language code for language of error |
Definition at line 285 of file ForeignAPIRepo.php.
ForeignAPIRepo::getThumbUrl | ( | $ | name, |
$ | width = -1 , |
||
$ | height = -1 , |
||
&$ | result = null , |
||
$ | otherParams = '' |
||
) |
string | $name | |
int | $width | |
int | $height | |
array | $result | Out parameter that will be changed by the function. |
string | $otherParams |
Definition at line 256 of file ForeignAPIRepo.php.
ForeignAPIRepo::getThumbUrlFromCache | ( | $ | name, |
$ | width, | ||
$ | height, | ||
$ | params = "" |
||
) |
Return the imageurl from cache if possible.
If the url has been requested today, get it from cache Otherwise retrieve remote thumb url, check for local file.
string | $name | Is a dbkey form of a title |
int | $width | |
int | $height | |
string | $params | Other rendering parameters (page number, etc) from handler's makeParamString. |
Definition at line 325 of file ForeignAPIRepo.php.
static ForeignAPIRepo::getUserAgent | ( | ) | [static] |
The user agent the ForeignAPIRepo will use.
Definition at line 456 of file ForeignAPIRepo.php.
ForeignAPIRepo::getZonePath | ( | $ | zone | ) |
Get the local directory corresponding to one of the basic zones.
string | $zone |
Reimplemented from FileRepo.
Definition at line 435 of file ForeignAPIRepo.php.
ForeignAPIRepo::getZoneUrl | ( | $ | zone, |
$ | ext = null |
||
) |
string | $zone | |
string | null | $ext | Optional file extension |
Reimplemented from FileRepo.
Definition at line 419 of file ForeignAPIRepo.php.
static ForeignAPIRepo::httpGet | ( | $ | url, |
$ | timeout = 'default' , |
||
$ | options = array() |
||
) | [static] |
Like a Http:get request, but with custom User-Agent.
string | $url | |
string | $timeout | |
array | $options |
Definition at line 502 of file ForeignAPIRepo.php.
ForeignAPIRepo::httpGetCached | ( | $ | target, |
$ | query, | ||
$ | cacheTTL = 3600 |
||
) |
HTTP GET request to a mediawiki API (with caching)
string | $target | Used in cache key creation, mostly |
array | $query | The query parameters for the API request |
int | $cacheTTL | Time to live for the memcached caching |
Definition at line 539 of file ForeignAPIRepo.php.
ForeignAPIRepo::newFile | ( | $ | title, |
$ | time = false |
||
) |
int ForeignAPIRepo::$apiThumbCacheExpiry = 86400 [protected] |
Check back with Commons after a day (24*60*60) *.
Definition at line 56 of file ForeignAPIRepo.php.
int ForeignAPIRepo::$fileCacheExpiry = 2592000 [protected] |
Redownload thumbnail files after a month (86400*30) *.
Definition at line 58 of file ForeignAPIRepo.php.
ForeignAPIRepo::$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' ) [protected] |
Factory functions for creating new files Override these in the base class.
Reimplemented from FileRepo.
Definition at line 55 of file ForeignAPIRepo.php.
ForeignAPIRepo::$imageInfoProps [static, protected] |
array( 'url', 'thumbnail', 'timestamp', )
List of iiprop values for the thumbnail fetch queries.
Definition at line 49 of file ForeignAPIRepo.php.
*
Definition at line 60 of file ForeignAPIRepo.php.
*
Definition at line 62 of file ForeignAPIRepo.php.
const ForeignAPIRepo::VERSION = "2.1" |
Definition at line 43 of file ForeignAPIRepo.php.