wiki.techinc.nl/docs/LinkCache.md
leo60228 ea09f8469e docs: Convert logger.txt and linkcache.txt to Markdown
Indexing on doc.wikimedia.org doesn't work for .txt files.
This was done for Google Code-In 2019.

Bug: T233244
Change-Id: I4c441f92b89c1ab1053c5f16a6e7100f2e5e9492
2019-12-04 00:56:26 +00:00

962 B

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 );
}

$batch = new LinkBatch( $titles );
$batch->execute();