MediaWiki master
ExternalLinksLookup.php
Go to the documentation of this file.
1<?php
22
24
29
39 public static function getExternalLinksForPage( int $pagId, IReadableDatabase $dbr, $fname ) {
40 $links = [];
41 $res = $dbr->newSelectQueryBuilder()
42 ->select( [ 'el_to_domain_index', 'el_to_path' ] )
43 ->from( 'externallinks' )
44 ->where( [ 'el_from' => $pagId ] )
45 ->caller( $fname )->fetchResultSet();
46 foreach ( $res as $row ) {
47 $links[] = LinkFilter::reverseIndexes( $row->el_to_domain_index ) . $row->el_to_path;
48 }
49 return $links;
50 }
51}
A database connection without write operations.
newSelectQueryBuilder()
Create an empty SelectQueryBuilder which can be used to run queries against this connection.