r37010 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37009‎ | r37010 | r37011 >
Date:21:33, 3 July 2008
Author:demon
Status:old
Tags:
Comment:
Simplify configuration and make a better caching key.
Modified paths:
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -30,8 +30,7 @@
3131 // Optional settings
3232 $this->initialCapital = true; // by default
3333 foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
34 - 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
35 - 'useLocalCache', 'localCacheExpiry' ) as $var )
 34+ 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection', 'descriptionCacheExpiry' ) as $var )
3635 {
3736 if ( isset( $info[$var] ) ) {
3837 $this->$var = $info[$var];
Index: trunk/phase3/includes/filerepo/File.php
@@ -1068,9 +1068,9 @@
10691069 }
10701070 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName() );
10711071 if ( $renderUrl ) {
1072 - if ( $this->repo->useLocalCache ) {
 1072+ if ( $this->repo->descriptionCacheExpiry > 0 ) {
10731073 wfDebug("Attempting to get the description from the transwiki cache...");
1074 - $key = md5($renderUrl);
 1074+ $key = wfMemcKey( 'filedesc', 'url', md5($link));
10751075 $obj = $wgMemc->get($key);
10761076 if ($obj) {
10771077 wfDebug("success!\n");
@@ -1080,7 +1080,7 @@
10811081 }
10821082 wfDebug( "Fetching shared description from $renderUrl\n" );
10831083 $res = Http::get( $renderUrl );
1084 - if ( $res && $this->repo->useLocalCache ) $wgMemc->set( $key, $res, $this->repo->localCacheExpiry );
 1084+ if ( $res && $this->repo->descriptionCacheExpiry > 0 ) $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
10851085 return $res;
10861086 } else {
10871087 return false;

Status & tagging log