X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FimportImages.inc;h=fc9428d7aa0568e4fdb2a3b657c702a807f7b411;hb=e758226c91935a1df2b6fd3ed1f18922d8bfb45b;hp=b803e3dae47fd649640352223e9df7c482007359;hpb=f0edb3e368a5fc69218d20f76f1538b68f37db42;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importImages.inc b/maintenance/importImages.inc index b803e3dae4..fc9428d7aa 100644 --- a/maintenance/importImages.inc +++ b/maintenance/importImages.inc @@ -35,7 +35,7 @@ function findFiles( $dir, $exts, $recurse = false ) { if ( is_dir( $dir ) ) { $dhl = opendir( $dir ); if ( $dhl ) { - $files = array(); + $files = []; while ( ( $file = readdir( $dhl ) ) !== false ) { if ( is_file( $dir . '/' . $file ) ) { list( /* $name */, $ext ) = splitFilename( $dir . '/' . $file ); @@ -49,10 +49,10 @@ function findFiles( $dir, $exts, $recurse = false ) { return $files; } else { - return array(); + return []; } } else { - return array(); + return []; } } @@ -68,7 +68,7 @@ function splitFilename( $filename ) { unset( $parts[count( $parts ) - 1] ); $fname = implode( '.', $parts ); - return array( $fname, $ext ); + return [ $fname, $ext ]; } /** @@ -117,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, [], __METHOD__ ); if ( preg_match( '##', $body, $matches ) == 0 ) { return false; } @@ -128,11 +128,10 @@ 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, [], __METHOD__ ); if ( preg_match( '##', $body, $matches ) == 0 ) { return false; } return html_entity_decode( $matches[1] ); } -