6 * @author Rob Church <robchur@gmail.com>
7 * @copyright © 2006 Rob Church
8 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
12 * Special:Listredirects - Lists all the redirects on the wiki.
13 * @ingroup SpecialPage
15 class ListredirectsPage
extends QueryPage
{
17 function getName() { return( 'Listredirects' ); }
18 function isExpensive() { return( true ); }
19 function isSyndicated() { return( false ); }
20 function sortDescending() { return( false ); }
23 $dbr = wfGetDB( DB_SLAVE
);
24 $page = $dbr->tableName( 'page' );
25 $sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace,
26 0 AS value FROM $page WHERE page_is_redirect = 1";
30 function formatResult( $skin, $result ) {
33 # Make a link to the redirect itself
34 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
35 $rd_link = $skin->link(
39 array( 'redirect' => 'no' )
42 # Find out where the redirect leads
43 $revision = Revision
::newFromTitle( $rd_title );
45 # Make a link to the destination page
46 $target = Title
::newFromRedirect( $revision->getText() );
48 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
49 $targetLink = $skin->link( $target );
50 return "$rd_link $arr $targetLink";
52 return "<s>$rd_link</s>";
55 return "<s>$rd_link</s>";
60 function wfSpecialListredirects() {
61 list( $limit, $offset ) = wfCheckLimits();
62 $lrp = new ListredirectsPage();
63 $lrp->doQuery( $offset, $limit );