Add uploadFromUrl and restructure other upload methods (fixes #70)#71
Add uploadFromUrl and restructure other upload methods (fixes #70)#71Xymph merged 4 commits intohamstar:masterfrom
Conversation
18194b3 to
e3cea2b
Compare
|
Minor code change in addition to the restructuring of 4899d33: Also note that upload from URL goes through the same multipart POST in Wikimate, even though this isn't needed when the request contains no binary data -- but it doesn't hurt to do it that way either. |
|
@waldyrious, would you be able to squeeze in a review one of these days? 😉 |
| { | ||
| if ($refresh) { // We want to query the API | ||
|
|
||
| // Specify all image properties to retrieve |
There was a problem hiding this comment.
Shouldn't either this line use "relevant ... properties", or line 529 use "all ... properties"? For consistency.
There was a problem hiding this comment.
Well, it gets far more properties than for a page, and I meant it more in the sense of "list all those that are to be retrieved, and don't list those that won't be retrieved". :) But 'relevant' is fine too.
Either way, 'image' should be 'file', so thanks for highlighting this anyway.
|
Apart from the minor comments I've left inline, this LGTM :) |
Oh, crap, you were faster :P I had this page open for the last few days and didn't refresh it before starting the review, so I hadn't seen this comment when I started. I'm saying this just to reassure you that I didn't review the PR now following your prompt, but indeed hadn't forgotten :) |
|
Sorry. 😉 I guess all the quick review turnarounds in the past spoiled me a bit, but I thought I'd poll you after 5 days. |
See #70. Previously,
upload()took $data anduploadFile()invokedupload(). However,uploadFromUrl()takes $url and otherwise needs exactly the same code asupload(). To allow sharing this common code, I had to restructureupload()a bit into a private method,uploadCommon()(maybe there's a better name for that?), and then its public use is made clearer by a new name,uploadData().The previous merge is just a few days old (so hasn't spread far yet) and still falls under "current development", so this API change seems acceptable to me, as it leads to consistent naming of the three public upload methods. For further consistency, I renamed
download()todownloadData()as well.