Added a separate error message for mkdir failures
[lhc/web/wiklou.git] / includes / media / XMP.php
index 64a7e8a..6d19700 100644 (file)
@@ -329,7 +329,7 @@ class XMPReader implements LoggerAwareInterface {
                                                        $this->charset = 'UTF-8';
                                                        break;
                                                default:
-                                                       //this should be impossible to get to
+                                                       // this should be impossible to get to
                                                        throw new RuntimeException( "Invalid BOM" );
                                        }
                                } else {
@@ -338,7 +338,7 @@ class XMPReader implements LoggerAwareInterface {
                                }
                        }
                        if ( $this->charset !== 'UTF-8' ) {
-                               //don't convert if already utf-8
+                               // don't convert if already utf-8
                                MediaWiki\suppressWarnings();
                                $content = iconv( $this->charset, 'UTF-8//IGNORE', $content );
                                MediaWiki\restoreWarnings();
@@ -429,8 +429,14 @@ class XMPReader implements LoggerAwareInterface {
                }
                $len = unpack( 'Nlength/Noffset', substr( $content, 32, 8 ) );
 
-               if ( !$len || $len['length'] < 4 || $len['offset'] < 0 || $len['offset'] > $len['length'] ) {
-                       $this->logger->info( __METHOD__ . 'Error reading extended XMP block, invalid length or offset.' );
+               if ( !$len ||
+                       $len['length'] < 4 ||
+                       $len['offset'] < 0 ||
+                       $len['offset'] > $len['length']
+               ) {
+                       $this->logger->info(
+                               __METHOD__ . 'Error reading extended XMP block, invalid length or offset.'
+                       );
 
                        return false;
                }
@@ -441,9 +447,8 @@ class XMPReader implements LoggerAwareInterface {
                // immediately following the StandardXMP. However, the JPEG standard
                // does not require preservation of marker segment order. A robust JPEG
                // reader should tolerate the marker segments in any order."
-               //
-               // otoh the probability that an image will have more than 128k of
-               // metadata is rather low... so the probability that it will have
+               // On the other hand, the probability that an image will have more than
+               // 128k of metadata is rather low... so the probability that it will have
                // > 128k, and be in the wrong order is very low...
 
                if ( $len['offset'] !== $this->extendedXMPOffset ) {
@@ -710,7 +715,6 @@ class XMPReader implements LoggerAwareInterface {
         * @throws RuntimeException
         */
        private function endElementModeLi( $elm ) {
-
                list( $ns, $tag ) = explode( ' ', $this->curItem[0], 2 );
                $info = $this->items[$ns][$tag];
                $finalName = isset( $info['map_name'] )
@@ -734,7 +738,9 @@ class XMPReader implements LoggerAwareInterface {
                                $this->results['xmp-' . $info['map_group']][$finalName]['_type'] = 'lang';
                        }
                } else {
-                       throw new RuntimeException( __METHOD__ . " expected </rdf:seq> or </rdf:bag> but instead got $elm." );
+                       throw new RuntimeException(
+                               __METHOD__ . " expected </rdf:seq> or </rdf:bag> but instead got $elm."
+                       );
                }
        }
 
@@ -1206,8 +1212,7 @@ class XMPReader implements LoggerAwareInterface {
                        // In practise I have yet to see a file that
                        // uses this element, however it is mentioned
                        // on page 25 of part 1 of the xmp standard.
-                       //
-                       // also it seems as if exiv2 and exiftool do not support
+                       // Also it seems as if exiv2 and exiftool do not support
                        // this either (That or I misunderstand the standard)
                        $this->logger->info( __METHOD__ . ' Encountered <rdf:type> which isn\'t currently supported' );
                }
@@ -1264,6 +1269,7 @@ class XMPReader implements LoggerAwareInterface {
                }
        }
 
+       // @codingStandardsIgnoreStart Generic.Files.LineLength
        /**
         * Process attributes.
         * Simple values can be stored as either a tag or attribute
@@ -1271,16 +1277,15 @@ class XMPReader implements LoggerAwareInterface {
         * Often the initial "<rdf:Description>" tag just has all the simple
         * properties as attributes.
         *
-        * @codingStandardsIgnoreStart Long line that cannot be broken
         * @par Example:
         * @code
         * <rdf:Description rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/" exif:DigitalZoomRatio="0/10">
         * @endcode
-        * @codingStandardsIgnoreEnd
         *
         * @param array $attribs Array attribute=>value
         * @throws RuntimeException
         */
+       // @codingStandardsIgnoreEnd
        private function doAttribs( $attribs ) {
                // first check for rdf:parseType attribute, as that can change
                // how the attributes are interperted.