Skip to content

Make LINKS_TO work across enabled namespace #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/PropertyAnnotators/LinksToPropertyAnnotator.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@
return;
}

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

Check warning on line 84 in src/PropertyAnnotators/LinksToPropertyAnnotator.php

View check run for this annotation

Codecov / codecov/patch

src/PropertyAnnotators/LinksToPropertyAnnotator.php#L81-L84

Added lines #L81 - L84 were not covered by tests

$res = $con->select(
[ 'pl' => 'pagelinks', 'page' ],
[ 'sel_title' => 'pl.pl_title', 'sel_ns' => 'pl.pl_namespace' ],
[ $where ],
$where,

Check warning on line 89 in src/PropertyAnnotators/LinksToPropertyAnnotator.php

View check run for this annotation

Codecov / codecov/patch

src/PropertyAnnotators/LinksToPropertyAnnotator.php#L89

Added line #L89 was not covered by tests
__METHOD__,
[ 'DISTINCT' ],
[ 'page' => [ 'JOIN', 'page_id=pl_from' ] ]
Expand Down