BitmapHandler::logErrorForExternalProcess is a wrapper around
wfDebugLog( 'thumbnail' ). It got copy pasted from some other class at
one point.
This patch move the method up to general class MediaHandler and makes
other child class uses it. The method will thus be available to
extensions such as TimedMediaHandler.
The reason I am doing that is that trim($err) generates a copy of $err
which causes a memory allocation fatal error whenever $err is larger
than the remaining memory allocatable. The patch will let us fix the
bug by only altering one part of the code.
bug: 57985
Change-Id: I5657f07d6e2cca05d53f2a5c30ec23622c171343
return false; # No error
}
return false; # No error
}
- /**
- * Log an error that occurred in an external process
- *
- * @param $retval int
- * @param $err int
- * @param $cmd string
- */
- protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
- wfDebugLog( 'thumbnail',
- sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
- wfHostname(), $retval, trim( $err ), $cmd ) );
- }
-
/**
* Get a MediaTransformError with error 'thumbnail_error'
*
/**
* Get a MediaTransformError with error 'thumbnail_error'
*
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
- wfDebugLog( 'thumbnail',
- sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
- wfHostname(), $retval, trim( $err ), $cmd ) );
-
+ $this->logErrorForExternalProcess( $retval, $err, $cmd );
return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
} else {
$params = array(
return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
} else {
$params = array(
public function getRotation( $file ) {
return 0;
}
public function getRotation( $file ) {
return 0;
}
+
+ /**
+ * Log an error that occurred in an external process
+ *
+ * Moved from BitmapHandler to MediaHandler with MediaWiki 1.23
+ *
+ * @since 1.23
+ * @param $retval int
+ * @param $err int
+ * @param $cmd string
+ */
+ protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
+ wfDebugLog( 'thumbnail',
+ sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
+ wfHostname(), $retval, trim( $err ), $cmd ) );
+ }
+
}
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
}
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
- wfDebugLog( 'thumbnail', sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
- wfHostname(), $retval, trim( $err ), $cmd ) );
-
+ $this->logErrorForExternalProcess( $retval, $err, $cmd );
return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
}
return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
}