|
@@ 117-126 (lines=10) @@
|
| 114 |
|
|
| 115 |
|
# @todo FIXME: Access the api in a saner way and performing just one query |
| 116 |
|
# (preferably batching files too). |
| 117 |
|
function getFileCommentFromSourceWiki( $wiki_host, $file ) { |
| 118 |
|
$url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' |
| 119 |
|
. rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment'; |
| 120 |
|
$body = Http::get( $url, [], __METHOD__ ); |
| 121 |
|
if ( preg_match( '#<ii comment="([^"]*)" />#', $body, $matches ) == 0 ) { |
| 122 |
|
return false; |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
return html_entity_decode( $matches[1] ); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
function getFileUserFromSourceWiki( $wiki_host, $file ) { |
| 129 |
|
$url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' |
|
@@ 128-137 (lines=10) @@
|
| 125 |
|
return html_entity_decode( $matches[1] ); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
function getFileUserFromSourceWiki( $wiki_host, $file ) { |
| 129 |
|
$url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' |
| 130 |
|
. rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user'; |
| 131 |
|
$body = Http::get( $url, [], __METHOD__ ); |
| 132 |
|
if ( preg_match( '#<ii user="([^"]*)" />#', $body, $matches ) == 0 ) { |
| 133 |
|
return false; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
return html_entity_decode( $matches[1] ); |
| 137 |
|
} |
| 138 |
|
|