r40504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40503‎ | r40504 | r40505 >
Date:18:29, 5 September 2008
Author:demon
Status:old
Tags:
Comment:
Revert r40385. Half-assed attempt at making something configurable that doesn't need to be leads to borken code. /thumb/ is no longer configurable...just like it was before.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -15,7 +15,7 @@
1616 var $thumbScriptUrl, $transformVia404;
1717 var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital;
1818 var $pathDisclosureProtection = 'paranoid';
19 - var $descriptionCacheExpiry, $apiThumbCacheExpiry, $thumbDir;
 19+ var $descriptionCacheExpiry, $apiThumbCacheExpiry, $apiThumbCacheDir;
2020
2121 /**
2222 * Factory functions for creating new files
@@ -30,10 +30,9 @@
3131
3232 // Optional settings
3333 $this->initialCapital = true; // by default
34 - $this->thumbDir = 'thumb/'; // sane default
3534 foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
3635 'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
37 - 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'thumbDir') as $var )
 36+ 'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'apiThumbCacheDir' ) as $var )
3837 {
3938 if ( isset( $info[$var] ) ) {
4039 $this->$var = $info[$var];
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -121,7 +121,7 @@
122122 }
123123 else {
124124 $foreignUrl = $this->getThumbUrl( $name, $width, $height );
125 - $path = $this->thumbDir . '/' . $this->name . '/' .
 125+ $path = $this->apiThumbCacheDir . '/' . $this->name . '/' .
126126 $name . '/';
127127 if ( !is_dir($wgUploadDirectory . '/' . $path) ) {
128128 wfMkdirParents($wgUploadDirectory . '/' . $path);
Index: trunk/phase3/includes/filerepo/File.php
@@ -747,7 +747,7 @@
748748
749749 /** Get relative path for a thumbnail file */
750750 function getThumbRel( $suffix = false ) {
751 - $path = $this->repo->thumbDir . $this->getRel();
 751+ $path = 'thumb/' . $this->getRel();
752752 if ( $suffix !== false ) {
753753 $path .= '/' . $suffix;
754754 }
@@ -777,7 +777,7 @@
778778
779779 /** Get the URL of the thumbnail directory, or a particular file if $suffix is specified */
780780 function getThumbUrl( $suffix = false ) {
781 - $path = $this->repo->getZoneUrl('public') . '/'. $this->repo->thumbDir . $this->getUrlRel();
 781+ $path = $this->repo->getZoneUrl('public') . '/thumb/' . $this->getUrlRel();
782782 if ( $suffix !== false ) {
783783 $path .= '/' . rawurlencode( $suffix );
784784 }
@@ -797,7 +797,7 @@
798798
799799 /** Get the virtual URL for a thumbnail file or directory */
800800 function getThumbVirtualUrl( $suffix = false ) {
801 - $path = $this->repo->getVirtualUrl() . '/public/' . $this->repo->thumbDir . $this->getUrlRel();
 801+ $path = $this->repo->getVirtualUrl() . '/public/thumb/' . $this->getUrlRel();
802802 if ( $suffix !== false ) {
803803 $path .= '/' . rawurlencode( $suffix );
804804 }
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -31,7 +31,7 @@
3232 }
3333
3434 function transform( $params, $flags = 0 ) {
35 - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) {
 35+ if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) {
3636 $thumbUrl = $this->repo->getThumbUrlFromCache(
3737 $this->getName(),
3838 isset( $params['width'] ) ? $params['width'] : -1,
@@ -110,9 +110,9 @@
111111 */
112112 function getThumbPath( $suffix = '' ) {
113113 $ret = null;
114 - if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->thumbDir ) {
 114+ if ( $this->repo->apiThumbCacheExpiry > 0 && $this->repo->apiThumbCacheDir ) {
115115 global $wgUploadDirectory;
116 - $path = $wgUploadDirectory . '/' . $this->repo->thumbDir . '/' . $this->repo->name . '/';
 116+ $path = $wgUploadDirectory . '/' . $this->repo->apiThumbCacheDir . '/' . $this->repo->name . '/';
117117 if ( $suffix ) {
118118 $path = $path . $suffix . '/';
119119 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -206,9 +206,6 @@
207207 * May be 'paranoid' to remove all parameters from error messages, 'none' to
208208 * leave the paths in unchanged, or 'simple' to replace paths with
209209 * placeholders. Default for LocalRepo is 'simple'.
210 - * thumbDir
211 - * Sub-directory of $wgUploadPath in which to place thumbnails. Defaults to
212 - * 'thumb/'.
213210 *
214211 * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
215212 * for local repositories:

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r40385Implement 'thumbDir' configuration parameter for local and foreign repos. Rep...demon15:47, 3 September 2008

Status & tagging log