MediaWiki
REL1_20
|
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) | |
getFileProps ($virtualUrl) | |
getImageInfo ($data) | |
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) | |
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 | |
$apiThumbCacheExpiry = 86400 | |
$fileCacheExpiry = 2592000 | |
$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' ) | |
Factory functions for creating new files Override these in the base class. | |
const | VERSION = "2.1" |
Protected Member Functions | |
assertWritableRepo () | |
Protected Attributes | |
$mFileExists = 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 | ) |
$info | array|null |
Definition at line 57 of file ForeignAPIRepo.php.
References canCacheThumbs().
ForeignAPIRepo::assertWritableRepo | ( | ) | [protected] |
MWException |
Reimplemented from FileRepo.
Definition at line 423 of file ForeignAPIRepo.php.
Are we locally caching the thumbnails?
Definition at line 370 of file ForeignAPIRepo.php.
Referenced by __construct(), and getThumbUrlFromCache().
ForeignAPIRepo::enumFiles | ( | $ | callback | ) |
$callback | Array|string |
MWException |
Reimplemented from FileRepo.
Definition at line 416 of file ForeignAPIRepo.php.
ForeignAPIRepo::fetchImageQuery | ( | $ | query | ) |
$query | array |
Definition at line 145 of file ForeignAPIRepo.php.
References FileRepo\$url, $wgMemc, FormatJson\decode(), FileRepo\getLocalCacheKey(), httpGet(), FileRepo\makeUrl(), and wfAppendQuery().
Referenced by fileExistsBatch(), findBySha1(), and getThumbUrl().
ForeignAPIRepo::fileExistsBatch | ( | array $ | files | ) |
$files | array |
Reimplemented from FileRepo.
Definition at line 102 of file ForeignAPIRepo.php.
References $f, $file, fetchImageQuery(), FileBackend\isStoragePath(), and wfWarn().
ForeignAPIRepo::findBySha1 | ( | $ | hash | ) |
$hash | string |
Reimplemented from FileRepo.
Definition at line 199 of file ForeignAPIRepo.php.
References fetchImageQuery(), ForeignAPIFile\getProps(), and Title\makeTitle().
ForeignAPIRepo::getFileProps | ( | $ | virtualUrl | ) |
$virtualUrl | string |
Reimplemented from FileRepo.
Definition at line 137 of file ForeignAPIRepo.php.
ForeignAPIRepo::getImageInfo | ( | $ | data | ) |
$data | array |
Definition at line 184 of file ForeignAPIRepo.php.
Referenced by getThumbUrl().
ForeignAPIRepo::getThumbUrl | ( | $ | name, |
$ | width = -1 , |
||
$ | height = -1 , |
||
&$ | result = null , |
||
$ | otherParams = '' |
||
) |
$name | string |
$width | int |
$height | int |
$result | null |
$otherParams | string |
Definition at line 225 of file ForeignAPIRepo.php.
References $result, fetchImageQuery(), getImageInfo(), and wfDebug().
Referenced by getThumbUrlFromCache().
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.
$name | String is a dbkey form of a title | |
$width | ||
$height | ||
String | $params | Other rendering parameters (page number, etc) from handler's makeParamString. |
Definition at line 256 of file ForeignAPIRepo.php.
References FileRepo\$backend, $params, $result, $wgMemc, canCacheThumbs(), FileBackend\fileExists(), FileRepo\getBackend(), FileBackend\getFileTimestamp(), FileRepo\getHashPath(), FileRepo\getLocalCacheKey(), getThumbUrl(), getZonePath(), getZoneUrl(), httpGet(), FileBackend\prepare(), FileBackend\quickCreate(), FileRepo\validateFilename(), and wfDebug().
static ForeignAPIRepo::getUserAgent | ( | ) | [static] |
The user agent the ForeignAPIRepo will use.
Definition at line 378 of file ForeignAPIRepo.php.
References Http\userAgent(), and VERSION.
Referenced by httpGet().
ForeignAPIRepo::getZonePath | ( | $ | zone | ) |
Get the local directory corresponding to one of the basic zones.
$zone | string |
Reimplemented from FileRepo.
Definition at line 358 of file ForeignAPIRepo.php.
Referenced by getThumbUrlFromCache().
ForeignAPIRepo::getZoneUrl | ( | $ | zone | ) |
$zone | String |
Reimplemented from FileRepo.
Definition at line 342 of file ForeignAPIRepo.php.
Referenced by getThumbUrlFromCache().
static ForeignAPIRepo::httpGet | ( | $ | url, |
$ | timeout = 'default' , |
||
$ | options = array() |
||
) | [static] |
Like a Http:get request, but with custom User-Agent.
$url | string |
$timeout | string |
$options | array |
Definition at line 390 of file ForeignAPIRepo.php.
References $options, FileRepo\$url, MWHttpRequest\factory(), getUserAgent(), wfDebug(), and wfExpandUrl().
Referenced by fetchImageQuery(), and getThumbUrlFromCache().
ForeignAPIRepo::newFile | ( | $ | title, |
$ | time = false |
||
) |
ForeignAPIRepo::$apiThumbCacheExpiry = 86400 |
Definition at line 47 of file ForeignAPIRepo.php.
ForeignAPIRepo::$fileCacheExpiry = 2592000 |
Definition at line 49 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 45 of file ForeignAPIRepo.php.
ForeignAPIRepo::$mFileExists = array() [protected] |
Definition at line 52 of file ForeignAPIRepo.php.
ForeignAPIRepo::$mQueryCache = array() [protected] |
Definition at line 51 of file ForeignAPIRepo.php.
const ForeignAPIRepo::VERSION = "2.1" |
Definition at line 43 of file ForeignAPIRepo.php.
Referenced by getUserAgent().