Flow/Link table spec

We want to mimic MediaWiki behaviour with respect to links, templates and files.

Requirements

 * Linking to a page or URL, including an image or a template, should cause entries to appear on Special:WhatLinksHere, Special:LinkSearch, and in usage lists for files.
 * In particular, including a file needs to add to the GlobalUsage tables.
 * It may need to be eventually possible to add a Flow board to a category.
 * It is very preferable that we can figure out exactly which post includes a link/file/template.

Implementation – Special:WhatLinksHere / Special:LinkSearch

 * Add a tracking table that associates links with Flow items (topics, posts, board headers).
 * When new links/templates/files are added to an (existing or old) post/header/topic, add them to both the Flow tracking tables and the ordinary MediaWiki ones.
 * When a post/header/topic is edited, and new links/templates/files are added, remove them from the Flow tracking tables, and use those tables to determine whether or not to remove them from the standard MediaWiki tracking tables (i.e. remove them from those tables if no other references exist on the given Board.
 * Add hooks to Special:WhatLinksHere and Special:LinkSearch, and, for results from Flow, use said hooks to add a direct link to the part of the Board which includes the link/template/file.

Other matters

 * Behaviour when files and templates are changed has not yet been determined at a product level. (See "Wikitext, extensions, and templates" in Flow/FAQ)
 * Red link / Blue link behaviour works correctly out of the box, because Flow resolves these at display time.
 * At this time Flow boards cannot be added to categories. (58197)