Fixes for e288e4036
authorPlatonides <platonides@gmail.com>
Fri, 8 Mar 2013 12:07:32 +0000 (13:07 +0100)
committerPlatonides <platonides@gmail.com>
Fri, 8 Mar 2013 20:57:23 +0000 (21:57 +0100)
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

includes/api/ApiImageRotate.php
includes/media/Bitmap.php
includes/media/ExifBitmap.php
includes/media/Jpeg.php

index 3815d41..80a8078 100644 (file)
@@ -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;
        }
index 0ad862d..c31c46b 100644 (file)
@@ -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;
index 1a761f3..1671ab2 100644 (file)
@@ -190,7 +190,7 @@ class ExifBitmapHandler extends BitmapHandler {
                }
 
                $data = $file->getMetadata();
-               return self::getRotationForExif( $data );
+               return $this->getRotationForExif( $data );
        }
 
        /**
index cd6f18c..355cab3 100644 (file)
@@ -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 );
                }
        }