5 * @subpackage SpecialPage
11 require_once('QueryPage.php');
16 * @subpackage SpecialPage
18 class BrokenRedirectsPage
extends PageQueryPage
{
19 var $targets = array();
22 return 'BrokenRedirects';
25 function isExpensive( ) { return true; }
26 function isSyndicated() { return false; }
28 function getPageHeader( ) {
30 return $wgOut->parse( wfMsg( 'brokenredirectstext' ) );
34 $dbr =& wfGetDB( DB_SLAVE
);
35 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
37 $sql = "SELECT 'BrokenRedirects' AS type,
38 p1.page_namespace AS namespace,
39 p1.page_title AS title,
43 JOIN $page p1 ON (p1.page_is_redirect=1 AND pl.pl_from=p1.page_id)
44 LEFT JOIN $page AS p2 ON (pl_namespace=p2.page_namespace AND pl_title=p2.page_title )
45 WHERE p2.page_namespace IS NULL";
53 function formatResult( $skin, $result ) {
54 $fromObj = Title
::makeTitle( $result->namespace, $result->title
);
55 if ( isset( $result->pl_title
) ) {
56 $toObj = Title
::makeTitle( $result->pl_namespace
, $result->pl_title
);
58 $blinks = $fromObj->getBrokenLinksFrom();
66 // $toObj may very easily be false if the $result list is cached
67 if ( !is_object( $toObj ) ) {
68 return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
71 $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
72 $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
73 $to = $skin->makeBrokenLinkObj( $toObj );
75 return "$from $edit → $to";
82 function wfSpecialBrokenRedirects() {
83 list( $limit, $offset ) = wfCheckLimits();
85 $sbr = new BrokenRedirectsPage();
87 return $sbr->doQuery( $offset, $limit );