https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113952

Revision: 113952
Author:   aaron
Date:     2012-03-15 20:37:58 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
[FileRepo] Tweaked transformErrorOutput() to allow more useful error output 
(like backend errors) for problems moving thumbnails into storage.

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/file/File.php

Modified: trunk/phase3/includes/filerepo/file/File.php
===================================================================
--- trunk/phase3/includes/filerepo/file/File.php        2012-03-15 20:37:33 UTC 
(rev 113951)
+++ trunk/phase3/includes/filerepo/file/File.php        2012-03-15 20:37:58 UTC 
(rev 113952)
@@ -760,16 +760,27 @@
         * @param $thumbUrl string Thumbnail URL
         * @param $params Array
         * @param $flags integer
+        * @param $status Status Optional status object to use for errors
         * @return MediaTransformOutput
         */
-       protected function transformErrorOutput( $thumbPath, $thumbUrl, 
$params, $flags ) {
+       protected function transformErrorOutput(
+               $thumbPath, $thumbUrl, $params, $flags, Status $status = null
+       ) {
                global $wgIgnoreImageErrors;
 
                if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
                        return $this->handler->getTransform( $this, $thumbPath, 
$thumbUrl, $params );
                } else {
+                       $badStatus = Status::newFatal( 'thumbnail-dest-create' 
);
+                       if ( $status ) { // additional, more detailed errors
+                               $badStatus->merge( $status );
+                       }
+                       $err = array();
+                       foreach ( $badStatus->getErrorsArray() as $item ) {
+                               $err[] = wfMsg( $item[0], array_slice( $item, 1 
) );
+                       }
                        return new MediaTransformError( 'thumbnail_error',
-                               $params['width'], 0, wfMsg( 
'thumbnail-dest-create' ) );
+                               $params['width'], 0, implode( "\n", $err ) ); 
// MTO does "\n" => "<br/>"
                }
        }
 
@@ -875,7 +886,8 @@
                                if ( $status->isOK() ) {
                                        $thumb->setStoragePath( $thumbPath );
                                } else {
-                                       $thumb = $this->transformErrorOutput( 
$thumbPath, $thumbUrl, $params, $flags );
+                                       $thumb = $this->transformErrorOutput(
+                                               $thumbPath, $thumbUrl, $params, 
$flags, $status );
                                }
                        }
 


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to