5 * @subpackage SpecialPage
11 * @subpackage SpecialPage
13 class BrokenRedirectsPage
extends PageQueryPage
{
14 var $targets = array();
17 return 'BrokenRedirects';
20 function isExpensive( ) { return true; }
21 function isSyndicated() { return false; }
23 function getPageHeader( ) {
25 return $wgOut->parse( wfMsg( 'brokenredirectstext' ) );
29 $dbr =& wfGetDB( DB_SLAVE
);
30 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
32 $sql = "SELECT 'BrokenRedirects' AS type,
33 p1.page_namespace AS namespace,
34 p1.page_title AS title,
38 JOIN $page p1 ON (p1.page_is_redirect=1 AND pl.pl_from=p1.page_id)
39 LEFT JOIN $page AS p2 ON (pl_namespace=p2.page_namespace AND pl_title=p2.page_title )
40 WHERE p2.page_namespace IS NULL";
48 function formatResult( $skin, $result ) {
51 $fromObj = Title
::makeTitle( $result->namespace, $result->title
);
52 if ( isset( $result->pl_title
) ) {
53 $toObj = Title
::makeTitle( $result->pl_namespace
, $result->pl_title
);
55 $blinks = $fromObj->getBrokenLinksFrom();
63 // $toObj may very easily be false if the $result list is cached
64 if ( !is_object( $toObj ) ) {
65 return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
68 $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
69 $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
70 $to = $skin->makeBrokenLinkObj( $toObj );
71 $arr = $wgContLang->getArrow();
73 return "$from $edit $arr $to";
80 function wfSpecialBrokenRedirects() {
81 list( $limit, $offset ) = wfCheckLimits();
83 $sbr = new BrokenRedirectsPage();
85 return $sbr->doQuery( $offset, $limit );