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 ) {
49 $fromObj = Title
::makeTitle( $result->namespace, $result->title
);
50 if ( isset( $result->pl_title
) ) {
51 $toObj = Title
::makeTitle( $result->pl_namespace
, $result->pl_title
);
53 $blinks = $fromObj->getBrokenLinksFrom();
61 // $toObj may very easily be false if the $result list is cached
62 if ( !is_object( $toObj ) ) {
63 return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
66 $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
67 $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
68 $to = $skin->makeBrokenLinkObj( $toObj );
70 return "$from $edit → $to";
77 function wfSpecialBrokenRedirects() {
78 list( $limit, $offset ) = wfCheckLimits();
80 $sbr = new BrokenRedirectsPage();
82 return $sbr->doQuery( $offset, $limit );