r39257 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39256‎ | r39257 | r39258 >
Date:00:48, 13 August 2008
Author:aaron
Status:old
Tags:
Comment:
maintain proper order
Modified paths:
  • /trunk/tools/upload-scripts/thumb-handler.php (modified) (history)

Diff [purge]

Index: trunk/tools/upload-scripts/thumb-handler.php
@@ -6,7 +6,7 @@
77 if ( preg_match('!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/\w/\w\w/([^/]*)/' .
88 '(page(\d*)-)*(\d*)px-([^/]*)$!', $uri, $matches ) )
99 {
10 - list( $all, $site, $lang, $filename, $pagefull, $pagenum, $size, $fn2 ) = $matches;
 10+ list( $all, $site, $lang, $filename, $arch, $pagefull, $pagenum, $size, $fn2 ) = $matches;
1111 $params = array(
1212 'f' => $filename,
1313 'width' => $size
@@ -14,15 +14,21 @@
1515 if ( $pagenum ) {
1616 $params['page'] = $pagenum;
1717 }
 18+ if ( $arch ) {
 19+ $params['arch'] = 1;
 20+ }
1821 } elseif ( preg_match('!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/\w/\w\w/([^/]*\.(?:(?i)ogg))/' .
1922 '(mid|seek(?:=|%3D|%3d)\d+)-([^/]*)$!', $uri, $matches ) )
2023 {
21 - list( $all, $site, $lang, $filename, $timeFull, $fn2 ) = $matches;
 24+ list( $all, $site, $lang, $filename, $arch, $timeFull, $fn2 ) = $matches;
2225 $params = array( 'f' => $filename );
2326 if ( $timeFull != 'mid' ) {
2427 list( $seek, $thumbtime ) = explode( '=', urldecode( $timeFull ), 2 );
2528 $params['thumbtime'] = $thumbtime;
2629 }
 30+ if ( $arch ) {
 31+ $params['arch'] = 1;
 32+ }
2733 } else {
2834 # No, display standard 404
2935 header( 'X-Debug: no regex match' );
@@ -190,7 +196,7 @@
191197 if( preg_match( '!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/(\w)/(\w\w)/([^/]*)/([^/]*)$!',
192198 $url, $matches ) ) {
193199 $parts = array_map( 'rawurldecode', $matches );
194 - list( $all, $site, $lang, $hash1, $hash2, $filename, $fn2 ) = $parts;
 200+ list( $all, $site, $lang, $hash1, $arch, $hash2, $filename, $fn2 ) = $parts;
195201
196202 $md5 = md5( $filename );
197203 if( $hash1 != substr( $md5, 0, 1 ) ) return false;
@@ -206,7 +212,7 @@
207213 }
208214
209215 if( $good ) {
210 - $thumbPath = array( '', 'export', 'upload', $site, $lang, 'thumb', $hash1, $hash2, $filename, $fn2 );
 216+ $thumbPath = array( '', 'export', 'upload', $site, $lang, 'thumb', $arch, $hash1, $hash2, $filename, $fn2 );
211217 if ( !checkPathComponents( $thumbPath ) ) return false;
212218 return implode( '/', $thumbPath );
213219 }

Status & tagging log