Merge "DefaultPreferencesFactory: Remove fallback for null PermissionManager"
[lhc/web/wiklou.git] / docs / linkcache.txt
1 linkcache.txt
2
3 The LinkCache class maintains a list of article titles and the information about
4 whether or not the article exists in the database. This is used to mark up links
5 when displaying a page. If the same link appears more than once on any page,
6 then it only has to be looked up once. In most cases, link lookups are done in
7 batches with the LinkBatch class, or the equivalent in Parser::replaceLinkHolders(),
8 so the link cache is mostly useful for short snippets of parsed text (such as
9 the site notice), and for links in the navigation areas of the skin.
10
11 The link cache was formerly used to track links used in a document for the
12 purposes of updating the link tables. This application is now deprecated.
13
14 To create a batch, you can use the following code:
15
16 $pages = [ 'Main Page', 'Project:Help', /* ... */ ];
17 $titles = [];
18
19 foreach( $pages as $page ){
20 $titles[] = Title::newFromText( $page );
21 }
22
23 $batch = new LinkBatch( $titles );
24 $batch->execute();