From 5fbef994cf70728f8d29d02cb260d3e329abb483 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 6 Sep 2012 17:52:33 +0000 Subject: [PATCH] Revert "thumb.php now handles short and long thumbnail name formats when possible." Doesn't quite work, since $img->transform() still saved the thumb under the normal name. This reverts commit 5b33e66b749b525f745dc3c0e814f072fd136479 --- includes/filerepo/file/File.php | 18 ++++++------------ thumb.php | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 557609d4b0..3b0ea1479d 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -68,9 +68,6 @@ abstract class File { const FOR_THIS_USER = 2; const RAW = 3; - // Options for File::thumbName() - const THUMB_FULL_NAME = 1; - /** * Some member variables can be lazy-initialised using __get(). The * initialisation function for these variables is always a function named @@ -762,18 +759,15 @@ abstract class File { } /** - * Return the file name of a thumbnail with the specified parameters. - * Use File::THUMB_FULL_NAME to always get a name like "-". - * Otherwise, the format may be "-" or "-thumbnail.". + * Return the file name of a thumbnail with the specified parameters * * @param $params Array: handler-specific parameters - * @param $flags integer Bitfield that supports THUMB_* constants + * @private -ish + * * @return string */ - public function thumbName( $params, $flags = 0 ) { - $name = ( $this->repo && !( $flags & self::THUMB_FULL_NAME ) ) - ? $this->repo->nameForThumb( $this->getName() ) - : $this->getName(); + function thumbName( $params ) { + $name = $this->repo ? $this->repo->nameForThumb( $this->getName() ) : $this->getName(); return $this->generateThumbName( $name, $params ); } @@ -785,7 +779,7 @@ abstract class File { * * @return string */ - public function generateThumbName( $name, $params ) { + function generateThumbName( $name, $params ) { if ( !$this->getHandler() ) { return null; } diff --git a/thumb.php b/thumb.php index 570faa4f7a..8fc868d415 100644 --- a/thumb.php +++ b/thumb.php @@ -217,22 +217,16 @@ function wfStreamThumb( array $params ) { // Stream the file if it exists already... try { - $thumbName2 = $img->thumbName( $params, File::THUMB_FULL_NAME ); // b/c; "long" style // For 404 handled thumbnails, we only use the the base name of the URI // for the thumb params and the parent directory for the source file name. // Check that the zone relative path matches up so squid caches won't pick // up thumbs that would not be purged on source file deletion (bug 34231). - if ( isset( $params['rel404'] ) ) { // thumbnail was handled via 404 - if ( urldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName ) ) { - // Normal request for the canonical thumbnail name - } elseif ( urldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName2 ) ) { - // Generate the thumb under the "long" name (so it can be purged) - $thumbName = $thumbName2; // b/c - } else { - wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' ); - wfProfileOut( __METHOD__ ); - return; - } + if ( isset( $params['rel404'] ) // thumbnail was handled via 404 + && urldecode( $params['rel404'] ) !== $img->getThumbRel( $thumbName ) ) + { + wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' ); + wfProfileOut( __METHOD__ ); + return; } $thumbPath = $img->getThumbPath( $thumbName ); if ( $img->getRepo()->fileExists( $thumbPath ) ) { -- 2.20.1