fe42b00a1b11ba0a43da21fe1b8ef79c8a759c43
5 * @subpackage SpecialPage
11 * @subpackage SpecialPage
13 class DoubleRedirectsPage
extends PageQueryPage
{
16 return 'DoubleRedirects';
19 function isExpensive( ) { return true; }
20 function isSyndicated() { return false; }
22 function getPageHeader( ) {
23 #FIXME : probably need to add a backlink to the maintenance page.
24 return '<p>'.wfMsg("doubleredirectstext")."</p><br />\n";
27 function getSQLText( &$dbr, $namespace = null, $title = null ) {
29 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
31 $limitToTitle = !( $namespace === null && $title === null );
32 $sql = $limitToTitle ?
"SELECT" : "SELECT 'DoubleRedirects' as type," ;
34 " pa.page_namespace as namespace, pa.page_title as title," .
35 " pb.page_namespace as nsb, pb.page_title as tb," .
36 " pc.page_namespace as nsc, pc.page_title as tc" .
37 " FROM $pagelinks AS la, $pagelinks AS lb, $page AS pa, $page AS pb, $page AS pc" .
38 " WHERE pa.page_is_redirect=1 AND pb.page_is_redirect=1" .
39 " AND la.pl_from=pa.page_id" .
40 " AND la.pl_namespace=pb.page_namespace" .
41 " AND la.pl_title=pb.page_title" .
42 " AND lb.pl_from=pb.page_id" .
43 " AND lb.pl_namespace=pc.page_namespace" .
44 " AND lb.pl_title=pc.page_title";
47 $encTitle = $dbr->addQuotes( $title );
48 $sql .= " AND pa.page_namespace=$namespace" .
49 " AND pa.page_title=$encTitle";
56 $dbr =& wfGetDB( DB_SLAVE
);
57 return $this->getSQLText( $dbr );
64 function formatResult( $skin, $result ) {
67 $fname = 'DoubleRedirectsPage::formatResult';
68 $titleA = Title
::makeTitle( $result->namespace, $result->title
);
70 if ( $result && !isset( $result->nsb
) ) {
71 $dbr =& wfGetDB( DB_SLAVE
);
72 $sql = $this->getSQLText( $dbr, $result->namespace, $result->title
);
73 $res = $dbr->query( $sql, $fname );
75 $result = $dbr->fetchObject( $res );
76 $dbr->freeResult( $res );
83 $titleB = Title
::makeTitle( $result->nsb
, $result->tb
);
84 $titleC = Title
::makeTitle( $result->nsc
, $result->tc
);
86 $linkA = $skin->makeKnownLinkObj( $titleA,'', 'redirect=no' );
87 $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
88 $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
89 $linkC = $skin->makeKnownLinkObj( $titleC );
90 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
92 return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
99 function wfSpecialDoubleRedirects() {
100 list( $limit, $offset ) = wfCheckLimits();
102 $sdr = new DoubleRedirectsPage();
104 return $sdr->doQuery( $offset, $limit );