Index: trunk/phase3/maintenance/importImages.inc |
— | — | @@ -91,22 +91,22 @@ |
92 | 92 | |
93 | 93 | # FIXME: Access the api in a saner way and performing just one query (preferably batching files too). |
94 | 94 | 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'; |
96 | 96 | $body = file_get_contents($url); |
97 | 97 | if (preg_match('#<ii comment="([^"]*)" />#', $body, $matches) == 0) { |
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
101 | | - return $matches[1]; |
| 101 | + return html_entity_decode( $matches[1] ); |
102 | 102 | } |
103 | 103 | |
104 | 104 | 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'; |
106 | 106 | $body = file_get_contents($url); |
107 | 107 | if (preg_match('#<ii user="([^"]*)" />#', $body, $matches) == 0) { |
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
111 | | - return $matches[1]; |
| 111 | + return html_entity_decode( $matches[1] ); |
112 | 112 | } |
113 | 113 | |