Page MenuHomePhabricator

page-links-change stream doesn't capture links on page deletion
Closed, ResolvedPublic

Description

As reported by @Samwalton9 at T115119#4957283:

This is now live at https://stream.wikimedia.org/v2/stream/page-links-change

From some initial testing it looks to be working well for links added & removed, including page creations. However, it doesn't catch links removed by being on a page that gets deleted. Undeleting the page counts as a page creation and tracks the link addition(s).

Event Timeline

bmansurov created this task.
bmansurov renamed this task from page-links-stream doesn't caputre links on page deletion to page-links-change stream doesn't caputre links on page deletion.Feb 15 2019, 3:17 PM
Samwalton9-WMF renamed this task from page-links-change stream doesn't caputre links on page deletion to page-links-change stream doesn't capture links on page deletion.Feb 15 2019, 3:18 PM
Pchelolo subscribed.

Indeed, haven't thought about that. On page deletion no LinksUpdate is scheduled, LinksDeletionUpdate is used instead which doesn't call a hook we use to construct the event.

Also, the hook we use for page deletion, ArticleDeleteComplete is run after the links are already deleted from the links tables. I guess we could listen to ArticleDelete hook, and grab the existing links with $wikiPage->getTitle()->getLinksFrom() for local links and either create a convenience method in the Title for external links or supply additional parameters to grab them.

@Samwalton9

Undeleting the page counts as a page creation and tracks the link addition(s).

I cannot reproduce this part. Undeleting the page doesn't result in link additions for me. Can you please double check if that's still true?

@Pchelolo thanks for looking into this. I want to see if I can share and reuse what we have already.

@Samwalton9 thanks for confirming. Now I know that something is wrong with my setup.

Change 491532 had a related patch set uploaded (by Bmansurov; owner: Bmansurov):
[mediawiki/core@master] WIP: ArticleDeleteComplete: pass along links

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

Change 491856 had a related patch set uploaded (by Bmansurov; owner: Bmansurov):
[mediawiki/extensions/EventBus@master] page-links-change: emit link deletions on page delete

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

Change 494557 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Derive LinksDeletionUpdate from LinksUpdate

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

I'm assigning the task to you, Daniel, since you worked on it. Thanks for your help.

Change 494557 had a related patch set uploaded (by Mobrovac; owner: Daniel Kinzler):
[mediawiki/core@master] Make LinksDeletionUpdate a subclass of LinksUpdate

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

Change 494557 merged by jenkins-bot:
[mediawiki/core@master] Make LinksDeletionUpdate a subclass of LinksUpdate

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

mobrovac subscribed.

With Gerrit 494557 landing in master (ETA for production: 2019-04-04), we should be done here. If there are any issues, please reopen the task.

Change 491532 abandoned by Bmansurov:
ArticleDeleteComplete: pass along links

Reason:
Not needed. See I665320e27da8edc2867b47d181cc0f324e75d102

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

Change 491856 abandoned by Bmansurov:
page-links-change: emit link deletions on page delete

Reason:
Not needed as I665320e27da8edc2867b47d181cc0f324e75d102 fires the hook we're listening to.

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