typo, exclude the disamb link as articles obviously point to it
[mediawiki.git] / includes / SpecialBrokenRedirects.php
blob41011209dab1885ca06d6dd01753852e5610d4ad
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once('QueryPage.php');
13 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
18 class BrokenRedirectsPage extends PageQueryPage {
19 var $targets = array();
21 function getName() {
22 return 'BrokenRedirects';
25 function isExpensive( ) { return true; }
26 function isSyndicated() { return false; }
28 function getPageHeader( ) {
29 return '<p>'.wfMsg('brokenredirectstext')."</p><br />\n";
32 function getSQL() {
33 $dbr =& wfGetDB( DB_SLAVE );
34 extract( $dbr->tableNames( 'page', 'pagelinks' ) );
36 $sql = "SELECT 'BrokenRedirects' AS type,
37 p1.page_namespace AS namespace,
38 p1.page_title AS title,
39 pl_namespace,
40 pl_title
41 FROM $pagelinks, $page AS p1
42 LEFT JOIN $page AS p2
43 ON pl_namespace=p2.page_namespace AND pl_title=p2.page_title
44 WHERE p1.page_is_redirect=1
45 AND pl_from=p1.page_id
46 AND p2.page_namespace IS NULL";
47 return $sql;
50 function getOrder() {
51 return '';
54 function formatResult( $skin, $result ) {
55 $fromObj = Title::makeTitle( $result->namespace, $result->title );
56 if ( isset( $result->pl_title ) ) {
57 $toObj = Title::makeTitle( $result->pl_namespace, $result->pl_title );
58 } else {
59 $blinks = $fromObj->getBrokenLinksFrom();
60 if ( $blinks ) {
61 $toObj = $blinks[0];
62 } else {
63 $toObj = false;
67 // $toObj may very easily be false if the $result list is cached
68 if ( !is_object( $toObj ) ) {
69 return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
72 $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
73 $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
74 $to = $skin->makeBrokenLinkObj( $toObj );
76 return "$from $edit &rarr; $to";
80 /**
81 * constructor
83 function wfSpecialBrokenRedirects() {
84 list( $limit, $offset ) = wfCheckLimits();
86 $sbr = new BrokenRedirectsPage();
88 return $sbr->doQuery( $offset, $limit );