From: Siebrand Mazeland Date: Mon, 22 Sep 2008 22:09:55 +0000 (+0000) Subject: Revert 41164: PHP Notice: Undefined property: ForeignAPIRepo::$repo in includes... X-Git-Tag: 1.31.0-rc.0~45132 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=7013b2e3b7eb88b4b1f9d8877552f01d6a411ce6;p=lhc%2Fweb%2Fwiklou.git Revert 41164: PHP Notice: Undefined property: ForeignAPIRepo::$repo in includes/filerepo/ForeignAPIRepo.php on line 143 --- diff --git a/includes/filerepo/ForeignAPIFile.php b/includes/filerepo/ForeignAPIFile.php index 336c928004..42bd7e10b8 100644 --- a/includes/filerepo/ForeignAPIFile.php +++ b/includes/filerepo/ForeignAPIFile.php @@ -31,7 +31,7 @@ class ForeignAPIFile extends File { } 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, @@ -110,7 +110,7 @@ class ForeignAPIFile extends File { */ 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 ) { diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 4943ed3ee2..bd53686d12 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -112,6 +112,7 @@ class ForeignAPIRepo extends FileRepo { function getThumbUrlFromCache( $name, $width, $height ) { global $wgMemc, $wgUploadPath, $wgServer, $wgUploadDirectory; +; $key = wfMemcKey( 'ForeignAPIRepo', 'ThumbUrl', $name ); if ( $thumbUrl = $wgMemc->get($key) ) { @@ -134,12 +135,4 @@ class ForeignAPIRepo extends FileRepo { return $localUrl; } } - - /** - * Are we locally caching the thumbnails? - * @return bool - */ - public function canCacheThumbs() { - return ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ); - } }