r22067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22066‎ | r22067 | r22068 >
Date:15:57, 10 May 2007
Author:tstarling
Status:old
Tags:
Comment:
Backported fix for broken $wgGenerateThumbnailOnParse feature. It was doing stat calls on parse, severely damaging performance.
Modified paths:
  • /branches/REL1_10/phase3/includes/Image.php (modified) (history)

Diff [purge]

Index: branches/REL1_10/phase3/includes/Image.php
@@ -929,17 +929,19 @@
930930 $thumbPath = wfImageThumbDir( $this->name, $this->fromSharedDirectory ) . "/$thumbName";
931931 $thumbUrl = $this->thumbUrlFromName( $thumbName );
932932
933 - $this->migrateThumbFile( $thumbName );
934933
935 - if ( file_exists( $thumbPath ) ) {
 934+ if ( !$wgGenerateThumbnailOnParse && !($flags & self::RENDER_NOW ) ) {
936935 $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
937936 break;
938937 }
939 -
940 - if ( !$wgGenerateThumbnailOnParse && !($flags & self::RENDER_NOW ) ) {
 938+
 939+ wfDebug( "Doing stat for $thumbPath\n" );
 940+ $this->migrateThumbFile( $thumbName );
 941+ if ( file_exists( $thumbPath ) ) {
941942 $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
942943 break;
943944 }
 945+
944946 $thumb = $handler->doTransform( $this, $thumbPath, $thumbUrl, $params );
945947
946948 // Ignore errors if requested