summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2023-12-11 22:11:27 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2023-12-11 22:11:27 +0000
commitaf88640c14c356c541dcf30c9554513f591e1b71 (patch)
tree735ef0f2d0e4fec1d3ba6827e7e063b88d114c91
parent91cf502ffd2af523ca3c873afe9f0bf87ba3a79b (diff)
parentf468220d759eda9ab632a8ecfeecdecc0d51b8b7 (diff)
Merge "api: Add support for pagelinks migration in ApiQueryBacklinks::runSecondQuery" into wmf/1.42.0-wmf.7wmf/1.42.0-wmf.7
-rw-r--r--includes/api/ApiQueryBacklinks.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php
index 728f1b9d2a35..2e1e403c7b76 100644
--- a/includes/api/ApiQueryBacklinks.php
+++ b/includes/api/ApiQueryBacklinks.php
@@ -231,15 +231,20 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
}
/**
- * @todo This should support links migration but since it's unreachable for templatelinks
- * it's not needed right now.
* @param ApiPageSet|null $resultPageSet
* @return void
*/
private function runSecondQuery( $resultPageSet = null ) {
$db = $this->getDB();
- $this->addTables( [ $this->bl_table, 'page' ] );
- $this->addWhere( "{$this->bl_from}=page_id" );
+ if ( isset( $this->linksMigration::$mapping[$this->bl_table] ) ) {
+ $queryInfo = $this->linksMigration->getQueryInfo( $this->bl_table, $this->bl_table );
+ $this->addTables( $queryInfo['tables'] );
+ $this->addJoinConds( $queryInfo['joins'] );
+ } else {
+ $this->addTables( [ $this->bl_table ] );
+ }
+ $this->addTables( [ 'page' ] );
+ $this->addJoinConds( [ 'page' => [ 'JOIN', "{$this->bl_from}=page_id" ] ] );
if ( $resultPageSet === null ) {
$this->addFields( [ 'page_id', 'page_title', 'page_namespace', 'page_is_redirect' ] );