Merge "Installer: Link 4.0 family of CC licenses"
[lhc/web/wiklou.git] / includes / media / FormatMetadata.php
index b4892c4..73eeba6 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-// @codingStandardsIgnoreFile
-// PHPCS can't handle the level of nesting in this file
 /**
  * Formatting of image metadata values into human readable form.
  *
@@ -119,9 +117,9 @@ class FormatMetadata extends ContextSource {
                                $type = 'ul'; // default unordered list.
                        }
 
-                       //This is done differently as the tag is an array.
+                       // This is done differently as the tag is an array.
                        if ( $tag == 'GPSTimeStamp' && count( $vals ) === 3 ) {
-                               //hour min sec array
+                               // hour min sec array
 
                                $h = explode( '/', $vals[0] );
                                $m = explode( '/', $vals[1] );
@@ -192,8 +190,18 @@ class FormatMetadata extends ContextSource {
 
                                        case 'PhotometricInterpretation':
                                                switch ( $val ) {
+                                                       case 0:
+                                                       case 1:
                                                        case 2:
+                                                       case 3:
+                                                       case 4:
+                                                       case 5:
                                                        case 6:
+                                                       case 8:
+                                                       case 9:
+                                                       case 10:
+                                                       case 32803:
+                                                       case 34892:
                                                                $val = $this->exifMsg( $tag, $val );
                                                                break;
                                                        default:
@@ -415,7 +423,7 @@ class FormatMetadata extends ContextSource {
                                                        'mode' => ( $val & bindec( '00011000' ) ) >> 3,
                                                        'function' => ( $val & bindec( '00100000' ) ) >> 5,
                                                        'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
-//                                             'reserved' => ($val & bindec( '10000000' )) >> 7,
+//                                             'reserved' => ($val & bindec( '10000000' )) >> 7,
                                                );
                                                $flashMsgs = array();
                                                # We do not need to handle unknown values since all are used.
@@ -599,7 +607,7 @@ class FormatMetadata extends ContextSource {
                                                }
                                                break;
 
-                                       //The GPS...Ref values are kept for compatibility, probably won't be reached.
+                                       // The GPS...Ref values are kept for compatibility, probably won't be reached.
                                        case 'GPSLatitudeRef':
                                        case 'GPSDestLatitudeRef':
                                                switch ( $val ) {
@@ -732,7 +740,7 @@ class FormatMetadata extends ContextSource {
 
                                        case 'Software':
                                                if ( is_array( $val ) ) {
-                                                       //if its a software, version array.
+                                                       // if its a software, version array.
                                                        $val = $this->msg( 'exif-software-version-value', $val[0], $val[1] )->text();
                                                } else {
                                                        $val = $this->exifMsg( $tag, '', $val );
@@ -1171,7 +1179,7 @@ class FormatMetadata extends ContextSource {
                $lowLang = strtolower( $lang );
                $langName = Language::fetchLanguageName( $lowLang );
                if ( $langName === '' ) {
-                       //try just the base language name. (aka en-US -> en ).
+                       // try just the base language name. (aka en-US -> en ).
                        list( $langPrefix ) = explode( '-', $lowLang, 2 );
                        $langName = Language::fetchLanguageName( $langPrefix );
                        if ( $langName === '' ) {
@@ -1573,7 +1581,7 @@ class FormatMetadata extends ContextSource {
         * @since 1.23
         */
        public function fetchExtendedMetadata( File $file ) {
-               global $wgMemc;
+               $cache = ObjectCache::getMainWANInstance();
 
                // If revision deleted, exit immediately
                if ( $file->isDeleted( File::DELETED_FILE ) ) {
@@ -1587,7 +1595,7 @@ class FormatMetadata extends ContextSource {
                        $file->getSha1()
                );
 
-               $cachedValue = $wgMemc->get( $cacheKey );
+               $cachedValue = $cache->get( $cacheKey );
                if (
                        $cachedValue
                        && Hooks::run( 'ValidateExtendedMetadataCache', array( $cachedValue['timestamp'], $file ) )
@@ -1607,7 +1615,7 @@ class FormatMetadata extends ContextSource {
                        // computation on a cache hit.
                        $this->sanitizeArrayForAPI( $extendedMetadata );
                        $valueToCache = array( 'data' => $extendedMetadata, 'timestamp' => wfTimestampNow() );
-                       $wgMemc->set( $cacheKey, $valueToCache, $maxCacheTime );
+                       $cache->set( $cacheKey, $valueToCache, $maxCacheTime );
                }
 
                return $extendedMetadata;