Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -112,7 +112,6 @@ |
113 | 113 | |
114 | 114 | function getThumbUrlFromCache( $name, $width, $height ) { |
115 | 115 | global $wgMemc, $wgUploadPath, $wgServer, $wgUploadDirectory; |
116 | | -; |
117 | 116 | |
118 | 117 | $key = wfMemcKey( 'ForeignAPIRepo', 'ThumbUrl', $name ); |
119 | 118 | if ( $thumbUrl = $wgMemc->get($key) ) { |
— | — | @@ -135,4 +134,12 @@ |
136 | 135 | return $localUrl; |
137 | 136 | } |
138 | 137 | } |
| 138 | + |
| 139 | + /** |
| 140 | + * Are we locally caching the thumbnails? |
| 141 | + * @return bool |
| 142 | + */ |
| 143 | + public function canCacheThumbs() { |
| 144 | + return ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ); |
| 145 | + } |
139 | 146 | } |
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | } |
33 | 33 | |
34 | 34 | function transform( $params, $flags = 0 ) { |
35 | | - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) { |
| 35 | + if ( $this->repo->canCacheThumbs() ) { |
36 | 36 | $thumbUrl = $this->repo->getThumbUrlFromCache( |
37 | 37 | $this->getName(), |
38 | 38 | isset( $params['width'] ) ? $params['width'] : -1, |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | */ |
112 | 112 | function getThumbPath( $suffix = '' ) { |
113 | 113 | $ret = null; |
114 | | - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) { |
| 114 | + if ( $this->repo->canCacheThumbs() ) { |
115 | 115 | global $wgUploadDirectory; |
116 | 116 | $path = $wgUploadDirectory . '/' . $this->repo->apiThumbCacheDir . '/' . $this->repo->name . '/'; |
117 | 117 | if ( $suffix ) { |