r53369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53368‎ | r53369 | r53370 >
Date:18:07, 16 July 2009
Author:tstarling
Status:ok (Comments)
Tags:
Comment:
* Added FSRepo configuration properties thumbUrl and thumbDir, to allow the thumbnails to be stored in a separate location to the source images. Did this by making thumbnails a separate zone instead of a subdirectory of the public zone. Tested normal transform, thumb.php.
* Removed getThumbRel(), doesn't make sense in conjunction with above options. Not used by core or hosted extensions.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FSRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FSRepo.php
@@ -24,6 +24,16 @@
2525 $info['deletedHashLevels'] : $this->hashLevels;
2626 $this->deletedDir = isset( $info['deletedDir'] ) ? $info['deletedDir'] : false;
2727 $this->fileMode = isset( $info['fileMode'] ) ? $info['fileMode'] : 0644;
 28+ if ( isset( $info['thumbDir'] ) ) {
 29+ $this->thumbDir = $info['thumbDir'];
 30+ } else {
 31+ $this->thumbDir = "{$this->directory}/thumb";
 32+ }
 33+ if ( isset( $info['thumbUrl'] ) ) {
 34+ $this->thumbUrl = $info['thumbUrl'];
 35+ } else {
 36+ $this->thumbUrl = "{$this->url}/thumb";
 37+ }
2838 }
2939
3040 /**
@@ -58,6 +68,8 @@
5969 return "{$this->directory}/temp";
6070 case 'deleted':
6171 return $this->deletedDir;
 72+ case 'thumb':
 73+ return $this->thumbDir;
6274 default:
6375 return false;
6476 }
@@ -74,6 +86,8 @@
7587 return "{$this->url}/temp";
7688 case 'deleted':
7789 return false; // no public URL
 90+ case 'thumb':
 91+ return $this->thumbUrl;
7892 default:
7993 return false;
8094 }
Index: trunk/phase3/includes/filerepo/File.php
@@ -746,15 +746,6 @@
747747 return $path;
748748 }
749749
750 - /** Get relative path for a thumbnail file */
751 - function getThumbRel( $suffix = false ) {
752 - $path = 'thumb/' . $this->getRel();
753 - if ( $suffix !== false ) {
754 - $path .= '/' . $suffix;
755 - }
756 - return $path;
757 - }
758 -
759750 /** Get the path of the archive directory, or a particular file if $suffix is specified */
760751 function getArchivePath( $suffix = false ) {
761752 return $this->repo->getZonePath('public') . '/' . $this->getArchiveRel( $suffix );
@@ -762,7 +753,11 @@
763754
764755 /** Get the path of the thumbnail directory, or a particular file if $suffix is specified */
765756 function getThumbPath( $suffix = false ) {
766 - return $this->repo->getZonePath('public') . '/' . $this->getThumbRel( $suffix );
 757+ $path = $this->repo->getZonePath('thumb') . '/' . $this->getRel();
 758+ if ( $suffix !== false ) {
 759+ $path .= '/' . $suffix;
 760+ }
 761+ return $path;
767762 }
768763
769764 /** Get the URL of the archive directory, or a particular file if $suffix is specified */
@@ -778,7 +773,7 @@
779774
780775 /** Get the URL of the thumbnail directory, or a particular file if $suffix is specified */
781776 function getThumbUrl( $suffix = false ) {
782 - $path = $this->repo->getZoneUrl('public') . '/thumb/' . $this->getUrlRel();
 777+ $path = $this->repo->getZoneUrl('thumb') . '/' . $this->getUrlRel();
783778 if ( $suffix !== false ) {
784779 $path .= '/' . rawurlencode( $suffix );
785780 }
@@ -798,7 +793,7 @@
799794
800795 /** Get the virtual URL for a thumbnail file or directory */
801796 function getThumbVirtualUrl( $suffix = false ) {
802 - $path = $this->repo->getVirtualUrl() . '/public/thumb/' . $this->getUrlRel();
 797+ $path = $this->repo->getVirtualUrl() . '/thumb/' . $this->getUrlRel();
803798 if ( $suffix !== false ) {
804799 $path .= '/' . rawurlencode( $suffix );
805800 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -204,7 +204,7 @@
205205 *
206206 * name A unique name for the repository.
207207 *
208 - * For all core repos:
 208+ * For most core repos:
209209 * url Base public URL
210210 * hashLevels The number of directory levels for hash-based division of files
211211 * thumbScriptUrl The URL for thumb.php (optional, not recommended)
@@ -220,7 +220,12 @@
221221 * placeholders. Default for LocalRepo is 'simple'.
222222 * fileMode This allows wikis to set the file mode when uploading/moving files. Default
223223 * is 0644.
 224+ * directory The local filesystem directory where public files are stored. Not used for
 225+ * some remote repos.
 226+ * thumbDir The base thumbnail directory. Defaults to <directory>/thumb.
 227+ * thumbUrl The base thumbnail URL. Defaults to <url>/thumb.
224228 *
 229+ *
225230 * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
226231 * for local repositories:
227232 * descBaseUrl URL of image description pages, e.g. http://en.wikipedia.org/wiki/Image:
Index: trunk/phase3/RELEASE-NOTES
@@ -143,6 +143,8 @@
144144 display for old versions of images.
145145 * In watchlists and Special:RecentChanges, the difference in page size now
146146 appears in dark green if bytes were added and dark red if bytes were removed.
 147+* Added FSRepo configuration properties thumbUrl and thumbDir, to allow the
 148+ thumbnails to be stored in a separate location to the source images.
147149
148150 === Bug fixes in 1.16 ===
149151

Follow-up revisions

RevisionCommit summaryAuthorDate
r53375Merge Tim's addition of configurable thumbnail dir to FSRepo (trunk r53369)...brion18:43, 16 July 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   19:22, 31 October 2011

It felt weird that we have getArchiveThumbRel() but not getThumbRel()...I ended up tracking down this rev. Maybe it would be nice to have a getThumbRel() that just returns getRel()?

Status & tagging log