X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FimportImages.inc;h=ae93287df1510007801a2beeed451c793a767451;hb=ca895b7072b9d98a5b3abf8f2a46474095c16210;hp=0f335ee27730cb7c83ef76c63f1f1dc054af24e1;hpb=1a579b23a22489a9a9a3943a36c410d42513d51f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importImages.inc b/maintenance/importImages.inc index 0f335ee277..ae93287df1 100644 --- a/maintenance/importImages.inc +++ b/maintenance/importImages.inc @@ -1,7 +1,21 @@ #', $body, $matches) == 0) { - return false; - } +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 ); + if ( preg_match( '##', $body, $matches ) == 0 ) { + return false; + } - return html_entity_decode( $matches[1] ); + return html_entity_decode( $matches[1] ); } -function getFileUserFromSourceWiki($wiki_host, $file) { - $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user'; - $body = file_get_contents($url); - if (preg_match('##', $body, $matches) == 0) { - return false; - } +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 ); + if ( preg_match( '##', $body, $matches ) == 0 ) { + return false; + } - return html_entity_decode( $matches[1] ); + return html_entity_decode( $matches[1] ); }