MediaWiki
master
ExternalLinksLookup.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\ExternalLinks
;
22
23
use
Wikimedia\Rdbms\IReadableDatabase
;
24
28
class
ExternalLinksLookup
{
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
}
MediaWiki\ExternalLinks\ExternalLinksLookup
Functions for looking up externallinks table.
Definition
ExternalLinksLookup.php:28
MediaWiki\ExternalLinks\ExternalLinksLookup\getExternalLinksForPage
static getExternalLinksForPage(int $pagId, IReadableDatabase $dbr, $fname)
Return an array of external links for a given page id.
Definition
ExternalLinksLookup.php:39
MediaWiki\ExternalLinks\LinkFilter\reverseIndexes
static reverseIndexes( $domainIndex)
Definition
LinkFilter.php:262
Wikimedia\Rdbms\IReadableDatabase
A database connection without write operations.
Definition
IReadableDatabase.php:37
Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder
newSelectQueryBuilder()
Create an empty SelectQueryBuilder which can be used to run queries against this connection.
MediaWiki\ExternalLinks
Definition
ExternalLinksLookup.php:21
includes
ExternalLinks
ExternalLinksLookup.php
Generated on Thu Nov 14 2024 17:23:27 for MediaWiki by
1.10.0