r41374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41373‎ | r41374 | r41375 >
Date:08:23, 29 September 2008
Author:demon
Status:old
Tags:
Comment:
Move some of this caching logic out of the file and into the repo where it belongs.
Modified paths:
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -113,6 +113,10 @@
114114 function getThumbUrlFromCache( $name, $width, $height ) {
115115 global $wgMemc, $wgUploadPath, $wgServer, $wgUploadDirectory;
116116
 117+ if ( !$this->canCacheThumbs() ) {
 118+ return $this->getThumbUrl();
 119+ }
 120+
117121 $key = wfMemcKey( 'ForeignAPIRepo', 'ThumbUrl', $name );
118122 if ( $thumbUrl = $wgMemc->get($key) ) {
119123 wfDebug("Got thumb from local cache. $thumbUrl \n");
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -31,17 +31,10 @@
3232 }
3333
3434 function transform( $params, $flags = 0 ) {
35 - if ( $this->repo->canCacheThumbs() ) {
36 - $thumbUrl = $this->repo->getThumbUrlFromCache(
 35+ $thumbUrl = $this->repo->getThumbUrlFromCache(
3736 $this->getName(),
3837 isset( $params['width'] ) ? $params['width'] : -1,
3938 isset( $params['height'] ) ? $params['height'] : -1 );
40 - } else {
41 - $thumbUrl = $this->repo->getThumbUrl(
42 - $this->getName(),
43 - isset( $params['width'] ) ? $params['width'] : -1,
44 - isset( $params['height'] ) ? $params['height'] : -1 );
45 - }
4639 if( $thumbUrl ) {
4740 return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );;
4841 }

Status & tagging log