From 6e2fe8c9718dd6cf331e5891666e8bf0bab27187 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Tue, 8 Apr 2025 08:14:35 -0400 Subject: [PATCH 1/2] Make LINKS_TO work across enabled namespace --- src/PropertyAnnotators/LinksToPropertyAnnotator.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/PropertyAnnotators/LinksToPropertyAnnotator.php b/src/PropertyAnnotators/LinksToPropertyAnnotator.php index 2c4820e..ff6a5be 100644 --- a/src/PropertyAnnotators/LinksToPropertyAnnotator.php +++ b/src/PropertyAnnotators/LinksToPropertyAnnotator.php @@ -78,16 +78,15 @@ public function addAnnotation( DIProperty $property, SemanticData $semanticData 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 ) ); $res = $con->select( [ 'pl' => 'pagelinks', 'page' ], [ 'sel_title' => 'pl.pl_title', 'sel_ns' => 'pl.pl_namespace' ], - [ $where ], + $where, __METHOD__, [ 'DISTINCT' ], [ 'page' => [ 'JOIN', 'page_id=pl_from' ] ] From 53e86e3f3814564cf0d98b5651a484ee0be92aff Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Tue, 8 Apr 2025 08:17:50 -0400 Subject: [PATCH 2/2] Update LinksToPropertyAnnotator.php --- src/PropertyAnnotators/LinksToPropertyAnnotator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PropertyAnnotators/LinksToPropertyAnnotator.php b/src/PropertyAnnotators/LinksToPropertyAnnotator.php index ff6a5be..94699d3 100644 --- a/src/PropertyAnnotators/LinksToPropertyAnnotator.php +++ b/src/PropertyAnnotators/LinksToPropertyAnnotator.php @@ -81,7 +81,7 @@ public function addAnnotation( DIProperty $property, SemanticData $semanticData $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 ) ); + $where[] = sprintf( 'pl.pl_namespace IN (%s)', implode( ',', $this->enabledNamespaces ) ); $res = $con->select( [ 'pl' => 'pagelinks', 'page' ],