T105242: U is for urlencode
[lhc/web/wiklou.git] / maintenance / importImages.inc
index 7caedea..4b839a0 100644 (file)
@@ -46,6 +46,7 @@ function findFiles( $dir, $exts, $recurse = false ) {
                                        $files = array_merge( $files, findFiles( $dir . '/' . $file, $exts, true ) );
                                }
                        }
+
                        return $files;
                } else {
                        return array();
@@ -63,9 +64,10 @@ function findFiles( $dir, $exts, $recurse = false ) {
  */
 function splitFilename( $filename ) {
        $parts = explode( '.', $filename );
-       $ext = $parts[ count( $parts ) - 1 ];
-       unset( $parts[ count( $parts ) - 1 ] );
+       $ext = $parts[count( $parts ) - 1];
+       unset( $parts[count( $parts ) - 1] );
        $fname = implode( '.', $parts );
+
        return array( $fname, $ext );
 }
 
@@ -115,7 +117,7 @@ function findAuxFile( $file, $auxExtension, $maxStrip = 1 ) {
 function getFileCommentFromSourceWiki( $wiki_host, $file ) {
        $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
                . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
-       $body = Http::get( $url );
+       $body = Http::get( $url, array(), __METHOD__ );
        if ( preg_match( '#<ii comment="([^"]*)" />#', $body, $matches ) == 0 ) {
                return false;
        }
@@ -126,7 +128,7 @@ function getFileCommentFromSourceWiki( $wiki_host, $file ) {
 function getFileUserFromSourceWiki( $wiki_host, $file ) {
        $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
                . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
-       $body = Http::get( $url );
+       $body = Http::get( $url, array(), __METHOD__ );
        if ( preg_match( '#<ii user="([^"]*)" />#', $body, $matches ) == 0 ) {
                return false;
        }