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 $page = $dbr->tableName( 'page' );
29 $sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page WHERE page_is_redirect = 1";
33 function formatResult( $skin, $result ) {
36 # Make a link to the redirect itself
37 $rd_title = Title
::makeTitle( $result->namespace, $result->title
);
38 $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
40 # Find out where the redirect leads
41 $revision = Revision
::newFromTitle( $rd_title );
43 # Make a link to the destination page
44 $target = Title
::newFromRedirect( $revision->getText() );
46 $targetLink = $skin->makeLinkObj( $target );
48 /** @todo Put in some decent error display here */
52 /** @todo Put in some decent error display here */
56 # Check the language; RTL wikis need a ←
57 $arr = $wgContLang->isRTL() ?
' ← ' : ' → ';
59 # Format the whole thing and return it
60 return( $rd_link . $arr . $targetLink );
66 function wfSpecialListredirects() {
67 list( $limit, $offset ) = wfCheckLimits();
68 $lrp = new ListredirectsPage();
69 $lrp->doQuery( $offset, $limit );