Index: trunk/phase3/includes/filerepo/file/File.php |
— | — | @@ -760,16 +760,27 @@ |
761 | 761 | * @param $thumbUrl string Thumbnail URL |
762 | 762 | * @param $params Array |
763 | 763 | * @param $flags integer |
| 764 | + * @param $status Status Optional status object to use for errors |
764 | 765 | * @return MediaTransformOutput |
765 | 766 | */ |
766 | | - protected function transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ) { |
| 767 | + protected function transformErrorOutput( |
| 768 | + $thumbPath, $thumbUrl, $params, $flags, Status $status = null |
| 769 | + ) { |
767 | 770 | global $wgIgnoreImageErrors; |
768 | 771 | |
769 | 772 | if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) { |
770 | 773 | return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); |
771 | 774 | } else { |
| 775 | + $badStatus = Status::newFatal( 'thumbnail-dest-create' ); |
| 776 | + if ( $status ) { // additional, more detailed errors |
| 777 | + $badStatus->merge( $status ); |
| 778 | + } |
| 779 | + $err = array(); |
| 780 | + foreach ( $badStatus->getErrorsArray() as $item ) { |
| 781 | + $err[] = wfMsg( $item[0], array_slice( $item, 1 ) ); |
| 782 | + } |
772 | 783 | return new MediaTransformError( 'thumbnail_error', |
773 | | - $params['width'], 0, wfMsg( 'thumbnail-dest-create' ) ); |
| 784 | + $params['width'], 0, implode( "\n", $err ) ); // MTO does "\n" => "<br/>" |
774 | 785 | } |
775 | 786 | } |
776 | 787 | |
— | — | @@ -875,7 +886,8 @@ |
876 | 887 | if ( $status->isOK() ) { |
877 | 888 | $thumb->setStoragePath( $thumbPath ); |
878 | 889 | } else { |
879 | | - $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ); |
| 890 | + $thumb = $this->transformErrorOutput( |
| 891 | + $thumbPath, $thumbUrl, $params, $flags, $status ); |
880 | 892 | } |
881 | 893 | } |
882 | 894 | |