Page MenuHomePhabricator

Update MediaWiki hooks to generate data for new event-bus schemas
Closed, ResolvedPublic21 Estimated Story Points

Description

There is agreement around proposal T134502 for eventbus schema evolution.
This task is about updating mediwiki to fill-in missing information in the updated schemas.

Event Timeline

Ottomata triaged this task as Medium priority.

Change 293293 had a related patch set uploaded (by Ottomata):
Easy updates for EventBus hooks. More difficult ones to follow.

https://gerrit.wikimedia.org/r/293293

Ottomata set the point value for this task to 21.

In T134502#2326641 I wrote about how to implement user_blocks_change event:

The hook we would be able to use now to get this info is > BlockIpComplete. As is, this hook does not provide us with the previous state. We'd have to make modifications to SpecialBlock.php to get this. The code in maybeAlterFormDefaults() does look up previously saved block info from the db before submitting the form. We could save the $block object returned by Block::newFromTarget( $this->target ); on the SpecialBlock object, and then pass it to the BlockIpComplete hook later.

But doh, this won't work! The BlockIpComplete hook is run from [[ https://github.com/wikimedia/mediawiki/blob/master/includes/specials/SpecialBlock.php#L789 | processForm() ]], which is static, I guess called by some other place deep in Mediawiki. Plus maybeAlterFormDefaults is for presenting the form to the user, not intaking it, so it would be premature there anyway.

So, now I'm not sure how to do this without an extra db lookup during form submission. @aaron, thoughts?

Change 293628 had a related patch set uploaded (by Aaron Schulz):
Add any prior block to BlockIpComplete hook

https://gerrit.wikimedia.org/r/293628

Ok, it looks like processForm() does actually look up the previous block before submitting, if an initial insert fails.

The $currentBlock is altered and then $currentBlock-update() is called. I think I'll need to implement Block::clone in order to do $previousBlock = clone $currentBlock so that I have an untouched object I can work with once I get to emitting BlockIpComplete. TODO!

Change 293756 had a related patch set uploaded (by Ottomata):
Pass previous IP/User block state to BlockIPComplete hook as $previousBlock

https://gerrit.wikimedia.org/r/293756

Hokay! Implementing __clone was not necessary, PHP does the right thing. This works!

Change 293805 had a related patch set uploaded (by Ottomata):
Add $visibilityChangeMap parameter to RevDelList doPostCommitUpdates

https://gerrit.wikimedia.org/r/293805

Change 293756 abandoned by Ottomata:
Pass previous IP/User block state to BlockIPComplete hook as $previousBlock

Reason:
Done by Aaron in https://gerrit.wikimedia.org/r/#/c/293628

https://gerrit.wikimedia.org/r/293756

Change 293805 merged by jenkins-bot:
Add $visibilityChangeMap parameter to RevDelList doPostCommitUpdates

https://gerrit.wikimedia.org/r/293805

Change 297630 had a related patch set uploaded (by Ottomata):
Updates for page_move, revision_visibility_change and user_blocks_change

https://gerrit.wikimedia.org/r/297630

Change 293628 merged by jenkins-bot:
Add any prior block to BlockIpComplete hook

https://gerrit.wikimedia.org/r/293628

Change 298567 had a related patch set uploaded (by Ottomata):
More changes for updates to schemas in https://gerrit.wikimedia.org/r/#/c/288210

https://gerrit.wikimedia.org/r/298567

Change 302605 had a related patch set uploaded (by Ottomata):
[WIP] Create new events matching new schemas in https://gerrit.wikimedia.org/r/#/c/301284/

https://gerrit.wikimedia.org/r/302605

Change 293293 abandoned by Ottomata:
Easy updates for EventBus hooks. More difficult ones to follow.

Reason:
Abandoning in favor of https://gerrit.wikimedia.org/r/#/c/302605/

https://gerrit.wikimedia.org/r/293293

Change 297630 abandoned by Ottomata:
Updates for page_move, revision_visibility_change and user_blocks_change

Reason:
Abandoning in favor of https://gerrit.wikimedia.org/r/#/c/302605/

https://gerrit.wikimedia.org/r/297630

Change 298567 abandoned by Ottomata:
[WIP] More changes for updates to schemas in https://gerrit.wikimedia.org/r/#/c/288210

Reason:
Abandoning in favor of https://gerrit.wikimedia.org/r/#/c/302605/

https://gerrit.wikimedia.org/r/298567

We are ready to go! I want to wait until next week's deployment train, so I can make sure I'm more present to babysit it.

Nemo_bis renamed this task from Update mediwiki hooks to generate data for new event-bus schemas to Update MediaWiki hooks to generate data for new event-bus schemas.Aug 25 2016, 5:20 PM
Nemo_bis added a project: Event-Platform.