* Add a .htaccess to deleted images directory for additional protection
[lhc/web/wiklou.git] / includes / filerepo / ForeignAPIFile.php
index c97d225..847f9dc 100644 (file)
@@ -31,17 +31,10 @@ class ForeignAPIFile extends File {
        }
 
        function transform( $params, $flags = 0 ) {
-               if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) {
-                       $thumbUrl = $this->repo->getThumbUrlFromCache(
+               $thumbUrl = $this->repo->getThumbUrlFromCache(
                                $this->getName(),
                                isset( $params['width'] ) ? $params['width'] : -1,
                                isset( $params['height'] ) ? $params['height'] : -1 );
-               } else {
-                       $thumbUrl = $this->repo->getThumbUrl(
-                               $this->getName(),
-                               isset( $params['width'] ) ? $params['width'] : -1,
-                               isset( $params['height'] ) ? $params['height'] : -1 );
-               }
                if( $thumbUrl ) {
                        return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );;
                }
@@ -109,10 +102,9 @@ class ForeignAPIFile extends File {
         * Only useful if we're locally caching thumbs anyway...
         */
        function getThumbPath( $suffix = '' ) {
-               $ret = null;
-               if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) {
+               if ( $this->repo->canCacheThumbs() ) {
                        global $wgUploadDirectory;
-                       $path = $wgUploadDirectory . '/' . $this->repo->thumbDir . '/' . $this->repo->name . '/';
+                       $path = $wgUploadDirectory . '/thumb/' . $this->getHashPath( $this->getName() );
                        if ( $suffix ) {
                                $path = $path . $suffix . '/';
                        }