diff options
Diffstat (limited to 'includes/SpecialBrokenRedirects.php')
-rw-r--r-- | includes/SpecialBrokenRedirects.php | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index 50935654..208a7e1f 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -1,14 +1,13 @@ <?php /** * - * @package MediaWiki - * @subpackage SpecialPage + * @addtogroup SpecialPage */ /** - * - * @package MediaWiki - * @subpackage SpecialPage + * A special page listing redirects to non existent page. Those should be + * fixed to point to an existing page. + * @addtogroup SpecialPage */ class BrokenRedirectsPage extends PageQueryPage { var $targets = array(); @@ -26,17 +25,17 @@ class BrokenRedirectsPage extends PageQueryPage { } function getSQL() { - $dbr =& wfGetDB( DB_SLAVE ); - list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); + $dbr = wfGetDB( DB_SLAVE ); + list( $page, $redirect ) = $dbr->tableNamesN( 'page', 'redirect' ); $sql = "SELECT 'BrokenRedirects' AS type, p1.page_namespace AS namespace, p1.page_title AS title, - pl_namespace, - pl_title - FROM $pagelinks AS pl - JOIN $page p1 ON (p1.page_is_redirect=1 AND pl.pl_from=p1.page_id) - LEFT JOIN $page AS p2 ON (pl_namespace=p2.page_namespace AND pl_title=p2.page_title ) + rd_namespace, + rd_title + FROM $redirect AS rd + JOIN $page p1 ON (rd.rd_from=p1.page_id) + LEFT JOIN $page AS p2 ON (rd_namespace=p2.page_namespace AND rd_title=p2.page_title ) WHERE p2.page_namespace IS NULL"; return $sql; } @@ -46,11 +45,11 @@ class BrokenRedirectsPage extends PageQueryPage { } function formatResult( $skin, $result ) { - global $wgContLang; + global $wgUser, $wgContLang; $fromObj = Title::makeTitle( $result->namespace, $result->title ); - if ( isset( $result->pl_title ) ) { - $toObj = Title::makeTitle( $result->pl_namespace, $result->pl_title ); + if ( isset( $result->rd_title ) ) { + $toObj = Title::makeTitle( $result->rd_namespace, $result->rd_title ); } else { $blinks = $fromObj->getBrokenLinksFrom(); if ( $blinks ) { @@ -66,11 +65,19 @@ class BrokenRedirectsPage extends PageQueryPage { } $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' ); - $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no'); + $edit = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml( 'brokenredirects-edit' ), 'action=edit' ); $to = $skin->makeBrokenLinkObj( $toObj ); $arr = $wgContLang->getArrow(); - - return "$from $edit $arr $to"; + + $out = "{$from} {$edit}"; + + if( $wgUser->isAllowed( 'delete' ) ) { + $delete = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml( 'brokenredirects-delete' ), 'action=delete' ); + $out .= " {$delete}"; + } + + $out .= " {$arr} {$to}"; + return $out; } } |