Merge "Include the backtrace in the log for job exceptions"
[lhc/web/wiklou.git] / includes / media / PNG.php
index a23821f..98f1386 100644 (file)
@@ -38,13 +38,13 @@ class PNGHandler extends BitmapHandler {
        function getMetadata( $image, $filename ) {
                try {
                        $metadata = BitmapMetadataHandler::PNG( $filename );
-               } catch( Exception $e ) {
+               } catch ( Exception $e ) {
                        // Broken file?
                        wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
                        return self::BROKEN_FILE;
                }
 
-               return serialize($metadata);
+               return serialize( $metadata );
        }
 
        /**
@@ -74,9 +74,11 @@ class PNGHandler extends BitmapHandler {
         */
        function isAnimatedImage( $image ) {
                $ser = $image->getMetadata();
-               if ($ser) {
-                       $metadata = unserialize($ser);
-                       if( $metadata['frameCount'] > 1 ) return true;
+               if ( $ser ) {
+                       $metadata = unserialize( $ser );
+                       if ( $metadata['frameCount'] > 1 ) {
+                               return true;
+                       }
                }
                return false;
        }
@@ -105,13 +107,13 @@ class PNGHandler extends BitmapHandler {
                wfRestoreWarnings();
 
                if ( !$data || !is_array( $data ) ) {
-                       wfDebug(__METHOD__ . ' invalid png metadata' );
+                       wfDebug( __METHOD__ . " invalid png metadata\n" );
                        return self::METADATA_BAD;
                }
 
                if ( !isset( $data['metadata']['_MW_PNG_VERSION'] )
                        || $data['metadata']['_MW_PNG_VERSION'] != PNGMetadataExtractor::VERSION ) {
-                       wfDebug(__METHOD__ . ' old but compatible png metadata' );
+                       wfDebug( __METHOD__ . " old but compatible png metadata\n" );
                        return self::METADATA_COMPATIBLE;
                }
                return self::METADATA_GOOD;
@@ -126,11 +128,12 @@ class PNGHandler extends BitmapHandler {
                $original = parent::getLongDesc( $image );
 
                wfSuppressWarnings();
-               $metadata = unserialize($image->getMetadata());
+               $metadata = unserialize( $image->getMetadata() );
                wfRestoreWarnings();
 
-               if( !$metadata || $metadata['frameCount'] <= 0 )
+               if ( !$metadata || $metadata['frameCount'] <= 0 ) {
                        return $original;
+               }
 
                $info = array();
                $info[] = $original;