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 return( 'SELECT page_title AS title, page_namespace AS namespace, page_namespace AS value FROM ' . $dbr->tableName( 'page' ) . ' WHERE page_is_redirect = 1' );
31 function formatResult( $skin, $result ) {
32 # Make a link to the redirect itself
33 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
34 $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
36 # Find out where the redirect leads
37 $revision = Revision
::newFromTitle( $rd_title );
39 # Make a link to the destination page
40 $target = Title
::newFromRedirect( $revision->getText() );
42 $targetLink = $skin->makeLinkObj( $target );
44 /** @todo Put in some decent error display here */
48 /** @todo Put in some decent error display here */
52 # Format the whole thing and return it
53 return( $rd_link . ' → ' . $targetLink );
59 function wfSpecialListredirects() {
60 list( $limit, $offset ) = wfCheckLimits();
61 $lrp = new ListredirectsPage();
62 $lrp->doQuery( $offset, $limit );