Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/85517
Change subject: Fix redirect detection on image page's "file usages" section ...................................................................... Fix redirect detection on image page's "file usages" section When a redirect contains a file, the file usage section on the image page shows a wrong "(file redirect)". Fix this by looking, if the page is a redirect to the file, not a redirect alone. Now this looks closer to the result of Special:WhatLinksHere. Bug: 50488 Change-Id: I0994b91db6b61cfda83cd5348575db3feff3e773 --- M RELEASE-NOTES-1.22 M includes/ImagePage.php 2 files changed, 15 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/17/85517/1 diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index 3112e26..c47ed59 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -299,6 +299,7 @@ * (bug 26811) On DB error pages, server hostnames are now hidden when both $wgShowHostnames and $wgShowSQLErrors are false. * (bug 6200) line breaks in <blockquote> are handled like they are in <div> +* (bug 50488) Fix redirect detection on image page's "file usages" section. === API changes in 1.22 === * (bug 25553) The JSON output formatter now leaves forward slashes unescaped diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 7ea06b0..e33cc6c 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -694,11 +694,21 @@ $dbr = wfGetDB( DB_SLAVE ); return $dbr->select( - array( 'imagelinks', 'page' ), - array( 'page_namespace', 'page_title', 'page_is_redirect', 'il_to' ), + array( 'imagelinks', 'page', 'redirect' ), + array( 'page_namespace', 'page_title', 'rd_from', 'il_to' ), array( 'il_to' => $target, 'il_from = page_id' ), __METHOD__, - array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', ) + array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', ), + array( + 'redirect' => array( + 'LEFT JOIN', array( + 'rd_from = page_id', + 'rd_namespace' => NS_FILE, + 'rd_title' => $target, + 'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL' + ) + ) + ) ); } @@ -710,7 +720,7 @@ $rows = array(); $redirects = array(); foreach ( $res as $row ) { - if ( $row->page_is_redirect ) { + if ( $row->rd_from ) { $redirects[$row->page_title] = array(); } $rows[] = $row; -- To view, visit https://gerrit.wikimedia.org/r/85517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0994b91db6b61cfda83cd5348575db3feff3e773 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits