}
function transform( $params, $flags = 0 ) {
- if ( $this->repo->canCacheThumbs() ) {
+ if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) {
$thumbUrl = $this->repo->getThumbUrlFromCache(
$this->getName(),
isset( $params['width'] ) ? $params['width'] : -1,
*/
function getThumbPath( $suffix = '' ) {
$ret = null;
- if ( $this->repo->canCacheThumbs() ) {
+ if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) {
global $wgUploadDirectory;
$path = $wgUploadDirectory . '/' . $this->repo->apiThumbCacheDir . '/' . $this->repo->name . '/';
if ( $suffix ) {
function getThumbUrlFromCache( $name, $width, $height ) {
global $wgMemc, $wgUploadPath, $wgServer, $wgUploadDirectory;
+;
$key = wfMemcKey( 'ForeignAPIRepo', 'ThumbUrl', $name );
if ( $thumbUrl = $wgMemc->get($key) ) {
return $localUrl;
}
}
-
- /**
- * Are we locally caching the thumbnails?
- * @return bool
- */
- public function canCacheThumbs() {
- return ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir );
- }
}