r2462 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r2461‎ | r2462 | r2463 >
Date:00:37, 9 February 2004
Author:jeluf
Status:old
Tags:
Comment:
Fix bug with md5 generation of archived images
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -132,7 +132,7 @@
133133 }
134134
135135
136 -function wfImageArchiveUrl( $name, $subdir="archive" )
 136+function wfImageThumbUrl( $name, $subdir="thumb" )
137137 {
138138 global $wgUploadPath;
139139
@@ -142,6 +142,16 @@
143143 return wfUrlencode($url);
144144 }
145145
 146+function wfImageArchiveUrl( $name )
 147+{
 148+ global $wgUploadPath;
 149+
 150+ $hash = md5( substr( $name, 15) );
 151+ $url = "{$wgUploadPath}/archive/" . $hash{0} . "/" .
 152+ substr( $hash, 0, 2 ) . "/{$name}";
 153+ return wfUrlencode($url);
 154+}
 155+
146156 function wfUrlencode ( $s )
147157 {
148158 $ulink = urlencode( $s );
@@ -462,6 +472,11 @@
463473 return $dest;
464474 }
465475
 476+function wfImageThumbDir( $fname , $subdir="thumb")
 477+{
 478+ return wfImageArchiveDir( $fname, $subdir );
 479+}
 480+
466481 function wfImageArchiveDir( $fname , $subdir="archive")
467482 {
468483 global $wgUploadDirectory;
Index: trunk/phase3/includes/Skin.php
@@ -1519,8 +1519,8 @@
15201520 global $wgUseImageMagick;
15211521 $imgPath = wfImagePath( $name );
15221522 $thumbName = $width."px-".$icon.$name;
1523 - $thumbPath = wfImageArchiveDir( $thumbName, "thumb" )."/".$thumbName;
1524 - $thumbUrl = wfImageArchiveUrl( $thumbName, "thumb" );
 1523+ $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName;
 1524+ $thumbUrl = wfImageThumbUrl( $thumbName );
15251525
15261526 if ( (! file_exists( $thumbPath ) && file_exists( $imgPath ))
15271527 || ( filemtime($thumbPath) < filemtime($imgPath) ) ) {

Status & tagging log