jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370141 )
Change subject: SpecialDoubleRedirects: Use more descriptive aliases in the query ...................................................................... SpecialDoubleRedirects: Use more descriptive aliases in the query Change-Id: I88e579be8452da30b474d36cf7a9fba3ffdbf78a --- M includes/specials/SpecialDoubleRedirects.php 1 file changed, 30 insertions(+), 25 deletions(-) Approvals: Huji: Looks good to me, but someone else must approve jenkins-bot: Verified Jforrester: Looks good to me, approved diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php index 64b378c..ba14c66 100644 --- a/includes/specials/SpecialDoubleRedirects.php +++ b/includes/specials/SpecialDoubleRedirects.php @@ -66,15 +66,15 @@ 'title' => 'pa.page_title', 'value' => 'pa.page_title', - 'nsb' => 'pb.page_namespace', - 'tb' => 'pb.page_title', + 'b_namespace' => 'pb.page_namespace', + 'b_title' => 'pb.page_title', // Select fields from redirect instead of page. Because there may // not actually be a page table row for this target (e.g. for interwiki redirects) - 'nsc' => 'rb.rd_namespace', - 'tc' => 'rb.rd_title', - 'fc' => 'rb.rd_fragment', - 'iwc' => 'rb.rd_interwiki', + 'c_namespace' => 'rb.rd_namespace', + 'c_title' => 'rb.rd_title', + 'c_fragment' => 'rb.rd_fragment', + 'c_interwiki' => 'rb.rd_interwiki', ], 'conds' => [ 'ra.rd_from = pa.page_id', @@ -117,14 +117,12 @@ * @return string */ function formatResult( $skin, $result ) { - $titleA = Title::makeTitle( $result->namespace, $result->title ); - - // If only titleA is in the query, it means this came from - // querycache (which only saves 3 columns). + // If no Title B or C is in the query, it means this came from + // querycache (which only saves the 3 columns for title A). // That does save the bulk of the query cost, but now we need to // get a little more detail about each individual entry quickly // using the filter of reallyGetQueryInfo. - if ( $result && !isset( $result->nsb ) ) { + if ( $result && !isset( $result->b_namespace ) ) { $dbr = wfGetDB( DB_REPLICA ); $qi = $this->reallyGetQueryInfo( $result->namespace, @@ -141,20 +139,13 @@ $result = $dbr->fetchObject( $res ); } } + + $titleA = Title::makeTitle( $result->namespace, $result->title ); + $linkRenderer = $this->getLinkRenderer(); if ( !$result ) { return '<del>' . $linkRenderer->makeLink( $titleA, null, [], [ 'redirect' => 'no' ] ) . '</del>'; } - - $titleB = Title::makeTitle( $result->nsb, $result->tb ); - $titleC = Title::makeTitle( $result->nsc, $result->tc, $result->fc, $result->iwc ); - - $linkA = $linkRenderer->makeKnownLink( - $titleA, - null, - [], - [ 'redirect' => 'no' ] - ); // if the page is editable, add an edit link if ( @@ -173,6 +164,14 @@ $edit = ''; } + $linkA = $linkRenderer->makeKnownLink( + $titleA, + null, + [], + [ 'redirect' => 'no' ] + ); + + $titleB = Title::makeTitle( $result->b_namespace, $result->b_title ); $linkB = $linkRenderer->makeKnownLink( $titleB, null, @@ -180,6 +179,12 @@ [ 'redirect' => 'no' ] ); + $titleC = Title::makeTitle( + $result->c_namespace, + $result->c_title, + $result->c_fragment, + $result->c_interwiki + ); $linkC = $linkRenderer->makeKnownLink( $titleC, $titleC->getFullText() ); $lang = $this->getLanguage(); @@ -202,13 +207,13 @@ $batch = new LinkBatch; foreach ( $res as $row ) { $batch->add( $row->namespace, $row->title ); - if ( isset( $row->nsb ) ) { + if ( isset( $row->b_namespace ) ) { // lazy loaded when using cached results - $batch->add( $row->nsb, $row->tb ); + $batch->add( $row->b_namespace, $row->b_title ); } - if ( isset( $row->iwc ) && !$row->iwc ) { + if ( isset( $row->c_interwiki ) && !$row->c_interwiki ) { // lazy loaded when using cached result, not added when interwiki link - $batch->add( $row->nsc, $row->tc ); + $batch->add( $row->c_namespace, $row->c_title ); } } $batch->execute(); -- To view, visit https://gerrit.wikimedia.org/r/370141 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I88e579be8452da30b474d36cf7a9fba3ffdbf78a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Fomafix <foma...@googlemail.com> Gerrit-Reviewer: Huji <huji.h...@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits