3 * @addtogroup SpecialPage
5 * @author Rob Church <robchur@gmail.com>
6 * @copyright © 2006 Rob Church
7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 * Special:Listredirects - Lists all the redirects on the wiki.
12 * @addtogroup SpecialPage
14 class ListredirectsPage
extends QueryPage
{
16 function getName() { return( 'Listredirects' ); }
17 function isExpensive() { return( true ); }
18 function isSyndicated() { return( false ); }
19 function sortDescending() { return( false ); }
22 $dbr = wfGetDB( DB_SLAVE
);
23 $page = $dbr->tableName( 'page' );
24 $sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page WHERE page_is_redirect = 1";
28 function formatResult( $skin, $result ) {
31 # Make a link to the redirect itself
32 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
33 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
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 $arr $targetLink";
59 function wfSpecialListredirects() {
60 list( $limit, $offset ) = wfCheckLimits();
61 $lrp = new ListredirectsPage();
62 $lrp->doQuery( $offset, $limit );