r62088 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62087‎ | r62088 | r62089 >
Date:16:26, 7 February 2010
Author:platonides
Status:deferred
Tags:
Comment:
Fix at least the url and entities.
Modified paths:
  • /trunk/phase3/maintenance/importImages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/importImages.inc
@@ -91,22 +91,22 @@
9292
9393 # FIXME: Access the api in a saner way and performing just one query (preferably batching files too).
9494 function getFileCommentFromSourceWiki($wiki_host, $file) {
95 - $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' . $file . '&prop=imageinfo&&iiprop=comment';
 95+ $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
9696 $body = file_get_contents($url);
9797 if (preg_match('#<ii comment="([^"]*)" />#', $body, $matches) == 0) {
9898 return false;
9999 }
100100
101 - return $matches[1];
 101+ return html_entity_decode( $matches[1] );
102102 }
103103
104104 function getFileUserFromSourceWiki($wiki_host, $file) {
105 - $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' . $file . '&prop=imageinfo&&iiprop=user';
 105+ $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:' . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
106106 $body = file_get_contents($url);
107107 if (preg_match('#<ii user="([^"]*)" />#', $body, $matches) == 0) {
108108 return false;
109109 }
110110
111 - return $matches[1];
 111+ return html_entity_decode( $matches[1] );
112112 }
113113

Status & tagging log