Fixes for e288e4036
Changed static calls to instance functions. Make BitmapHandler::rotate() non-static. We don't have a Bitmap class. It should have been falling back to BitmapHandler class. (JpegHandler ← ExifBitmapHandler ← BitmapHandler) Change-Id: I17be410456b00cef2ded8d6e2282ae0de4785695
This commit is contained in:
parent
e288e4036c
commit
d1bc1b968b
4 changed files with 13 additions and 13 deletions
|
|
@ -134,7 +134,7 @@ class ApiImageRotate extends ApiBase {
|
|||
*/
|
||||
private function getPageSet() {
|
||||
if ( $this->mPageSet === null ) {
|
||||
$this->mPageSet = new ApiPageSet( $this, 0, NS_FILE);
|
||||
$this->mPageSet = new ApiPageSet( $this, 0, NS_FILE );
|
||||
}
|
||||
return $this->mPageSet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ class BitmapHandler extends ImageHandler {
|
|||
# Escape glob chars
|
||||
$path = preg_replace( '/[*?\[\]{}]/', '\\\\\0', $path );
|
||||
|
||||
return self::escapeMagickPath( $path, $scene );
|
||||
return $this->escapeMagickPath( $path, $scene );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -644,7 +644,7 @@ class BitmapHandler extends ImageHandler {
|
|||
*/
|
||||
function escapeMagickOutput( $path, $scene = false ) {
|
||||
$path = str_replace( '%', '%%', $path );
|
||||
return self::escapeMagickPath( $path, $scene );
|
||||
return $this->escapeMagickPath( $path, $scene );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -762,26 +762,26 @@ class BitmapHandler extends ImageHandler {
|
|||
* @since 1.21
|
||||
* @return bool
|
||||
*/
|
||||
public static function rotate( $file, $params ) {
|
||||
public function rotate( $file, $params ) {
|
||||
global $wgImageMagickConvertCommand;
|
||||
|
||||
$rotation = ( $params[ 'rotation' ] + self::getRotation( $file ) ) % 360;
|
||||
$rotation = ( $params[ 'rotation' ] + $this->getRotation( $file ) ) % 360;
|
||||
$scene = false;
|
||||
|
||||
$scaler = self::getScalerType( null, false );
|
||||
switch ( $scaler ) {
|
||||
case 'im':
|
||||
$cmd = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " .
|
||||
wfEscapeShellArg( self::escapeMagickInput( $params[ 'srcPath' ], $scene ) ) .
|
||||
wfEscapeShellArg( $this->escapeMagickInput( $params[ 'srcPath' ], $scene ) ) .
|
||||
" -rotate -$rotation " .
|
||||
wfEscapeShellArg( self::escapeMagickOutput( $params[ 'dstPath' ] ) ) . " 2>&1";
|
||||
wfEscapeShellArg( $this->escapeMagickOutput( $params[ 'dstPath' ] ) ) . " 2>&1";
|
||||
wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
|
||||
wfProfileIn( 'convert' );
|
||||
$retval = 0;
|
||||
$err = wfShellExec( $cmd, $retval, $env );
|
||||
wfProfileOut( 'convert' );
|
||||
if ( $retval !== 0 ) {
|
||||
self::logErrorForExternalProcess( $retval, $err, $cmd );
|
||||
$this->logErrorForExternalProcess( $retval, $err, $cmd );
|
||||
return new MediaTransformError( 'thumbnail_error', 0, 0, $err );
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class ExifBitmapHandler extends BitmapHandler {
|
|||
}
|
||||
|
||||
$data = $file->getMetadata();
|
||||
return self::getRotationForExif( $data );
|
||||
return $this->getRotationForExif( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ class JpegHandler extends ExifBitmapHandler {
|
|||
* @since 1.21
|
||||
* @return bool
|
||||
*/
|
||||
public static function rotate( $file, $params ) {
|
||||
public function rotate( $file, $params ) {
|
||||
global $wgJpegTran;
|
||||
|
||||
$rotation = ( $params[ 'rotation' ] + self::getRotation( $file ) ) % 360;
|
||||
$rotation = ( $params[ 'rotation' ] + $this->getRotation( $file ) ) % 360;
|
||||
|
||||
if( $wgJpegTran && is_file( $wgJpegTran ) ){
|
||||
$cmd = wfEscapeShellArg( $wgJpegTran ) .
|
||||
|
|
@ -82,12 +82,12 @@ class JpegHandler extends ExifBitmapHandler {
|
|||
$err = wfShellExec( $cmd, $retval, $env );
|
||||
wfProfileOut( 'jpegtran' );
|
||||
if ( $retval !== 0 ) {
|
||||
self::logErrorForExternalProcess( $retval, $err, $cmd );
|
||||
$this->logErrorForExternalProcess( $retval, $err, $cmd );
|
||||
return new MediaTransformError( 'thumbnail_error', 0, 0, $err );
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return Bitmap::rotate( $file, $params );
|
||||
return parent::rotate( $file, $params );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue