Currently, usage tracking info is updated when a page is edited. All old usages are discarded, and the new ones placed in the database.
This does not work in a multi-lingual scenario, since when editing, we only know the usages for one language (the one being rendered immediately upon save, generally the site's nominal content language).
Note that there are three kinds of "page updates" involved (plus deletion):
- edit (ArticleEditUpdates)
- touch (LinksUpdate), also happens when templates change
- render (ParserCache), also happens when viewed with a different target language (if ParserCache is split by user language)
So address this, we should use the following hooks (events) to trigger updates to usage tracking:
- ArticleEditUpdates: add/touch usage entries from ParserOutput (initially; deprecated in favor of LinksUpdateComplete)
- ArticleEditUpdates: prune stale entries, unsubscribe unused entries (initially; deprecated in favor of LinksUpdateComplete)
- LinksUpdateComplete: add/touch usage entries from ParserOutput (should replace ArticleEditUpdates)
- LinksUpdateComplete: prune stale entries unsubscribe unused entries (should replace ArticleEditUpdates)
- ParserCacheSave: add/touch usage entries from ParserOutput (needs core patch)
- ArticleDeleteComplete: prune all entries, unsubscribe unused entries