Index: trunk/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | var $thumbScriptUrl, $transformVia404; |
17 | 17 | var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital; |
18 | 18 | var $pathDisclosureProtection = 'paranoid'; |
19 | | - var $descriptionCacheExpiry, $apiThumbCacheExpiry, $apiThumbCacheDir; |
| 19 | + var $descriptionCacheExpiry, $apiThumbCacheExpiry, $thumbDir; |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Factory functions for creating new files |
— | — | @@ -30,9 +30,10 @@ |
31 | 31 | |
32 | 32 | // Optional settings |
33 | 33 | $this->initialCapital = true; // by default |
| 34 | + $this->thumbDir = 'thumb/'; // sane default |
34 | 35 | foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription', |
35 | 36 | 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection', |
36 | | - 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'apiThumbCacheDir' ) as $var ) |
| 37 | + 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'thumbDir') as $var ) |
37 | 38 | { |
38 | 39 | if ( isset( $info[$var] ) ) { |
39 | 40 | $this->$var = $info[$var]; |
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | } |
123 | 123 | else { |
124 | 124 | $foreignUrl = $this->getThumbUrl( $name, $width, $height ); |
125 | | - $path = $this->apiThumbCacheDir . '/' . $this->name . '/' . |
| 125 | + $path = $this->thumbDir . '/' . $this->name . '/' . |
126 | 126 | $name . '/'; |
127 | 127 | if ( !is_dir($wgUploadDirectory . '/' . $path) ) { |
128 | 128 | wfMkdirParents($wgUploadDirectory . '/' . $path); |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -749,7 +749,7 @@ |
750 | 750 | |
751 | 751 | /** Get relative path for a thumbnail file */ |
752 | 752 | function getThumbRel( $suffix = false ) { |
753 | | - $path = 'thumb/' . $this->getRel(); |
| 753 | + $path = $this->repo->thumbDir . $this->getRel(); |
754 | 754 | if ( $suffix !== false ) { |
755 | 755 | $path .= '/' . $suffix; |
756 | 756 | } |
— | — | @@ -779,7 +779,7 @@ |
780 | 780 | |
781 | 781 | /** Get the URL of the thumbnail directory, or a particular file if $suffix is specified */ |
782 | 782 | function getThumbUrl( $suffix = false ) { |
783 | | - $path = $this->repo->getZoneUrl('public') . '/thumb/' . $this->getUrlRel(); |
| 783 | + $path = $this->repo->getZoneUrl('public') . '/'. $this->repo->thumbDir . $this->getUrlRel(); |
784 | 784 | if ( $suffix !== false ) { |
785 | 785 | $path .= '/' . rawurlencode( $suffix ); |
786 | 786 | } |
— | — | @@ -799,7 +799,7 @@ |
800 | 800 | |
801 | 801 | /** Get the virtual URL for a thumbnail file or directory */ |
802 | 802 | function getThumbVirtualUrl( $suffix = false ) { |
803 | | - $path = $this->repo->getVirtualUrl() . '/public/thumb/' . $this->getUrlRel(); |
| 803 | + $path = $this->repo->getVirtualUrl() . '/public/' . $this->repo->thumbDir . $this->getUrlRel(); |
804 | 804 | if ( $suffix !== false ) { |
805 | 805 | $path .= '/' . rawurlencode( $suffix ); |
806 | 806 | } |
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | } |
33 | 33 | |
34 | 34 | function transform( $params, $flags = 0 ) { |
35 | | - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) { |
| 35 | + if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) { |
36 | 36 | $thumbUrl = $this->repo->getThumbUrlFromCache( |
37 | 37 | $this->getName(), |
38 | 38 | isset( $params['width'] ) ? $params['width'] : -1, |
— | — | @@ -110,9 +110,9 @@ |
111 | 111 | */ |
112 | 112 | function getThumbPath( $suffix = '' ) { |
113 | 113 | $ret = null; |
114 | | - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) { |
| 114 | + if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) { |
115 | 115 | global $wgUploadDirectory; |
116 | | - $path = $wgUploadDirectory . '/' . $this->repo->apiThumbCacheDir . '/' . $this->repo->name . '/'; |
| 116 | + $path = $wgUploadDirectory . '/' . $this->repo->thumbDir . '/' . $this->repo->name . '/'; |
117 | 117 | if ( $suffix ) { |
118 | 118 | $path = $path . $suffix . '/'; |
119 | 119 | } |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -206,6 +206,9 @@ |
207 | 207 | * May be 'paranoid' to remove all parameters from error messages, 'none' to |
208 | 208 | * leave the paths in unchanged, or 'simple' to replace paths with |
209 | 209 | * placeholders. Default for LocalRepo is 'simple'. |
| 210 | + * thumbDir |
| 211 | + * Sub-directory of $wgUploadPath in which to place thumbnails. Defaults to |
| 212 | + * 'thumb/'. |
210 | 213 | * |
211 | 214 | * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored |
212 | 215 | * for local repositories: |