Modernize token handling (fixes #99)#100
Conversation
There was a problem hiding this comment.
Re. 5044fd7, this method, in Wikimate tradition, is kept simple and supports only the two token types needed elsewhere in the library. So no patrol, rollback, watch, etc. Nor the option to request more than one token at once ("watch|patrol"), we can cross that bridge if and when we get to it.
| $page = array_pop($r['query']['pages']); // Get the page | ||
|
|
||
| $this->starttimestamp = $page['starttimestamp']; // Update the starttimestamp | ||
| // Check for errors |
There was a problem hiding this comment.
This adds error checking to the preceding query(), analog to such invocations elsewhere.
There was a problem hiding this comment.
Any reason why this comment was not added to the code itself?
There was a problem hiding this comment.
My remark should have been a (multiline) comment for new code lines 874 through 880. All other places where query() was called were followed by the code now also in the new lines. Not sure why it was previously missing, this was old code, but I don't think it's meaningful to spend more in-code comments on it.
There was a problem hiding this comment.
Got it, thanks for the context.
|
@waldyrious As before (well, in 2016-2017 :) ) a second pair of eyes on these commits would be appreciated. |
Don't you mean "MediaWiki deployments..."? |
|
Awesome job in separating the commits! I can't review the code to any meaningful depth, since I haven't used PHP nor the MW API in quite a while. The superficial aspects (commit messages and separation, code formatting, wording in comments, etc.) all look good to me. I'd only repeat one of the comments I've left inline, regarding this PR-level comment:
Here too, wouldn't it make sense to add the comment to the code itself? It would be cumbersome for someone reading the code in the future to have to locate a pull request discussion thread to obtain context for why that method is implemented that way. |
Sorry that wasn't clear, I meant: Wikimate usage against MW deployments prior... |
Good point, how about these two sentences? Thanks for the other remarks, the feedback is welcome. If this is okay and there are no other items, then I'll commit that and wrap it up with a merge-commit (to preserve individual commit messages). |
|
Unless you are very busy, @waldyrious, perhaps you missed my follow-ups because I didn't include a ping, like now. |
|
I guess it's good enough, so wrapping up now. |
|
Hey @Xymph — I was actually out for a few days, sorry I wasn't able to respond in time. In any case, yeah, I didn't have any additional feedback and the changes you've made look good to me*, so here's my late LGTM! 😛 * I personally would have tended to include a bit more of the context you had in the PR comment ("So no patrol, rollback, watch, etc." and the example for multiple tokens, i.e. ("watch|patrol")) into the code comment, but as you say, we need to strike a balance between completeness and verbosity. |
That's my plight with GH notifications 😅 Sometimes I am able to come by just to report a quick issue or respond to a comment that requires no further action, but I always fear that other people who are waiting on me (for things that do require a more attentive look) will think I'm ignoring them. Furthermore, I do get mobile notifications when I'm mentioned, but if I do open them to respond, the thread leaves my notifications inbox. So it's not even easy to drop a quick "I'm aware of this but can't take care of it right away" message without messing with my ability to keep track of the threads I need to come back to later...
That's a good idea, yeah :) |
|
Thanks! I was coming here to ask about doing this for https://phabricator.wikimedia.org/T280806, but now there's a release... Just need to wait for the various bots to update :) |
Our pleasure. The next release will address another Phabricator ticket per issue #92 / PR #112. Btw, we're looking for additional reviewing eyes there, in case that's something you could spend a little time on (but no problem if you can't). |
|
Just need to get people to stop using versions 0.11 and 0.12 now ;) |
The action token handling is deprecated since MW v1.24. This PR restructures all three Wikimate classes to use the current meta tokens approach. That includes the login token, which was only introduced in MW v1.27. Wikimate deployments prior to that version can continue to use the v0.12.0 tag.