* Added FSRepo configuration properties thumbUrl and thumbDir, to allow the thumbnail...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 16 Jul 2009 18:07:23 +0000 (18:07 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 16 Jul 2009 18:07:23 +0000 (18:07 +0000)
* Removed getThumbRel(), doesn't make sense in conjunction with above options. Not used by core or hosted extensions.

RELEASE-NOTES
includes/DefaultSettings.php
includes/filerepo/FSRepo.php
includes/filerepo/File.php

index 703de6d..dbf3272 100644 (file)
@@ -143,6 +143,8 @@ this. Was used when mwEmbed was going to be an extension.
   display for old versions of images.
 * In watchlists and Special:RecentChanges, the difference in page size now
   appears in dark green if bytes were added and dark red if bytes were removed.
+* Added FSRepo configuration properties thumbUrl and thumbDir, to allow the 
+  thumbnails to be stored in a separate location to the source images.
 
 === Bug fixes in 1.16 ===
 
index d84fd59..2384130 100644 (file)
@@ -204,7 +204,7 @@ $wgFileStore['deleted']['hash'] = 3;         ///< 3-level subdirectory split
  *
  *    name                             A unique name for the repository.
  *
- * For all core repos:
+ * For most core repos:
  *    url               Base public URL
  *    hashLevels        The number of directory levels for hash-based division of files
  *    thumbScriptUrl    The URL for thumb.php (optional, not recommended)
@@ -220,6 +220,11 @@ $wgFileStore['deleted']['hash'] = 3;         ///< 3-level subdirectory split
  *                      placeholders. Default for LocalRepo is 'simple'.
  *    fileMode          This allows wikis to set the file mode when uploading/moving files. Default
  *                      is 0644.
+ *    directory         The local filesystem directory where public files are stored. Not used for
+ *                      some remote repos.
+ *    thumbDir          The base thumbnail directory. Defaults to <directory>/thumb.
+ *    thumbUrl          The base thumbnail URL. Defaults to <url>/thumb.
+ *
  *
  * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
  * for local repositories:
index 680ec93..5bc6034 100644 (file)
@@ -24,6 +24,16 @@ class FSRepo extends FileRepo {
                        $info['deletedHashLevels'] : $this->hashLevels;
                $this->deletedDir = isset( $info['deletedDir'] ) ? $info['deletedDir'] : false;
                $this->fileMode = isset( $info['fileMode'] ) ? $info['fileMode'] : 0644;
+               if ( isset( $info['thumbDir'] ) ) {
+                       $this->thumbDir =  $info['thumbDir'];
+               } else {
+                       $this->thumbDir = "{$this->directory}/thumb";
+               }
+               if ( isset( $info['thumbUrl'] ) ) {
+                       $this->thumbUrl = $info['thumbUrl'];
+               } else {
+                       $this->thumbUrl = "{$this->url}/thumb";
+               }
        }
 
        /**
@@ -58,6 +68,8 @@ class FSRepo extends FileRepo {
                                return "{$this->directory}/temp";
                        case 'deleted':
                                return $this->deletedDir;
+                       case 'thumb':
+                               return $this->thumbDir;
                        default:
                                return false;
                }
@@ -74,6 +86,8 @@ class FSRepo extends FileRepo {
                                return "{$this->url}/temp";
                        case 'deleted':
                                return false; // no public URL
+                       case 'thumb':
+                               return $this->thumbUrl;
                        default:
                                return false;
                }
index 594aae2..c790b3b 100644 (file)
@@ -746,15 +746,6 @@ abstract class File {
                return $path;
        }
 
-       /** Get relative path for a thumbnail file */
-       function getThumbRel( $suffix = false ) {
-               $path = 'thumb/' . $this->getRel();
-               if ( $suffix !== false ) {
-                       $path .= '/' . $suffix;
-               }
-               return $path;
-       }
-
        /** Get the path of the archive directory, or a particular file if $suffix is specified */
        function getArchivePath( $suffix = false ) {
                return $this->repo->getZonePath('public') . '/' . $this->getArchiveRel( $suffix );
@@ -762,7 +753,11 @@ abstract class File {
 
        /** Get the path of the thumbnail directory, or a particular file if $suffix is specified */
        function getThumbPath( $suffix = false ) {
-               return $this->repo->getZonePath('public') . '/' . $this->getThumbRel( $suffix );
+               $path = $this->repo->getZonePath('thumb') . '/' . $this->getRel();
+               if ( $suffix !== false ) {
+                       $path .= '/' . $suffix;
+               }
+               return $path;
        }
 
        /** Get the URL of the archive directory, or a particular file if $suffix is specified */
@@ -778,7 +773,7 @@ abstract class File {
 
        /** Get the URL of the thumbnail directory, or a particular file if $suffix is specified */
        function getThumbUrl( $suffix = false ) {
-               $path = $this->repo->getZoneUrl('public') . '/thumb/' . $this->getUrlRel();
+               $path = $this->repo->getZoneUrl('thumb') . '/' . $this->getUrlRel();
                if ( $suffix !== false ) {
                        $path .= '/' . rawurlencode( $suffix );
                }
@@ -798,7 +793,7 @@ abstract class File {
 
        /** Get the virtual URL for a thumbnail file or directory */
        function getThumbVirtualUrl( $suffix = false ) {
-               $path = $this->repo->getVirtualUrl() . '/public/thumb/' . $this->getUrlRel();
+               $path = $this->repo->getVirtualUrl() . '/thumb/' . $this->getUrlRel();
                if ( $suffix !== false ) {
                        $path .= '/' . rawurlencode( $suffix );
                }