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
13 * @subpackage SpecialPage
16 class ListredirectsPage
extends QueryPage
{
18 function getName() { return( 'Listredirects' ); }
19 function isExpensive() { return( true ); }
20 function isSyndicated() { return( false ); }
21 function sortDescending() { return( false ); }
24 $dbr =& wfGetDB( DB_SLAVE
);
25 $page = $dbr->tableName( 'page' );
26 $sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace, 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 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
36 $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
38 # Find out where the redirect leads
39 $revision = Revision
::newFromTitle( $rd_title );
41 # Make a link to the destination page
42 $target = Title
::newFromRedirect( $revision->getText() );
44 $targetLink = $skin->makeLinkObj( $target );
46 /** @todo Put in some decent error display here */
50 /** @todo Put in some decent error display here */
54 # Format the whole thing and return it
55 return( $rd_link . $arr . $targetLink );
61 function wfSpecialListredirects() {
62 list( $limit, $offset ) = wfCheckLimits();
63 $lrp = new ListredirectsPage();
64 $lrp->doQuery( $offset, $limit );