Skip to content

Commit 1d48620

Browse files
authored
Merge pull request #257 from SemanticMediaWiki/fix_linksto
Make LINKS_TO work across enabled namespace
2 parents 9791801 + 53e86e3 commit 1d48620

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/PropertyAnnotators/LinksToPropertyAnnotator.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,15 @@ public function addAnnotation( DIProperty $property, SemanticData $semanticData
7878
return;
7979
}
8080

81-
$where = sprintf(
82-
'pl.pl_from = %s AND pl.pl_title != %s',
83-
$page->getArticleID(),
84-
$con->addQuotes( $page->getDBkey() )
85-
);
81+
$where = [];
82+
$where[] = sprintf( 'pl.pl_from = %s', $page->getArticleID() );
83+
$where[] = sprintf( 'pl.pl_title != %s', $con->addQuotes( $page->getDBkey() ) );
84+
$where[] = sprintf( 'pl.pl_namespace IN (%s)', implode( ',', $this->enabledNamespaces ) );
8685

8786
$res = $con->select(
8887
[ 'pl' => 'pagelinks', 'page' ],
8988
[ 'sel_title' => 'pl.pl_title', 'sel_ns' => 'pl.pl_namespace' ],
90-
[ $where ],
89+
$where,
9190
__METHOD__,
9291
[ 'DISTINCT' ],
9392
[ 'page' => [ 'JOIN', 'page_id=pl_from' ] ]

0 commit comments

Comments
 (0)