4 * @addtogroup SpecialPage
8 * A special page listing redirects to redirecting page.
9 * The software will automatically not follow double redirects, to prevent loops.
10 * @addtogroup SpecialPage
12 class DoubleRedirectsPage
extends PageQueryPage
{
15 return 'DoubleRedirects';
18 function isExpensive( ) { return true; }
19 function isSyndicated() { return false; }
21 function getPageHeader( ) {
22 return wfMsgExt( 'doubleredirectstext', array( 'parse' ) );
26 $dbr = wfGetDB( DB_SLAVE
);
27 list( $page, $redirect ) = $dbr->tableNamesN( 'page', 'redirect' );
30 'DoubleRedirects' as type,
31 pa.page_namespace as namespace, pa.page_title as title,
32 pb.page_namespace as nsb, pb.page_title as tb,
33 pc.page_namespace as nsc, pc.page_title as tc
41 ra.rd_from = pa.page_id
42 AND ra.rd_namespace = pb.page_namespace
43 AND ra.rd_title = pb.page_title
44 AND rb.rd_from = pb.page_id
45 AND rb.rd_namespace = pc.page_namespace
46 AND rb.rd_title = pc.page_title";
53 function formatResult( $skin, $result ) {
57 $titleA = Title
::makeTitle( $result->namespace, $result->title
);
58 $parts[] = $skin->makeKnownLinkObj( $titleA, '', 'redirect=no' );
59 $parts[] = '(' . $skin->makeKnownLinkObj(
61 wfMsgHtml( 'qbedit' ),
62 'action=edit&redirect=no'
65 // If the report isn't cached, generate some useful additional
66 // links to the target page, and *that* page's redirect target
67 if( isset( $result->nsb
) ) {
68 $parts[] = $wgContLang->getArrow() . $wgContLang->getDirMark();
69 $parts[] = $skin->makeKnownLinkObj(
70 Title
::makeTitle( $result->nsb
, $result->tb
),
74 $parts[] = $wgContLang->getArrow() . $wgContLang->getDirMark();
75 $parts[] = $skin->makeKnownLinkObj( Title
::makeTitle( $result->nsc
, $result->tc
) );
78 return implode( ' ', $parts );
85 function wfSpecialDoubleRedirects() {
86 list( $limit, $offset ) = wfCheckLimits();
87 $sdr = new DoubleRedirectsPage();
88 return $sdr->doQuery( $offset, $limit );