r113952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113951‎ | r113952 | r113953 >
Date:20:37, 15 March 2012
Author:aaron
Status:reverted
Tags:gerritmigration 
Comment:
[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) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/file/File.php
@@ -760,16 +760,27 @@
761761 * @param $thumbUrl string Thumbnail URL
762762 * @param $params Array
763763 * @param $flags integer
 764+ * @param $status Status Optional status object to use for errors
764765 * @return MediaTransformOutput
765766 */
766 - protected function transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ) {
 767+ protected function transformErrorOutput(
 768+ $thumbPath, $thumbUrl, $params, $flags, Status $status = null
 769+ ) {
767770 global $wgIgnoreImageErrors;
768771
769772 if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
770773 return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
771774 } 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+ }
772783 return new MediaTransformError( 'thumbnail_error',
773 - $params['width'], 0, wfMsg( 'thumbnail-dest-create' ) );
 784+ $params['width'], 0, implode( "\n", $err ) ); // MTO does "\n" => "<br/>"
774785 }
775786 }
776787
@@ -875,7 +886,8 @@
876887 if ( $status->isOK() ) {
877888 $thumb->setStoragePath( $thumbPath );
878889 } else {
879 - $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
 890+ $thumb = $this->transformErrorOutput(
 891+ $thumbPath, $thumbUrl, $params, $flags, $status );
880892 }
881893 }
882894

Follow-up revisions

RevisionCommit summaryAuthorDate
r114335Revert r107309, r113601, r113704, r113742, r113792, r113838, r113859, r113893......catrope00:16, 21 March 2012

Status & tagging log