From b7ecf45444f1c0d979d9efc5d77c44c5a2b252a6 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 3 Jul 2008 21:33:09 +0000 Subject: [PATCH] Simplify configuration and make a better caching key. --- includes/filerepo/File.php | 6 +++--- includes/filerepo/FileRepo.php | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 0e634eb73c..ea6bdadabe 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -1068,9 +1068,9 @@ abstract class File { } $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName() ); if ( $renderUrl ) { - if ( $this->repo->useLocalCache ) { + if ( $this->repo->descriptionCacheExpiry > 0 ) { wfDebug("Attempting to get the description from the transwiki cache..."); - $key = md5($renderUrl); + $key = wfMemcKey( 'filedesc', 'url', md5($link)); $obj = $wgMemc->get($key); if ($obj) { wfDebug("success!\n"); @@ -1080,7 +1080,7 @@ abstract class File { } wfDebug( "Fetching shared description from $renderUrl\n" ); $res = Http::get( $renderUrl ); - if ( $res && $this->repo->useLocalCache ) $wgMemc->set( $key, $res, $this->repo->localCacheExpiry ); + if ( $res && $this->repo->descriptionCacheExpiry > 0 ) $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry ); return $res; } else { return false; diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index b6318d612a..edfc2a9978 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -30,8 +30,7 @@ abstract class FileRepo { // Optional settings $this->initialCapital = true; // by default foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription', - 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection', - 'useLocalCache', 'localCacheExpiry' ) as $var ) + 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection', 'descriptionCacheExpiry' ) as $var ) { if ( isset( $info[$var] ) ) { $this->$var = $info[$var]; -- 2.20.1