Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / maintenance / importImages.php
index eb13dd1..1728695 100644 (file)
@@ -305,7 +305,7 @@ class ImportImages extends Maintenance {
                                        $publishOptions = [];
                                        $handler = MediaHandler::getHandler( $props['mime'] );
                                        if ( $handler ) {
-                                               $metadata = MediaWiki\quietCall( 'unserialize', $props['metadata'] );
+                                               $metadata = Wikimedia\quietCall( 'unserialize', $props['metadata'] );
 
                                                $publishOptions['headers'] = $handler->getContentHeaders( $metadata );
                                        } else {
@@ -335,7 +335,6 @@ class ImportImages extends Maintenance {
                                        $props,
                                        $timestamp
                                )->isOK() ) {
-                                       # We're done!
                                        $this->output( "done.\n" );
 
                                        $doProtect = false;
@@ -419,7 +418,7 @@ class ImportImages extends Maintenance {
                                $files = [];
                                while ( ( $file = readdir( $dhl ) ) !== false ) {
                                        if ( is_file( $dir . '/' . $file ) ) {
-                                               list( /* $name */, $ext ) = $this->splitFilename( $dir . '/' . $file );
+                                               $ext = pathinfo( $file, PATHINFO_EXTENSION );
                                                if ( array_search( strtolower( $ext ), $exts ) !== false ) {
                                                        $files[] = $dir . '/' . $file;
                                                }
@@ -437,21 +436,6 @@ class ImportImages extends Maintenance {
                }
        }
 
-       /**
-        * Split a filename into filename and extension
-        *
-        * @param string $filename
-        * @return array
-        */
-       private function splitFilename( $filename ) {
-               $parts = explode( '.', $filename );
-               $ext = $parts[count( $parts ) - 1];
-               unset( $parts[count( $parts ) - 1] );
-               $fname = implode( '.', $parts );
-
-               return [ $fname, $ext ];
-       }
-
        /**
         * Find an auxilliary file with the given extension, matching
         * the give base file path. $maxStrip determines how many extensions