3 * Implements Special:Listredirects
5 * Copyright © 2006 Rob Church
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
23 * @ingroup SpecialPage
24 * @author Rob Church <robchur@gmail.com>
28 * Special:Listredirects - Lists all the redirects on the wiki.
29 * @ingroup SpecialPage
31 class ListredirectsPage
extends QueryPage
{
33 function __construct( $name = 'Listredirects' ) {
34 parent
::__construct( $name );
37 function isExpensive() { return true; }
38 function isSyndicated() { return false; }
39 function sortDescending() { return false; }
41 function getQueryInfo() {
43 'tables' => array( 'p1' => 'page', 'redirect', 'p2' => 'page' ),
44 'fields' => array( 'p1.page_namespace AS namespace',
45 'p1.page_title AS title',
48 'p2.page_id AS redirid' ),
49 'conds' => array( 'p1.page_is_redirect' => 1 ),
50 'join_conds' => array( 'redirect' => array(
51 'LEFT JOIN', 'rd_from=p1.page_id' ),
52 'p2' => array( 'LEFT JOIN', array(
53 'p2.page_namespace=rd_namespace',
54 'p2.page_title=rd_title' ) ) )
58 function getOrderFields() {
59 return array ( 'p1.page_namespace', 'p1.page_title' );
62 function formatResult( $skin, $result ) {
65 # Make a link to the redirect itself
66 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
67 $rd_link = $skin->link(
71 array( 'redirect' => 'no' )
74 # Find out where the redirect leads
75 $revision = Revision
::newFromTitle( $rd_title );
77 # Make a link to the destination page
78 $target = Title
::newFromRedirect( $revision->getText() );
80 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
81 $targetLink = $skin->link( $target );
82 return "$rd_link $arr $targetLink";
84 return "<del>$rd_link</del>";
87 return "<del>$rd_link</del>";