diff options
author | leo60228 <iakornfeld@gmail.com> | 2019-12-03 19:45:36 -0500 |
---|---|---|
committer | Leo60228 <iakornfeld@gmail.com> | 2019-12-04 00:56:26 +0000 |
commit | ea09f8469e1fcd5763f51d4b255fc10d5fa7539f (patch) | |
tree | aa78ba9107c4c74de1e9cddd1bf10cb04e32edcb /docs/LinkCache.md | |
parent | 1cedbd2c6f7b52b53404f81a30f26f6a22f6229b (diff) | |
download | mediawikicore-ea09f8469e1fcd5763f51d4b255fc10d5fa7539f.tar.gz mediawikicore-ea09f8469e1fcd5763f51d4b255fc10d5fa7539f.zip |
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
Diffstat (limited to 'docs/LinkCache.md')
-rw-r--r-- | docs/LinkCache.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/LinkCache.md b/docs/LinkCache.md new file mode 100644 index 000000000000..841354a80afb --- /dev/null +++ b/docs/LinkCache.md @@ -0,0 +1,24 @@ +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: + +~~~{.php} +$pages = [ 'Main Page', 'Project:Help', /* ... */ ]; +$titles = []; + +foreach( $pages as $page ){ + $titles[] = Title::newFromText( $page ); +} + +$batch = new LinkBatch( $titles ); +$batch->execute(); +~~~ |