r108706 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108705‎ | r108706 | r108707 >
Date:02:39, 12 January 2012
Author:aaron
Status:ok
Tags:
Comment:
Reverted r108695: as these are still used by upload stash and I don't feel like changing that or thumb-handler.php. The whole public temp file usage by MediaWiki needs to be thought out more, but this can happen later.
Modified paths:
  • /trunk/extensions/SwiftMedia/wmf/rewrite.py (modified) (history)
  • /trunk/extensions/SwiftMedia/wmf/tests/rewriteRegexTest.py (modified) (history)

Diff [purge]

Index: trunk/extensions/SwiftMedia/wmf/tests/rewriteRegexTest.py
@@ -1,19 +1,7 @@
22 import re
33
4 -# Rewrite URLs of these forms (source, temp, and thumbnail files):
5 -# (a) http://upload.wikimedia.org/<proj>/<lang>/.*
6 -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/.*
7 -# (b) http://upload.wikimedia.org/<proj>/<lang>/archive/.*
8 -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-public/archive/.*
9 -# (c) http://upload.wikimedia.org/<proj>/<lang>/thumb/.*
10 -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/.*
11 -# (d) http://upload.wikimedia.org/<proj>/<lang>/thumb/archive/.*
12 -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/archive/.*
13 -# (e) http://upload.wikimedia.org/<proj>/<lang>/temp/.*
14 -# => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-temp/.*
15 -
164 # The regex to test (for rewrite.py)
17 -regex = r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>(archive/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$'
 5+regex = r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>((temp|archive)/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$'
186
197 # [url,proj,lang,zone,shard,path]
208 cases = []
@@ -25,6 +13,8 @@
2614 'wikipedia', 'commons', 'thumb', 'ab', 'a/ab/file.jpg'] )
2715 cases.append( ['/wikipedia/commons/thumb/archive/a/ab/file.jpg',
2816 'wikipedia', 'commons', 'thumb', 'ab', 'archive/a/ab/file.jpg'] )
 17+cases.append( ['/wikipedia/commons/thumb/temp/a/ab/file.jpg',
 18+ 'wikipedia', 'commons', 'thumb', 'ab', 'temp/a/ab/file.jpg'] )
2919 cases.append( ['/wikipedia/commons/temp/a/ab/file.jpg',
3020 'wikipedia', 'commons', 'temp', 'ab', 'a/ab/file.jpg'] )
3121
Index: trunk/extensions/SwiftMedia/wmf/rewrite.py
@@ -191,9 +191,11 @@
192192 # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/.*
193193 # (d) http://upload.wikimedia.org/<proj>/<lang>/thumb/archive/.*
194194 # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/archive/.*
195 - # (e) http://upload.wikimedia.org/<proj>/<lang>/temp/.*
 195+ # (e) http://upload.wikimedia.org/<proj>/<lang>/thumb/temp/.*
 196+ # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-thumb/temp/.*
 197+ # (f) http://upload.wikimedia.org/<proj>/<lang>/temp/.*
196198 # => http://msfe/v1/AUTH_<hash>/<proj>-<lang>-local-temp/.*
197 - match = re.match(r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>(archive/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$', req.path)
 199+ match = re.match(r'^/(?P<proj>[^/]+)/(?P<lang>[^/]+)/((?P<zone>thumb|temp)/)?(?P<path>((temp|archive)/)?[0-9a-f]/(?P<shard>[0-9a-f]{2})/.+)$', req.path)
198200 if match:
199201 # Get the repo zone (if not provided that means "public")
200202 zone = (match.group('zone') if match.group('zone') else 'public')

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108695Removed thumb/temp rewrites; such urls are not used anymoreaaron23:30, 11 January 2012

Status & tagging log