4 * @subpackage SpecialPage
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 require_once 'QueryPage.php';
16 * @subpackage SpecialPage
19 class ListredirectsPage
extends QueryPage
{
21 function getName() { return( 'listredirects' ); }
22 function isExpensive() { return( true ); }
23 function isSyndicated() { return( false ); }
24 function sortDescending() { return( false ); }
27 $dbr =& wfGetDB( DB_SLAVE
);
28 extract( $dbr->tableNames( 'page' ) );
29 return( 'SELECT page_title AS title, page_namespace AS namespace, page_namespace AS value FROM ' . $page . ' WHERE page_is_redirect = 1' );
32 function formatResult( $skin, $result ) {
35 # Make a link to the redirect itself
36 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
37 $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
39 # Find out where the redirect leads
40 $rd_page = new Article( &$rd_title, 0 );
41 $rd_text = $rd_page->getContent( true ); # Don't follow the redirect
43 # Make a link to the destination page
44 $tp_title = Title
::newFromRedirect( $rd_text );
45 $tp_link = $skin->makeKnownLinkObj( $tp_title );
47 # Format the whole thing and return it
48 return( $rd_link . ' → ' . $tp_link );
54 function wfSpecialListredirects() {
55 list( $limit, $offset ) = wfCheckLimits();
56 $lrp = new ListredirectsPage();
57 $lrp->doQuery( $offset, $limit );