wiki.techinc.nl/docs/LinkCache.md
Timo Tijhof 5001f914d5 docs: Set stable permalink on markdown files
In Doxygen 1.9.7, the URL generation logic changed such that input
files in directories (i.e. /docs/Hooks.md) are published with the
slug `md_docs_2Hooks.html` instead of `md_docs_Hooks.html`.

This was done to improve an edge case where if two conflicting
files existed (e.g. docs_Foo.md and docs/Foo.md) both can now get
their own stable URL in a determimistic way (e.g. as opposed to
a-z sorting and appending _2 only if a conflict exists). But this
made other more common URLs no longer stable. Work around this by
setting an explict permalink for each markdown file.

Ref https://github.com/doxygen/doxygen/issues/10721.

Change-Id: Ifeb03602452c1148bd372555bebac9922c583ac2
2024-03-09 22:04:05 +00:00

1.1 KiB

LinkCache

The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database. This is used to mark up links when displaying a page. If the same link appears more than once on any page, then it only has to be looked up once. In most cases, link lookups are done in batches with the LinkBatch class, or the equivalent in Parser::replaceLinkHolders(), so the link cache is mostly useful for short snippets of parsed text (such as the site notice), and for links in the navigation areas of the skin.

The link cache was formerly used to track links used in a document for the purposes of updating the link tables. This application is now deprecated.

To create a batch, you can use the following code:

$pages = [ 'Main Page', 'Project:Help', /* ... */ ];
$titles = [];

foreach( $pages as $page ){
	$titles[] = Title::newFromText( $page );
}

$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
$batch = $linkBatchFactory->newLinkBatch( $titles );
$batch->execute();